Skip to content

Commit

Permalink
Resolve circular dependency between linuxdeploy and this plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAssassin committed Dec 4, 2023
1 parent fe5e429 commit 35d354b
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 9 deletions.
13 changes: 4 additions & 9 deletions ci/build-appimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,12 @@ make install DESTDIR=AppDir
AIK_ARCH="$ARCH"
[ "$ARCH" == "i386" ] && AIK_ARCH="i686"

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
bash "$REPO_ROOT"/ci/build-bundle.sh

chmod +x appimagetool-"$AIK_ARCH".AppImage
mv linuxdeploy-plugin-appimage-bundle AppDir

./appimagetool-"$AIK_ARCH".AppImage --appimage-extract
mv squashfs-root/ AppDir/appimagetool-prefix/
ln -s ../../appimagetool-prefix/AppRun AppDir/usr/bin/appimagetool
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"

Expand Down
59 changes: 59 additions & 0 deletions ci/build-bundle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#! /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

# 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"

0 comments on commit 35d354b

Please sign in to comment.