From f29d8322aaa7446df5fd8ff29b574abd8fb360d0 Mon Sep 17 00:00:00 2001 From: Samuel <36420837+Samueru-sama@users.noreply.github.com> Date: Sat, 2 Nov 2024 11:13:38 -0400 Subject: [PATCH 1/7] CI: Add AppImage --- .github/workflows/main.yml | 25 +++++++++++ AppImage/make-appimage.sh | 91 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 AppImage/make-appimage.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4840cbbbc..0e94b649b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -111,3 +111,28 @@ jobs: runs-on: ubuntu-latest container: image: ghcr.io/dunst-project/docker-images:misc-doxygen + + appimage: + runs-on: ubuntu-22.04 + container: alpine:latest + steps: + - uses: actions/checkout@v4 + + - name: build appimage + if: always() + run: | + apk add wget git build-base patchelf libxscrnsaver-dev libxinerama-dev \ + libxrandr-dev libnotify-dev dbus-dev wayland-dev perl pango-dev \ + wayland-protocols dbus librsvg desktop-file-utils + + chmod +x ./AppImage/make-appimage.sh + ./AppImage/make-appimage.sh + + mkdir dist + mv *.AppImage dist/ + + - name: Upload appimage artifact + uses: actions/upload-artifact@v4.4.0 + with: + name: AppImage + path: 'dist' diff --git a/AppImage/make-appimage.sh b/AppImage/make-appimage.sh new file mode 100644 index 000000000..365f29e13 --- /dev/null +++ b/AppImage/make-appimage.sh @@ -0,0 +1,91 @@ +#!/bin/sh + +# This script is meant to be ran on alpine linux, dependencies: +# wget build-base patchelf libxscrnsaver-dev libxinerama-dev libxrandr-dev libnotify-dev +# dbus-dev wayland-dev perl pango-dev wayland-protocols dbus librsvg desktop-file-utils + +set -e +export ARCH="$(uname -m)" +export APPIMAGE_EXTRACT_AND_RUN=1 +APPIMAGETOOL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" +export COMPLETIONS=0 + +# BUILD DUNST +mkdir -p ./AppDir +make -j$(nproc) PREFIX="$PWD"/AppDir/usr +make install PREFIX="$PWD"/AppDir/usr +cd ./AppDir + +# AppRun +echo "Creating AppRun..." +cat >> ./AppRun << 'EOF' +#!/bin/sh +CURRENTDIR="$(dirname "$(readlink -f "$0")")" +export PATH="$CURRENTDIR/usr/bin:$PATH" +[ -z "$APPIMAGE" ] && APPIMAGE="$0" +BIN="${ARGV0#./}" +unset ARGV0 +if [ -f "$CURRENTDIR/usr/bin/$BIN" ]; then + if [ "$BIN" = "dunstctl" ]; then + exec "$CURRENTDIR/usr/bin/$BIN" "$@" + else + exec "$CURRENTDIR/ld-musl-x86_64.so.1" "$CURRENTDIR/usr/bin/$BIN" "$@" + fi +elif [ "$1" = "--notify" ]; then + shift + exec "$CURRENTDIR/ld-musl-x86_64.so.1" "$CURRENTDIR"/usr/bin/dunstify "$@" +elif [ "$1" = "--ctl" ]; then + shift + exec "$CURRENTDIR"/usr/bin/dunstctl "$@" +else + if [ -z "$1" ]; then + echo "AppImage commands:" + echo " \"$APPIMAGE\" runs dunst" + echo " \"$APPIMAGE --notify\" runs dunstify" + echo " \"$APPIMAGE --ctl\" runs dunstctl" + echo "You can also make and run symlinks to the AppImage with the names" + echo "dunstify and dunstctl to launch them automatically without extra args" + echo "running dunst..." + fi + exec "$CURRENTDIR/ld-musl-x86_64.so.1" "$CURRENTDIR/usr/bin/dunst" "$@" +fi +EOF +chmod +x ./AppRun + +# Dummy Icon & Desktop +echo "Placing .desktop and icon..." +touch ./dunst.png && ln -s ./dunst.png ./.DirIcon # No official icon? +cat >> ./dunst.desktop << 'EOF' # No official .desktop? +[Desktop Entry] +Type=Application +Name=dunst +Icon=dunst +Exec=dunst +Categories=System +Hidden=true +EOF + +# DEPLOY ALL LIBS +echo "Deploying dependencies..." +mkdir -p ./usr/lib +ldd ./usr/bin/* | awk -F"[> ]" '{print $4}' | xargs -I {} cp -vf {} ./usr/lib +if [ -f ./usr/lib/ld-musl-x86_64.so.1 ]; then + mv ./usr/lib/ld-musl-x86_64.so.1 ./ +else + cp /lib/ld-musl-x86_64.so.1 ./ +fi +find ./usr/bin -type f -exec patchelf --set-rpath '$ORIGIN/../lib' {} ';' +find ./usr/lib -type f -exec patchelf --set-rpath '$ORIGIN' {} ';' +find ./usr/lib ./usr/bin -type f -exec strip -s -R .comment --strip-unneeded {} ';' + +# Do the thing! +echo "Generating AppImage..." +#export VERSION="$(./AppRun --version | awk '{print $(NF-1)}')" # This breaks for some reason? +cd .. +wget -q "$APPIMAGETOOL" -O appimagetool +chmod +x ./appimagetool +./appimagetool --comp zstd \ + --mksquashfs-opt -Xcompression-level --mksquashfs-opt 22 \ + -n ./AppDir ./dunst-"$ARCH".AppImage +ls +echo "All Done!" From 95bef12c3f5baca01036af86ee445e826e1056fc Mon Sep 17 00:00:00 2001 From: Samuel <36420837+Samueru-sama@users.noreply.github.com> Date: Sun, 10 Nov 2024 10:57:29 -0400 Subject: [PATCH 2/7] sort dependencies Co-authored-by: Benedikt Heine --- .github/workflows/main.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e94b649b..cd4200c17 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -121,9 +121,23 @@ jobs: - name: build appimage if: always() run: | - apk add wget git build-base patchelf libxscrnsaver-dev libxinerama-dev \ - libxrandr-dev libnotify-dev dbus-dev wayland-dev perl pango-dev \ - wayland-protocols dbus librsvg desktop-file-utils + apk add \ + build-base \ + dbus \ + dbus-dev \ + desktop-file-utils \ + git \ + libnotify-dev \ + librsvg \ + libxinerama-dev \ + libxrandr-dev \ + libxscrnsaver-dev \ + pango-dev \ + patchelf \ + perl \ + wayland-dev \ + wayland-protocols \ + wget chmod +x ./AppImage/make-appimage.sh ./AppImage/make-appimage.sh From 21b2fa5b803c339193003fbebd1592c9ece72902 Mon Sep 17 00:00:00 2001 From: Samuel <36420837+Samueru-sama@users.noreply.github.com> Date: Sun, 10 Nov 2024 11:10:17 -0400 Subject: [PATCH 3/7] use case statement in `AppRun` Co-authored-by: Benedikt Heine --- AppImage/make-appimage.sh | 50 ++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/AppImage/make-appimage.sh b/AppImage/make-appimage.sh index 365f29e13..f064ab82c 100644 --- a/AppImage/make-appimage.sh +++ b/AppImage/make-appimage.sh @@ -25,30 +25,32 @@ export PATH="$CURRENTDIR/usr/bin:$PATH" [ -z "$APPIMAGE" ] && APPIMAGE="$0" BIN="${ARGV0#./}" unset ARGV0 -if [ -f "$CURRENTDIR/usr/bin/$BIN" ]; then - if [ "$BIN" = "dunstctl" ]; then - exec "$CURRENTDIR/usr/bin/$BIN" "$@" - else - exec "$CURRENTDIR/ld-musl-x86_64.so.1" "$CURRENTDIR/usr/bin/$BIN" "$@" - fi -elif [ "$1" = "--notify" ]; then - shift - exec "$CURRENTDIR/ld-musl-x86_64.so.1" "$CURRENTDIR"/usr/bin/dunstify "$@" -elif [ "$1" = "--ctl" ]; then - shift - exec "$CURRENTDIR"/usr/bin/dunstctl "$@" -else - if [ -z "$1" ]; then - echo "AppImage commands:" - echo " \"$APPIMAGE\" runs dunst" - echo " \"$APPIMAGE --notify\" runs dunstify" - echo " \"$APPIMAGE --ctl\" runs dunstctl" - echo "You can also make and run symlinks to the AppImage with the names" - echo "dunstify and dunstctl to launch them automatically without extra args" - echo "running dunst..." - fi - exec "$CURRENTDIR/ld-musl-x86_64.so.1" "$CURRENTDIR/usr/bin/dunst" "$@" -fi +case in "${BIN}" in + dunst|dunstify) + exec "$CURRENTDIR/ld-musl-${ARCH}.so.1" "$CURRENTDIR/usr/bin/$BIN" "$@" + ;; + dunstctl) + exec "$CURRENTDIR/usr/bin/$BIN" "$@" + ;; + "") + echo "AppImage commands:" + echo " \"$APPIMAGE dunst\" runs dunst" + echo " \"$APPIMAGE dunstify\" runs dunstify" + echo " \"$APPIMAGE dunstctl\" runs dunstctl" + echo "You can also make and run symlinks to the AppImage with the names" + echo "dunstify and dunstctl to launch them automatically without extra args" + echo "running dunst..." + "${APPIMAGE}" dunst + ;; + *) + echo "AppImage commands:" + echo " \"$APPIMAGE dunst\" runs dunst" + echo " \"$APPIMAGE dunstify\" runs dunstify" + echo " \"$APPIMAGE dunstctl\" runs dunstctl" + echo "You can also make and run symlinks to the AppImage with the names" + echo "dunstify and dunstctl to launch them automatically without extra args" + ;; +esac EOF chmod +x ./AppRun From 451c899fbca14b2d38c2df030c11fc5dd39a2aad Mon Sep 17 00:00:00 2001 From: Samuel <36420837+Samueru-sama@users.noreply.github.com> Date: Sun, 10 Nov 2024 11:18:19 -0400 Subject: [PATCH 4/7] use `$ARCH` and declare it in `AppRun` --- AppImage/make-appimage.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/AppImage/make-appimage.sh b/AppImage/make-appimage.sh index f064ab82c..d600b4f1e 100644 --- a/AppImage/make-appimage.sh +++ b/AppImage/make-appimage.sh @@ -7,7 +7,7 @@ set -e export ARCH="$(uname -m)" export APPIMAGE_EXTRACT_AND_RUN=1 -APPIMAGETOOL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" +APPIMAGETOOL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$ARCH.AppImage" export COMPLETIONS=0 # BUILD DUNST @@ -21,6 +21,7 @@ echo "Creating AppRun..." cat >> ./AppRun << 'EOF' #!/bin/sh CURRENTDIR="$(dirname "$(readlink -f "$0")")" +ARCH="$(uname -m)" export PATH="$CURRENTDIR/usr/bin:$PATH" [ -z "$APPIMAGE" ] && APPIMAGE="$0" BIN="${ARGV0#./}" @@ -71,10 +72,10 @@ EOF echo "Deploying dependencies..." mkdir -p ./usr/lib ldd ./usr/bin/* | awk -F"[> ]" '{print $4}' | xargs -I {} cp -vf {} ./usr/lib -if [ -f ./usr/lib/ld-musl-x86_64.so.1 ]; then - mv ./usr/lib/ld-musl-x86_64.so.1 ./ +if [ -f ./usr/lib/ld-musl-"$ARCH".so.1 ]; then + mv ./usr/lib/ld-musl-"$ARCH".so.1 ./ else - cp /lib/ld-musl-x86_64.so.1 ./ + cp /lib/ld-musl-"$ARCH".so.1 ./ fi find ./usr/bin -type f -exec patchelf --set-rpath '$ORIGIN/../lib' {} ';' find ./usr/lib -type f -exec patchelf --set-rpath '$ORIGIN' {} ';' From ec2bb7f68ce80745b641826668c4e229f78fba10 Mon Sep 17 00:00:00 2001 From: Samuel <36420837+Samueru-sama@users.noreply.github.com> Date: Sun, 10 Nov 2024 11:50:07 -0400 Subject: [PATCH 5/7] fix case statement in `AppRun` --- AppImage/make-appimage.sh | 55 +++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/AppImage/make-appimage.sh b/AppImage/make-appimage.sh index d600b4f1e..2d4e88991 100644 --- a/AppImage/make-appimage.sh +++ b/AppImage/make-appimage.sh @@ -26,31 +26,36 @@ export PATH="$CURRENTDIR/usr/bin:$PATH" [ -z "$APPIMAGE" ] && APPIMAGE="$0" BIN="${ARGV0#./}" unset ARGV0 -case in "${BIN}" in - dunst|dunstify) - exec "$CURRENTDIR/ld-musl-${ARCH}.so.1" "$CURRENTDIR/usr/bin/$BIN" "$@" - ;; - dunstctl) - exec "$CURRENTDIR/usr/bin/$BIN" "$@" - ;; - "") - echo "AppImage commands:" - echo " \"$APPIMAGE dunst\" runs dunst" - echo " \"$APPIMAGE dunstify\" runs dunstify" - echo " \"$APPIMAGE dunstctl\" runs dunstctl" - echo "You can also make and run symlinks to the AppImage with the names" - echo "dunstify and dunstctl to launch them automatically without extra args" - echo "running dunst..." - "${APPIMAGE}" dunst - ;; - *) - echo "AppImage commands:" - echo " \"$APPIMAGE dunst\" runs dunst" - echo " \"$APPIMAGE dunstify\" runs dunstify" - echo " \"$APPIMAGE dunstctl\" runs dunstctl" - echo "You can also make and run symlinks to the AppImage with the names" - echo "dunstify and dunstctl to launch them automatically without extra args" - ;; + +case "${BIN}" in + dunst|dunstify) + exec "$CURRENTDIR/ld-musl-${ARCH}.so.1" "$CURRENTDIR/usr/bin/$BIN" "$@" + ;; + dunstctl) + exec "$CURRENTDIR/usr/bin/$BIN" "$@" + ;; + ""|*) + BIN="$1" + case "${BIN}" in + dunst|dunstify) + shift + exec "$CURRENTDIR/ld-musl-${ARCH}.so.1" "$CURRENTDIR/usr/bin/$BIN" "$@" + ;; + dunstctl) + shift + exec "$CURRENTDIR/usr/bin/$BIN" "$@" + ;; + ""|*) + echo "AppImage commands:" + echo " \"$APPIMAGE dunst\" runs dunst" + echo " \"$APPIMAGE dunstify\" runs dunstify" + echo " \"$APPIMAGE dunstctl\" runs dunstctl" + echo "You can also make and run symlinks to the AppImage with the names" + echo "dunstify and dunstctl to launch them automatically without extra args" + echo "running dunst..." + exec "$CURRENTDIR/ld-musl-${ARCH}.so.1" "$CURRENTDIR/usr/bin/dunst" "$@" + ;; + esac esac EOF chmod +x ./AppRun From e1c4cd595ce0feeae8c3e8861030f6bae4756048 Mon Sep 17 00:00:00 2001 From: Samuel <36420837+Samueru-sama@users.noreply.github.com> Date: Sun, 10 Nov 2024 12:24:41 -0400 Subject: [PATCH 6/7] fix `$VERSION` and add it to appimage file name --- AppImage/make-appimage.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AppImage/make-appimage.sh b/AppImage/make-appimage.sh index 2d4e88991..ff6a2b284 100644 --- a/AppImage/make-appimage.sh +++ b/AppImage/make-appimage.sh @@ -88,12 +88,12 @@ find ./usr/lib ./usr/bin -type f -exec strip -s -R .comment --strip-unneeded {} # Do the thing! echo "Generating AppImage..." -#export VERSION="$(./AppRun --version | awk '{print $(NF-1)}')" # This breaks for some reason? +export VERSION="$(./AppRun dunst --version | awk 'FNR==1 {print $NF}')" cd .. wget -q "$APPIMAGETOOL" -O appimagetool chmod +x ./appimagetool ./appimagetool --comp zstd \ --mksquashfs-opt -Xcompression-level --mksquashfs-opt 22 \ - -n ./AppDir ./dunst-"$ARCH".AppImage + -n ./AppDir ./dunst-"$VERSION"-"$ARCH".AppImage ls echo "All Done!" From c4c63056d8e29e837ecabf4814d3e685ac6530e4 Mon Sep 17 00:00:00 2001 From: Samuel <36420837+Samueru-sama@users.noreply.github.com> Date: Sun, 10 Nov 2024 13:27:21 -0400 Subject: [PATCH 7/7] use ubuntu-latest to spin alpine container Co-authored-by: Benedikt Heine --- .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 cd4200c17..642e82851 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -113,7 +113,7 @@ jobs: image: ghcr.io/dunst-project/docker-images:misc-doxygen appimage: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest container: alpine:latest steps: - uses: actions/checkout@v4