From 104ed48c2ffd71b5153126b38265b3ea789c19b5 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Mon, 4 Dec 2023 16:04:45 +0100 Subject: [PATCH 1/6] Build ARM variants --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3c0b3f7..01f0daf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - ARCH: [x86_64, i386] + ARCH: [x86_64, i386, armhf, aarch64] name: AppImage ${{ matrix.ARCH }} runs-on: ubuntu-20.04 From 92439feca4fe550344ccd1f756304d22ab2a05ff Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Mon, 4 Dec 2023 16:12:13 +0100 Subject: [PATCH 2/6] Fix ARM builds --- ci/build-appimage.sh | 34 +++++++++++++++++++--------------- ci/build-in-docker.sh | 2 +- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/ci/build-appimage.sh b/ci/build-appimage.sh index d7b23a2..b5bdfcf 100755 --- a/ci/build-appimage.sh +++ b/ci/build-appimage.sh @@ -20,28 +20,32 @@ cleanup() { trap cleanup EXIT # store repo root as variable -REPO_ROOT=$(readlink -f $(dirname $(dirname "$0"))) -OLD_CWD=$(readlink -f .) +REPO_ROOT="$(readlink -f "$(dirname "$(dirname "$0")")")" +OLD_CWD="$(readlink -f .)" pushd "$BUILD_DIR" -if [ "$ARCH" == "x86_64" ]; then - EXTRA_CMAKE_ARGS=() -elif [ "$ARCH" == "i386" ]; then - EXTRA_CMAKE_ARGS=("-DCMAKE_TOOLCHAIN_FILE=$REPO_ROOT/cmake/toolchains/i386-linux-gnu.cmake") -else - echo "Architecture not supported: $ARCH" 1>&2 - exit 1 -fi +case "$ARCH" in + x86_64|armhf|aarch64) + AIK_ARCH="$ARCH" + ;; + i386) + AIK_ARCH="i686" + ;; + *) + echo "Architecture not supported: $ARCH" 1>&2 + exit 1 + ;; +esac -cmake "$REPO_ROOT" -DCMAKE_INSTALL_PREFIX=/usr -DUSE_CCACHE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo "${EXTRA_CMAKE_ARGS[@]}" +cmake -G Ninja "$REPO_ROOT" -DCMAKE_INSTALL_PREFIX=/usr -DUSE_CCACHE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo "${EXTRA_CMAKE_ARGS[@]}" -make -j$(nproc) +nprocs="$(nproc)" +[[ "$nprocs" -gt 2 ]] && nprocs="$(nproc --ignore=1)" -make install DESTDIR=AppDir +ninja -v -j"$nprocs" -AIK_ARCH="$ARCH" -[ "$ARCH" == "i386" ] && AIK_ARCH="i686" +env DESTDIR=AppDir ninja -v install wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-"$ARCH".AppImage chmod +x linuxdeploy-"$ARCH".AppImage diff --git a/ci/build-in-docker.sh b/ci/build-in-docker.sh index 9faff62..2e8f0c4 100644 --- a/ci/build-in-docker.sh +++ b/ci/build-in-docker.sh @@ -59,7 +59,7 @@ docker run \ <<\EOF apt-get update -apt-get install -y gcc g++ cmake git wget file curl +apt-get install -y gcc g++ ninja-build cmake git wget file curl bash -euxo pipefail ci/build-appimage.sh From fc28a15cfe59817ee8c7cd43280b718fbf7a1ef1 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Mon, 4 Dec 2023 16:18:56 +0100 Subject: [PATCH 3/6] No need for toolchains anymore --- cmake/toolchains/i386-linux-gnu.cmake | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 cmake/toolchains/i386-linux-gnu.cmake diff --git a/cmake/toolchains/i386-linux-gnu.cmake b/cmake/toolchains/i386-linux-gnu.cmake deleted file mode 100644 index 65c7b8b..0000000 --- a/cmake/toolchains/i386-linux-gnu.cmake +++ /dev/null @@ -1,5 +0,0 @@ -set(CMAKE_SYSTEM_NAME Linux CACHE STRING "" FORCE) -set(CMAKE_SYSTEM_PROCESSOR i386 CACHE STRING "" FORCE) - -set(CMAKE_C_FLAGS "-m32" CACHE STRING "" FORCE) -set(CMAKE_CXX_FLAGS "-m32" CACHE STRING "" FORCE) From 2903c2d29c155afd5ded525c4f8bbdeec9a5e639 Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Mon, 4 Dec 2023 16:23:14 +0100 Subject: [PATCH 4/6] Resolve circular dependency between linuxdeploy and this plugin --- ci/build-appimage.sh | 36 ++----------------------- ci/build-bundle.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 34 deletions(-) create mode 100755 ci/build-bundle.sh diff --git a/ci/build-appimage.sh b/ci/build-appimage.sh index b5bdfcf..7d7e2c6 100755 --- a/ci/build-appimage.sh +++ b/ci/build-appimage.sh @@ -23,41 +23,9 @@ trap cleanup EXIT REPO_ROOT="$(readlink -f "$(dirname "$(dirname "$0")")")" OLD_CWD="$(readlink -f .)" -pushd "$BUILD_DIR" +bash "$REPO_ROOT"/ci/build-bundle.sh -case "$ARCH" in - x86_64|armhf|aarch64) - AIK_ARCH="$ARCH" - ;; - i386) - AIK_ARCH="i686" - ;; - *) - echo "Architecture not supported: $ARCH" 1>&2 - exit 1 - ;; -esac - -cmake -G Ninja "$REPO_ROOT" -DCMAKE_INSTALL_PREFIX=/usr -DUSE_CCACHE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo "${EXTRA_CMAKE_ARGS[@]}" - -nprocs="$(nproc)" -[[ "$nprocs" -gt 2 ]] && nprocs="$(nproc --ignore=1)" - -ninja -v -j"$nprocs" - -env DESTDIR=AppDir ninja -v install - -wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-"$ARCH".AppImage -chmod +x linuxdeploy-"$ARCH".AppImage - -# bundle appimagetool -wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-"$AIK_ARCH".AppImage - -chmod +x appimagetool-"$AIK_ARCH".AppImage - -./appimagetool-"$AIK_ARCH".AppImage --appimage-extract -mv squashfs-root/ AppDir/appimagetool-prefix/ -ln -s ../../appimagetool-prefix/AppRun AppDir/usr/bin/appimagetool +mv linuxdeploy-plugin-appimage-bundle AppDir export UPD_INFO="gh-releases-zsync|linuxdeploy|linuxdeploy-plugin-appimage|continuous|linuxdeploy-plugin-appimage-$ARCH.AppImage" diff --git a/ci/build-bundle.sh b/ci/build-bundle.sh new file mode 100755 index 0000000..d8281ab --- /dev/null +++ b/ci/build-bundle.sh @@ -0,0 +1,62 @@ +#! /bin/bash + +set -euxo pipefail + +# use RAM disk if possible +if [ "${CI:-}" == "" ] && [ -d /docker-ramdisk ]; then + TEMP_BASE=/docker-ramdisk +else + TEMP_BASE=/tmp +fi + +BUILD_DIR=$(mktemp -d -p "$TEMP_BASE" linuxdeploy-plugin-appimage-build-XXXXXX) + +cleanup() { + if [ -d "$BUILD_DIR" ]; then + rm -rf "$BUILD_DIR" + fi +} + +trap cleanup EXIT + +# store repo root as variable +REPO_ROOT="$(readlink -f "$(dirname "$(dirname "$0")")")" +OLD_CWD="$(readlink -f .)" + +pushd "$BUILD_DIR" + +case "$ARCH" in + x86_64|armhf|aarch64) + AIK_ARCH="$ARCH" + ;; + i386) + AIK_ARCH="i686" + ;; + *) + echo "Architecture not supported: $ARCH" 1>&2 + exit 1 + ;; +esac + +cmake -G Ninja "$REPO_ROOT" -DCMAKE_INSTALL_PREFIX=/usr -DUSE_CCACHE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo "${EXTRA_CMAKE_ARGS[@]}" + +nprocs="$(nproc)" +[[ "$nprocs" -gt 2 ]] && nprocs="$(nproc --ignore=1)" + +ninja -v -j"$nprocs" + +env DESTDIR=linuxdeploy-plugin-appimage-bundle ninja -v install + +wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-"$ARCH".AppImage +chmod +x linuxdeploy-"$ARCH".AppImage + +# linuxdeploy-plugin-appimage-bundle appimagetool +wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-"$AIK_ARCH".AppImage + +chmod +x appimagetool-"$AIK_ARCH".AppImage + +./appimagetool-"$AIK_ARCH".AppImage --appimage-extract +mv squashfs-root/ linuxdeploy-plugin-appimage-bundle/appimagetool-prefix/ +ln -s ../../appimagetool-prefix/AppRun linuxdeploy-plugin-appimage-bundle/usr/bin/appimagetool + +mv linuxdeploy-plugin-appimage-bundle "$OLD_CWD" From 71760fad78e2ef708c8e781e110f2e7b135c162d Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Mon, 4 Dec 2023 16:27:18 +0100 Subject: [PATCH 5/6] fixup! Resolve circular dependency between linuxdeploy and this plugin --- ci/build-appimage.sh | 3 +++ ci/build-bundle.sh | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/build-appimage.sh b/ci/build-appimage.sh index 7d7e2c6..70d1abf 100755 --- a/ci/build-appimage.sh +++ b/ci/build-appimage.sh @@ -27,6 +27,9 @@ bash "$REPO_ROOT"/ci/build-bundle.sh mv linuxdeploy-plugin-appimage-bundle AppDir +wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-"$ARCH".AppImage +chmod +x linuxdeploy-"$ARCH".AppImage + export UPD_INFO="gh-releases-zsync|linuxdeploy|linuxdeploy-plugin-appimage|continuous|linuxdeploy-plugin-appimage-$ARCH.AppImage" # deploy linuxdeploy-plugin-appimage diff --git a/ci/build-bundle.sh b/ci/build-bundle.sh index d8281ab..e868a75 100755 --- a/ci/build-bundle.sh +++ b/ci/build-bundle.sh @@ -47,9 +47,6 @@ ninja -v -j"$nprocs" env DESTDIR=linuxdeploy-plugin-appimage-bundle ninja -v install -wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-"$ARCH".AppImage -chmod +x linuxdeploy-"$ARCH".AppImage - # linuxdeploy-plugin-appimage-bundle appimagetool wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-"$AIK_ARCH".AppImage From 0ca2b31b5ec13ad9672691e56cc8ada9c83fc27f Mon Sep 17 00:00:00 2001 From: TheAssassin Date: Mon, 4 Dec 2023 16:37:20 +0100 Subject: [PATCH 6/6] fixup! fixup! Resolve circular dependency between linuxdeploy and this plugin --- ci/build-appimage.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/build-appimage.sh b/ci/build-appimage.sh index 70d1abf..087f72b 100755 --- a/ci/build-appimage.sh +++ b/ci/build-appimage.sh @@ -23,6 +23,8 @@ trap cleanup EXIT REPO_ROOT="$(readlink -f "$(dirname "$(dirname "$0")")")" OLD_CWD="$(readlink -f .)" +pushd "$BUILD_DIR" + bash "$REPO_ROOT"/ci/build-bundle.sh mv linuxdeploy-plugin-appimage-bundle AppDir