add arm64 appimage
This commit is contained in:
1 parent
c19cd28de8
commit
c7847f0d9e
9 files changed
+248
-40
No files matched your search
@@ -83,6 +83,113 @@ jobs:
|
||||
build/appimage-runtime/
|
||||
if-no-files-found: warn
|
||||
|
||||
linux-arm64:
|
||||
runs-on: ubuntu-24.04-arm
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Read Flutter source pin
|
||||
id: flutter-arm
|
||||
run: echo "revision=$(jq -r '.flutter.source_revision' scripts/appimage-tools.json)" >> "$GITHUB_OUTPUT"
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: main
|
||||
flutter-version: ${{ steps.flutter-arm.outputs.revision }}
|
||||
architecture: arm64
|
||||
git-source: https://github.com/flutter/flutter.git
|
||||
cache: true
|
||||
- name: Verify native ARM64 toolchain
|
||||
run: |
|
||||
test "$(uname -m)" = aarch64
|
||||
mkdir -p build
|
||||
flutter --version --machine > build/flutter-version.json
|
||||
jq -e --arg revision "${{ steps.flutter-arm.outputs.revision }}" '.frameworkVersion == "3.47.4" and .frameworkRevision == $revision' build/flutter-version.json
|
||||
- name: Install Linux build deps
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y clang cmake ninja-build pkg-config jq libgtk-3-dev librsvg2-dev libgirepository1.0-dev libgtk-3-bin libgdk-pixbuf2.0-bin libgdk-pixbuf-2.0-dev dpkg-dev patchelf file desktop-file-utils xdg-user-dirs shellcheck libssl-dev libunwind-dev libvulkan-dev libgl1-mesa-dev libasound2-dev libsecret-1-dev
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/meshcore-open/appimage
|
||||
key: linux-appimage-aarch64-${{ hashFiles('scripts/appimage-tools.json') }}
|
||||
- name: Test packaging contracts
|
||||
run: |
|
||||
shellcheck scripts/build_appimage.sh scripts/appimage/*.sh scripts/appimage/AppRun
|
||||
bash scripts/appimage/test_packaging.sh
|
||||
- run: flutter pub get
|
||||
- run: flutter test --reporter expanded
|
||||
- run: flutter build linux --release --no-pub
|
||||
- name: Test ARM64 AppImage in clean Ubuntu
|
||||
run: |
|
||||
docker build --platform linux/arm64 --target runtime-test --build-arg "BASE_IMAGE=$(jq -r '.ubuntu' scripts/appimage-tools.json)" -f scripts/appimage/Dockerfile -t meshcore-appimage-runtime-arm64 scripts
|
||||
mkdir -p build/appimage-runtime
|
||||
docker run --rm --platform linux/arm64 --user "$(id -u):$(id -g)" --mount "type=bind,source=$PWD/build/linux/arm64/release/meshcore-open-aarch64.AppImage,target=/artifact.AppImage,readonly" --mount "type=bind,source=$PWD/scripts/appimage/test_runtime.sh,target=/test_runtime.sh,readonly" --mount "type=bind,source=$PWD/build/appimage-runtime,target=/results" meshcore-appimage-runtime-arm64 xvfb-run -a bash /test_runtime.sh /artifact.AppImage /results
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: linux-arm64-appimage
|
||||
path: |
|
||||
build/linux/arm64/release/meshcore-open-aarch64.AppImage
|
||||
build/linux/arm64/release/appimage-audit.txt
|
||||
build/linux/arm64/release/appimage-tools.json
|
||||
build/flutter-version.json
|
||||
build/appimage-runtime/
|
||||
if-no-files-found: warn
|
||||
|
||||
linux-arm64:
|
||||
runs-on: ubuntu-24.04-arm
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Read Flutter source pin
|
||||
id: flutter-arm
|
||||
run: echo "revision=$(jq -r '.flutter.source_revision' scripts/appimage-tools.json)" >> "$GITHUB_OUTPUT"
|
||||
- name: Set up pinned native Flutter SDK
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: main
|
||||
flutter-version: ${{ steps.flutter-arm.outputs.revision }}
|
||||
architecture: arm64
|
||||
git-source: https://github.com/flutter/flutter.git
|
||||
cache: true
|
||||
- name: Verify native ARM64 Flutter
|
||||
env:
|
||||
FLUTTER_REVISION: ${{ steps.flutter-arm.outputs.revision }}
|
||||
run: |
|
||||
test "$(uname -m)" = aarch64
|
||||
mkdir -p build
|
||||
flutter --version --machine > build/flutter-version.json
|
||||
jq -e --arg revision "$FLUTTER_REVISION" '.frameworkVersion == "3.47.4" and .frameworkRevision == $revision' build/flutter-version.json
|
||||
- name: Install Linux build deps
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y clang cmake ninja-build pkg-config jq libgtk-3-dev librsvg2-dev libgirepository1.0-dev libgtk-3-bin libgdk-pixbuf2.0-bin libgdk-pixbuf-2.0-dev dpkg-dev patchelf file desktop-file-utils xdg-user-dirs shellcheck libssl-dev libunwind-dev libvulkan-dev libgl1-mesa-dev libasound2-dev libsecret-1-dev
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/meshcore-open/appimage
|
||||
key: linux-appimage-aarch64-${{ hashFiles('scripts/appimage-tools.json') }}
|
||||
- name: Test packaging contracts
|
||||
run: |
|
||||
shellcheck scripts/build_appimage.sh scripts/appimage/*.sh scripts/appimage/AppRun
|
||||
bash scripts/appimage/test_packaging.sh
|
||||
- run: flutter pub get
|
||||
- run: flutter test --reporter expanded
|
||||
- run: flutter build linux --release --no-pub
|
||||
- name: Test ARM64 AppImage in clean Ubuntu
|
||||
run: |
|
||||
docker build --platform linux/arm64 --target runtime-test --build-arg "BASE_IMAGE=$(jq -r '.ubuntu' scripts/appimage-tools.json)" -f scripts/appimage/Dockerfile -t meshcore-appimage-runtime-arm64 scripts
|
||||
mkdir -p build/appimage-runtime
|
||||
docker run --rm --platform linux/arm64 --user "$(id -u):$(id -g)" --mount "type=bind,source=$PWD/build/linux/arm64/release/meshcore-open-aarch64.AppImage,target=/artifact.AppImage,readonly" --mount "type=bind,source=$PWD/scripts/appimage/test_runtime.sh,target=/test_runtime.sh,readonly" --mount "type=bind,source=$PWD/build/appimage-runtime,target=/results" meshcore-appimage-runtime-arm64 xvfb-run -a bash /test_runtime.sh /artifact.AppImage /results
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: linux-arm64-appimage
|
||||
path: |
|
||||
build/linux/arm64/release/meshcore-open-aarch64.AppImage
|
||||
build/linux/arm64/release/appimage-audit.txt
|
||||
build/linux/arm64/release/appimage-tools.json
|
||||
build/flutter-version.json
|
||||
build/appimage-runtime/
|
||||
if-no-files-found: warn
|
||||
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
|
||||
@@ -24,7 +24,7 @@ bash scripts/appimage/test_packaging.sh
|
||||
|
||||
The versioned web build uses `dart run build_pipe:build` (also `bun run build`). Web deployment pins Flutter 3.41.2; Linux packaging uses the SDK pin in `scripts/appimage-tools.json`; other CI jobs track stable. Read `pubspec.yaml` for current app version and dependencies rather than copying them into this guide.
|
||||
|
||||
Linux Release installs also generate `build/linux/x64/release/meshcore-open-x86_64.AppImage` using linuxdeploy/GTK and an explicit appimagetool invocation. Tools and the runtime download automatically with pinned SHA-256 checksums. `MESHCORE_BUILD_APPIMAGE=0` skips packaging at install time, without a CMake cache reset. Debug/Profile are unchanged. Nix-linked bundles and hosts with glibc newer than the pinned baseline trigger an isolated Ubuntu rebuild through an available Podman/Docker engine. Rootless Podman uses `--userns=keep-id` for host-owned bind mounts; see [Linux AppImage](README.md#linux-appimage) for prerequisites, cache/offline behavior and limitations. Preserve binary/data/lib adjacency and nested native assets when changing packaging.
|
||||
Linux Release installs generate architecture-matched AppImages using linuxdeploy/GTK and appimagetool: x86_64 on x64 and AArch64 on ARM64. Tools and runtime download automatically with pinned SHA-256 checksums. `MESHCORE_BUILD_APPIMAGE=0` skips packaging at install time, without a CMake cache reset. Debug/Profile are unchanged. Nix-linked x64 bundles and hosts with glibc newer than the pinned baseline trigger an isolated Ubuntu rebuild through an available Podman/Docker engine. Rootless Podman uses `--userns=keep-id` for host-owned bind mounts; see [Linux AppImage](README.md#linux-appimage) for prerequisites, cache/offline behavior and limitations. Preserve binary/data/lib adjacency and nested native assets when changing packaging.
|
||||
|
||||
For Linux, use `nix develop`; see [Linux with Nix](README.md#linux-with-nix) for the pinned SDK, native build checks, cache troubleshooting, and Sysprof host prerequisites.
|
||||
|
||||
|
||||
@@ -152,11 +152,13 @@ The matrix describes implemented functionality, not a guarantee that every featu
|
||||
|
||||
### Linux AppImage
|
||||
|
||||
`flutter build linux --release` produces both the regular Flutter bundle and
|
||||
`build/linux/x64/release/meshcore-open-x86_64.AppImage`. Packaging runs after
|
||||
Flutter installs its assets and native libraries. Debug and Profile builds do
|
||||
not produce an AppImage. The initial AppImage target is x86_64, with Ubuntu
|
||||
24.04 as the packaging baseline; older distributions are not guaranteed.
|
||||
`flutter build linux --release` produces the regular Flutter bundle and an
|
||||
AppImage on supported Linux architectures. The x86_64 artifact is
|
||||
`build/linux/x64/release/meshcore-open-x86_64.AppImage`; the ARM64 artifact is
|
||||
`build/linux/arm64/release/meshcore-open-aarch64.AppImage`. Debug and Profile
|
||||
builds do not produce AppImages.
|
||||
Both use Ubuntu 24.04 as the packaging baseline; older distributions are not
|
||||
guaranteed.
|
||||
|
||||
For a bundle-only build, including other architectures:
|
||||
|
||||
@@ -173,14 +175,21 @@ sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev \
|
||||
libgdk-pixbuf-2.0-dev dpkg-dev patchelf binutils curl jq file desktop-file-utils xdg-user-dirs
|
||||
```
|
||||
|
||||
The build automatically downloads checksum-verified linuxdeploy, its GTK
|
||||
plugin, appimagetool, and an AppImage runtime. Pins are in
|
||||
The build automatically downloads checksum-verified architecture-matched
|
||||
linuxdeploy, its GTK plugin, appimagetool, and an AppImage runtime. Pins are in
|
||||
`scripts/appimage-tools.json`; the cache is under
|
||||
`${XDG_CACHE_HOME:-$HOME/.cache}/meshcore-open/appimage/`. Packaging can reuse
|
||||
valid cached tools offline, but Flutter dependencies and native-library
|
||||
downloads must also be available. A packaging failure fails the enabled build,
|
||||
without publishing a stale image as a new artifact.
|
||||
|
||||
GitHub Actions builds ARM64 on a native `ubuntu-24.04-arm` runner. Flutter's
|
||||
Linux release SDK archive is x64-only, so that job bootstraps Flutter 3.47.4
|
||||
from its pinned source revision. Flutter does not support x64-to-ARM64 Linux
|
||||
cross-builds; use an ARM64 Linux host to build the ARM64 bundle locally. The
|
||||
ARM64 AppImage is CI-built and hardware validation on a Raspberry Pi 5 is still
|
||||
needed for graphics, BLE, USB and inference behavior.
|
||||
|
||||
Hosts with newer glibc than the pinned baseline (2.39 for Ubuntu 24.04),
|
||||
including Ubuntu 26.04 runners under `ubuntu-latest`, use the same isolated
|
||||
Ubuntu rebuild as Nix. A usable Podman or Docker engine is required on those
|
||||
|
||||
@@ -31,7 +31,14 @@ mismatch must not be bypassed: remove the named corrupted cache file and retry.
|
||||
Tools are pinned in `scripts/appimage-tools.json`; cached tools can be reused
|
||||
offline, but dependency downloads and first-time container setup still need
|
||||
network access. Use `MESHCORE_BUILD_APPIMAGE=0 flutter build linux --release`
|
||||
for a bundle-only build, including ARM builds.
|
||||
for a bundle-only build, including unsupported architectures/build hosts.
|
||||
|
||||
ARM64 AppImages are built on a native GitHub `ubuntu-24.04-arm` runner using
|
||||
the pinned Flutter source revision. An x64 host cannot use Flutter's Linux
|
||||
cross-build option to produce ARM64; build locally on an ARM64 Linux host or
|
||||
use the CI artifact. The CI smoke test checks AArch64 ELF files and launches
|
||||
under emulation on an ARM64 runner, but does not replace Raspberry Pi 5
|
||||
graphics, BLE, USB or inference hardware testing.
|
||||
|
||||
For a Nix build or a host with glibc newer than the pinned Ubuntu baseline,
|
||||
verify that your user can access Podman or Docker without interactive
|
||||
|
||||
+28
-11
@@ -3,25 +3,42 @@
|
||||
"glibc": "2.39",
|
||||
"flutter": {
|
||||
"version": "3.47.4",
|
||||
"source_revision": "9584c6713b324636289d067944a46fd6b49df14b",
|
||||
"url": "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.47.4-stable.tar.xz",
|
||||
"sha256": "5b45f0ceda99b9bebdc873e7e69f6450aeb4c30f454b505e2e62fc9255a907d3"
|
||||
},
|
||||
"tools": {
|
||||
"linuxdeploy": {
|
||||
"url": "https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20251107-1/linuxdeploy-x86_64.AppImage",
|
||||
"sha256": "c20cd71e3a4e3b80c3483cef793cda3f4e990aca14014d23c544ca3ce1270b4d"
|
||||
},
|
||||
"appimagetool": {
|
||||
"url": "https://github.com/AppImage/appimagetool/releases/download/1.9.1/appimagetool-x86_64.AppImage",
|
||||
"sha256": "ed4ce84f0d9caff66f50bcca6ff6f35aae54ce8135408b3fa33abfc3cb384eb0"
|
||||
},
|
||||
"gtk": {
|
||||
"url": "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/7a3fbc31a9e5075073ff8790f26effbac5f84453/linuxdeploy-plugin-gtk.sh",
|
||||
"sha256": "b0f4cbc684a0103a9651f0955b635eaea0096b3a66c0f5a2c2aa337960375171"
|
||||
},
|
||||
"runtime": {
|
||||
"url": "https://github.com/AppImage/type2-runtime/releases/download/20251108/runtime-x86_64",
|
||||
"sha256": "2fca8b443c92510f1483a883f60061ad09b46b978b2631c807cd873a47ec260d"
|
||||
"x86_64": {
|
||||
"linuxdeploy": {
|
||||
"url": "https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20251107-1/linuxdeploy-x86_64.AppImage",
|
||||
"sha256": "c20cd71e3a4e3b80c3483cef793cda3f4e990aca14014d23c544ca3ce1270b4d"
|
||||
},
|
||||
"appimagetool": {
|
||||
"url": "https://github.com/AppImage/appimagetool/releases/download/1.9.1/appimagetool-x86_64.AppImage",
|
||||
"sha256": "ed4ce84f0d9caff66f50bcca6ff6f35aae54ce8135408b3fa33abfc3cb384eb0"
|
||||
},
|
||||
"runtime": {
|
||||
"url": "https://github.com/AppImage/type2-runtime/releases/download/20251108/runtime-x86_64",
|
||||
"sha256": "2fca8b443c92510f1483a883f60061ad09b46b978b2631c807cd873a47ec260d"
|
||||
}
|
||||
},
|
||||
"aarch64": {
|
||||
"linuxdeploy": {
|
||||
"url": "https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20251107-1/linuxdeploy-aarch64.AppImage",
|
||||
"sha256": "620095110d693282b8ebeb244a95b5e911cf8f65f76c88b4b47d16ae6346fcff"
|
||||
},
|
||||
"appimagetool": {
|
||||
"url": "https://github.com/AppImage/appimagetool/releases/download/1.9.1/appimagetool-aarch64.AppImage",
|
||||
"sha256": "f0837e7448a0c1e4e650a93bb3e85802546e60654ef287576f46c71c126a9158"
|
||||
},
|
||||
"runtime": {
|
||||
"url": "https://github.com/AppImage/type2-runtime/releases/download/20251108/runtime-aarch64",
|
||||
"sha256": "00cbdfcf917cc6c0ff6d3347d59e0ca1f7f45a6df1a428a0d6d8a78664d87444"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,6 @@ ENV PATH="/opt/flutter/bin:${PATH}"
|
||||
FROM ${BASE_IMAGE} AS runtime-test
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
xvfb xauth x11-utils x11-apps xdotool imagemagick dbus-x11 libgl1 libegl1 libgles2 \
|
||||
libgl1-mesa-dri fonts-dejavu-core \
|
||||
xvfb xauth x11-utils x11-apps xdotool imagemagick dbus-x11 binutils libgl1 libegl1 libgles2 \
|
||||
libgl1-mesa-dri fonts-dejavu-core \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
@@ -16,6 +16,10 @@ assert_fails() {
|
||||
assert_fails packaging_enabled Debug
|
||||
assert_fails packaging_enabled Profile
|
||||
packaging_enabled Release
|
||||
[[ "$(canonical_arch x64)" == x86_64 ]]
|
||||
[[ "$(canonical_arch aarch64)" == aarch64 ]]
|
||||
[[ "$(canonical_arch arm64)" == aarch64 ]]
|
||||
assert_fails canonical_arch riscv64
|
||||
MESHCORE_BUILD_APPIMAGE=0 assert_fails packaging_enabled Release
|
||||
assert_fails check_bundle "$temporary/missing"
|
||||
|
||||
@@ -32,7 +36,13 @@ MESHCORE_BUILD_APPIMAGE=0 bash "$project/scripts/build_appimage.sh" \
|
||||
bash "$project/scripts/build_appimage.sh" "$project" /missing "$temporary/output" Debug x64
|
||||
[[ ! -d "$temporary/output" ]]
|
||||
assert_fails bash "$project/scripts/build_appimage.sh" \
|
||||
"$project" /missing "$temporary/output" Release arm64
|
||||
"$project" /missing "$temporary/output" Release riscv64
|
||||
jq -e '.flutter.source_revision == "9584c6713b324636289d067944a46fd6b49df14b" and
|
||||
(.tools.x86_64.linuxdeploy.sha256 | length == 64) and
|
||||
(.tools.aarch64.linuxdeploy.sha256 | length == 64) and
|
||||
(.tools.aarch64.appimagetool.sha256 | length == 64) and
|
||||
(.tools.aarch64.runtime.sha256 | length == 64)' \
|
||||
"$project/scripts/appimage-tools.json" >/dev/null
|
||||
|
||||
stage_bundle "$project" "$temporary/bundle" "$temporary/AppDir with spaces"
|
||||
check_bundle "$temporary/AppDir with spaces/usr/bin"
|
||||
@@ -50,10 +60,36 @@ assert_fails download_verified "file://$temporary/input" \
|
||||
printf 'corruption\n' >> "$temporary/cache/tool"
|
||||
assert_fails download_verified "file://$temporary/input" "$checksum" "$temporary/cache/tool"
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
download_verified() {
|
||||
printf '%s %s\n' "$1" "$3" >> "$temporary/tool-selection"
|
||||
mkdir -p "$(dirname "$3")"
|
||||
: > "$3"
|
||||
}
|
||||
|
||||
prepare_tools "$project/scripts/appimage-tools.json" "$temporary/tools-x64" x86_64
|
||||
prepare_tools "$project/scripts/appimage-tools.json" "$temporary/tools-arm64" aarch64
|
||||
grep -Fq 'linuxdeploy-x86_64.AppImage' "$temporary/tool-selection"
|
||||
grep -Fq 'appimagetool-x86_64.AppImage' "$temporary/tool-selection"
|
||||
grep -Fq 'runtime-x86_64' "$temporary/tool-selection"
|
||||
grep -Fq 'linuxdeploy-aarch64.AppImage' "$temporary/tool-selection"
|
||||
grep -Fq 'appimagetool-aarch64.AppImage' "$temporary/tool-selection"
|
||||
grep -Fq 'runtime-aarch64' "$temporary/tool-selection"
|
||||
unset -f download_verified
|
||||
|
||||
mkdir -p "$temporary/project/scripts/appimage"
|
||||
touch "$temporary/project/pubspec.lock"
|
||||
cp "$project/scripts/appimage/Dockerfile" "$temporary/project/scripts/appimage/"
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
jq() {
|
||||
case "$*" in
|
||||
*'.flutter.version'*) printf '3.47.4\n' ;;
|
||||
*'.ubuntu'*) printf 'ubuntu:24.04\n' ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
podman() {
|
||||
case "$1" in
|
||||
@@ -84,7 +120,7 @@ package_container "$temporary/project" "$temporary/output" \
|
||||
"$project/scripts/appimage-tools.json" "$temporary/container-cache"
|
||||
assert_fails grep -Fxq -- '--userns=keep-id' "$temporary/container-arguments"
|
||||
grep -Fxq -- "$(id -u):$(id -g)" "$temporary/container-arguments"
|
||||
unset -f podman docker
|
||||
unset -f jq podman docker
|
||||
|
||||
# shellcheck disable=SC2329
|
||||
readelf() {
|
||||
|
||||
@@ -4,6 +4,15 @@ set -euo pipefail
|
||||
image="$(realpath "$1")"
|
||||
mkdir -p "$2"
|
||||
output="$(realpath "$2")"
|
||||
case "$(uname -m)" in
|
||||
x86_64) expected_machine='Advanced Micro Devices X86-64' ;;
|
||||
aarch64) expected_machine='AArch64' ;;
|
||||
*) printf 'Unsupported runtime-test architecture: %s\n' "$(uname -m)" >&2; exit 1 ;;
|
||||
esac
|
||||
if ! readelf -h "$image" | grep -Fq "$expected_machine"; then
|
||||
printf 'AppImage runtime is not built for %s\n' "$(uname -m)" >&2
|
||||
exit 1
|
||||
fi
|
||||
workspace="$(mktemp -d)"
|
||||
app_pid=''
|
||||
bus_pid=''
|
||||
@@ -23,6 +32,13 @@ appdir="$workspace/squashfs-root"
|
||||
-f "$appdir/usr/bin/data/icudtl.dat" && -d "$appdir/usr/bin/data/flutter_assets" ]]
|
||||
[[ -f "$appdir/usr/bin/lib/libonnxruntime.so.1" && \
|
||||
-f "$appdir/usr/share/glib-2.0/schemas/gschemas.compiled" ]]
|
||||
while IFS= read -r -d '' library; do
|
||||
if readelf -h "$library" >/dev/null 2>&1 && \
|
||||
! readelf -h "$library" | grep -Fq "$expected_machine"; then
|
||||
printf 'Wrong ELF architecture in AppImage: %s\n' "${library#"$appdir/"}" >&2
|
||||
exit 1
|
||||
fi
|
||||
done < <(find "$appdir/usr/bin" "$appdir/usr/lib" -type f -print0)
|
||||
ldd "$appdir/usr/bin/meshcore_open" > "$output/dependencies.log" 2>&1
|
||||
while IFS= read -r -d '' library; do
|
||||
printf '\n%s\n' "${library#"$appdir/"}" >> "$output/dependencies.log"
|
||||
|
||||
+32
-16
@@ -10,6 +10,14 @@ packaging_enabled() {
|
||||
[[ "${MESHCORE_BUILD_APPIMAGE:-1}" != 0 && "$1" == Release ]]
|
||||
}
|
||||
|
||||
canonical_arch() {
|
||||
case "$1" in
|
||||
x64|x86_64) printf 'x86_64\n' ;;
|
||||
arm64|aarch64) printf 'aarch64\n' ;;
|
||||
*) fail "Unsupported AppImage architecture: $1"; return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
check_bundle() {
|
||||
local bundle="$1"
|
||||
[[ -x "$bundle/meshcore_open" && -f "$bundle/lib/libapp.so" && \
|
||||
@@ -53,13 +61,18 @@ require_tools() {
|
||||
}
|
||||
|
||||
prepare_tools() {
|
||||
local manifest="$1" cache="$2" tool url checksum
|
||||
local manifest="$1" cache="$2" architecture="$3" tool url checksum
|
||||
mkdir -p "$cache"
|
||||
exec {cache_lock}>"$cache/tools.lock"
|
||||
flock "$cache_lock"
|
||||
for tool in linuxdeploy appimagetool gtk runtime; do
|
||||
url="$(jq -er --arg tool "$tool" '.tools[$tool].url' "$manifest")"
|
||||
checksum="$(jq -er --arg tool "$tool" '.tools[$tool].sha256' "$manifest")"
|
||||
if [[ "$tool" == gtk ]]; then
|
||||
url="$(jq -er '.tools.gtk.url' "$manifest")"
|
||||
checksum="$(jq -er '.tools.gtk.sha256' "$manifest")"
|
||||
else
|
||||
url="$(jq -er --arg arch "$architecture" --arg tool "$tool" '.tools[$arch][$tool].url' "$manifest")"
|
||||
checksum="$(jq -er --arg arch "$architecture" --arg tool "$tool" '.tools[$arch][$tool].sha256' "$manifest")"
|
||||
fi
|
||||
download_verified "$url" "$checksum" "$cache/$tool"
|
||||
chmod +x "$cache/$tool"
|
||||
done
|
||||
@@ -104,14 +117,16 @@ audit_appdir() {
|
||||
}
|
||||
|
||||
package_direct() {
|
||||
local project="$1" bundle="$2" output="$3" manifest="$4" cache="$5"
|
||||
local work appdir library relative linuxdeploy appimagetool
|
||||
local project="$1" bundle="$2" output="$3" manifest="$4" cache="$5" architecture="$6"
|
||||
local work appdir library relative linuxdeploy appimagetool appimage_name appimage_arch
|
||||
local dependencies=()
|
||||
require_tools curl jq sha256sum flock file readelf patchelf pkg-config \
|
||||
desktop-file-validate glib-compile-schemas gdk-pixbuf-thumbnailer xdg-user-dir
|
||||
pkg-config --exists gtk+-3.0 librsvg-2.0 gobject-introspection-1.0 || \
|
||||
{ fail 'Missing GTK, librsvg or GObject introspection development files'; return 1; }
|
||||
prepare_tools "$manifest" "$cache"
|
||||
prepare_tools "$manifest" "$cache" "$architecture"
|
||||
appimage_arch="$architecture"
|
||||
appimage_name="meshcore-open-$architecture.AppImage"
|
||||
work="$(mktemp -d "$output/appimage.XXXXXX")"
|
||||
# shellcheck disable=SC2064
|
||||
trap "rm -rf -- $(printf '%q' "$work")" EXIT
|
||||
@@ -172,10 +187,10 @@ package_direct() {
|
||||
cp "$MESHCORE_APPIMAGE_FLUTTER_ROOT/LICENSE" "$appdir/usr/share/doc/meshcore-open/Flutter-LICENSE"
|
||||
fi
|
||||
audit_appdir "$appdir" "$work/audit.txt"
|
||||
ARCH=x86_64 "$appimagetool" --runtime-file "$cache/runtime" --no-appstream \
|
||||
"$appdir" "$work/meshcore-open-x86_64.AppImage"
|
||||
chmod +x "$work/meshcore-open-x86_64.AppImage"
|
||||
mv "$work/meshcore-open-x86_64.AppImage" "$output/meshcore-open-x86_64.AppImage"
|
||||
ARCH="$appimage_arch" "$appimagetool" --runtime-file "$cache/runtime" --no-appstream \
|
||||
"$appdir" "$work/$appimage_name"
|
||||
chmod +x "$work/$appimage_name"
|
||||
mv "$work/$appimage_name" "$output/$appimage_name"
|
||||
mv "$work/audit.txt" "$output/appimage-audit.txt"
|
||||
cp "$manifest" "$output/appimage-tools.json"
|
||||
rm -rf "$work"
|
||||
@@ -283,25 +298,26 @@ main() {
|
||||
[[ $# == 5 ]] || { fail 'Expected: project bundle output configuration architecture'; return 1; }
|
||||
local project="$1" bundle="$2" output="$3" configuration="$4" architecture="$5"
|
||||
packaging_enabled "$configuration" || return 0
|
||||
[[ "$architecture" == x64 || "$architecture" == x86_64 ]] || \
|
||||
{ fail 'Only x86_64 AppImages are supported; set MESHCORE_BUILD_APPIMAGE=0 for other architectures'; return 1; }
|
||||
architecture="$(canonical_arch "$architecture")" || return 1
|
||||
mkdir -p "$output"
|
||||
output="$(realpath "$output")"
|
||||
exec {output_lock}>"$output/appimage.lock"
|
||||
flock "$output_lock"
|
||||
rm -f "$output/meshcore-open-x86_64.AppImage" "$output/appimage-audit.txt" "$output/appimage-tools.json"
|
||||
rm -f "$output/meshcore-open-$architecture.AppImage" "$output/appimage-audit.txt" "$output/appimage-tools.json"
|
||||
check_bundle "$bundle"
|
||||
require_tools jq readelf sha256sum
|
||||
local manifest="$project/scripts/appimage-tools.json" pin cache
|
||||
pin="$(sha256sum "$manifest")"
|
||||
pin="${pin%% *}"
|
||||
cache="${XDG_CACHE_HOME:-$HOME/.cache}/meshcore-open/appimage/$pin/x86_64"
|
||||
cache="${XDG_CACHE_HOME:-$HOME/.cache}/meshcore-open/appimage/$pin/$architecture"
|
||||
if requires_container_rebuild "$bundle/meshcore_open" "$(jq -er '.glibc' "$manifest")"; then
|
||||
[[ "$architecture" == x86_64 ]] || \
|
||||
{ fail 'ARM64 container rebuild is not configured; build on an Ubuntu 24.04 ARM64 host or set MESHCORE_BUILD_APPIMAGE=0'; return 1; }
|
||||
package_container "$project" "$output" "$manifest" "$cache"
|
||||
else
|
||||
package_direct "$project" "$bundle" "$output" "$manifest" "$cache"
|
||||
package_direct "$project" "$bundle" "$output" "$manifest" "$cache" "$architecture"
|
||||
fi
|
||||
printf 'AppImage created: %s/meshcore-open-x86_64.AppImage\n' "$output"
|
||||
printf 'AppImage created: %s/meshcore-open-%s.AppImage\n' "$output" "$architecture"
|
||||
}
|
||||
|
||||
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
|
||||
|
||||
Reference in new issue
Block a user