diff --git a/linux/build_release.sh b/linux/build_release.sh index bf9437c..42a66bb 100755 --- a/linux/build_release.sh +++ b/linux/build_release.sh @@ -12,8 +12,8 @@ set -euo pipefail platform="${1:-x86_64}" case "${platform}" in - x86_64) arch="x86_64-unknown-linux-gnu" ;; - arm) arch="aarch64-unknown-linux-gnu" ;; + x86_64) arch="x86_64-unknown-linux-gnu"; appimage_arch="x86_64" ;; + arm) arch="aarch64-unknown-linux-gnu"; appimage_arch="aarch64" ;; *) echo "Usage: build_release.sh [platform] (platform: 'x86_64' | 'arm')" >&2; exit 1 ;; esac @@ -51,7 +51,13 @@ out="target/${arch}/release/Goblin-${platform}.AppImage" rm -f "target/${arch}/release/"*.AppImage # Use the DEV appimagetool + type2 runtime when fetched, else the system tool. appimagetool_bin="${GOBLIN_APPIMAGETOOL:-appimagetool}" +# The type2 runtime must match the target arch. env.sh sets GOBLIN_APPIMAGE_RUNTIME +# to the x86_64 runtime; for a non-x86_64 target use the sibling runtime-. +runtime_file="${GOBLIN_APPIMAGE_RUNTIME:-}" +if [ "${appimage_arch}" != "x86_64" ] && [ -n "${runtime_file}" ]; then + runtime_file="$(dirname "${runtime_file}")/runtime-${appimage_arch}" +fi runtime_arg=() -[ -n "${GOBLIN_APPIMAGE_RUNTIME:-}" ] && runtime_arg=(--runtime-file "${GOBLIN_APPIMAGE_RUNTIME}") -ARCH=x86_64 "${appimagetool_bin}" "${runtime_arg[@]}" "${appdir}" "${out}" +[ -n "${runtime_file}" ] && [ -e "${runtime_file}" ] && runtime_arg=(--runtime-file "${runtime_file}") +ARCH="${appimage_arch}" "${appimagetool_bin}" "${runtime_arg[@]}" "${appdir}" "${out}" echo "built: ${out}" diff --git a/scripts/toolchain.sh b/scripts/toolchain.sh index d3fe640..2a95e29 100755 --- a/scripts/toolchain.sh +++ b/scripts/toolchain.sh @@ -49,11 +49,12 @@ fetch_zig() { } fetch_appimage() { - [ -x "${TC}/appimagetool" ] && [ -e "${TC}/runtime-x86_64" ] && { echo "appimagetool ${AT_VER}: present"; return; } - echo "appimage: fetching appimagetool ${AT_VER} + type2 runtime…" + [ -x "${TC}/appimagetool" ] && [ -e "${TC}/runtime-x86_64" ] && [ -e "${TC}/runtime-aarch64" ] && { echo "appimagetool ${AT_VER}: present"; return; } + echo "appimage: fetching appimagetool ${AT_VER} + type2 runtimes (x86_64 + aarch64)…" dl "${DEV}/appimagetool/releases/download/${AT_VER}/appimagetool-x86_64.AppImage" "${TC}/appimagetool" dl "${DEV}/appimage-type2-runtime/releases/download/${RT_TAG}/runtime-x86_64" "${TC}/runtime-x86_64" - chmod +x "${TC}/appimagetool" "${TC}/runtime-x86_64" + dl "${DEV}/appimage-type2-runtime/releases/download/${RT_TAG}/runtime-aarch64" "${TC}/runtime-aarch64" + chmod +x "${TC}/appimagetool" "${TC}/runtime-x86_64" "${TC}/runtime-aarch64" } # Assemble a minimal Android SDK (build-tools + platform + platform-tools) from