Skip to content

Commit

Permalink
Merge pull request #93 from danirod/appimage
Browse files Browse the repository at this point in the history
AppImage support
  • Loading branch information
danirod authored Nov 22, 2024
2 parents e5fd2b6 + 85c6c7c commit e76f663
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,17 @@ jobs:
with:
name: es.danirod.Cartero-${{ runner.os }}-${{ runner.arch }}
path: build/Cartero-*.dmg
appimage:
name: "AppImage (GNU/Linux, glibc 2.38+)"
runs-on: ubuntu-24.04
steps:
- name: Install dependencies
run: sudo apt update && sudo apt install -y --no-install-recommends gettext meson libgtk-4-dev libadwaita-1-dev libgtksourceview-5-dev desktop-file-utils xvfb libfuse2 libgtk-4-bin librsvg2-common
- uses: actions/checkout@v4
- name: Build
run: build-aux/appimage-build.sh devel
- name: Upload
uses: actions/upload-artifact@v4
with:
name: es.danirod.Cartero.Devel-AppImage
path: build/appimagetool/Cartero-x86_64.AppImage
14 changes: 14 additions & 0 deletions .github/workflows/stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,17 @@ jobs:
with:
name: es.danirod.Cartero-${{ runner.os }}-${{ runner.arch }}
path: build/Cartero-*.dmg
appimage:
name: "AppImage (GNU/Linux, glibc 2.38+)"
runs-on: ubuntu-24.04
steps:
- name: Install dependencies
run: sudo apt update && sudo apt install -y --no-install-recommends gettext meson libgtk-4-dev libadwaita-1-dev libgtksourceview-5-dev desktop-file-utils xvfb libfuse2 libgtk-4-bin librsvg2-common
- uses: actions/checkout@v4
- name: Build
run: build-aux/appimage-build.sh stable
- name: Upload
uses: actions/upload-artifact@v4
with:
name: es.danirod.Cartero-AppImage
path: build/appimagetool/Cartero-x86_64.AppImage
68 changes: 68 additions & 0 deletions build-aux/appimage-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#!/bin/bash

set -e
cd "$(dirname "$0")/.."

case "$1" in
devel)
MESON_FLAGS="-Dprofile=development"
ICON_PATH="AppDir/usr/share/icons/hicolor/scalable/apps/es.danirod.Cartero.Devel.svg"
DESKTOP_PATH="AppDir/usr/share/applications/es.danirod.Cartero.Devel.desktop"
;;
stable)
MESON_FLAGS="-Dprofile=default"
ICON_PATH="AppDir/usr/share/icons/hicolor/scalable/apps/es.danirod.Cartero.svg"
DESKTOP_PATH="AppDir/usr/share/applications/es.danirod.Cartero.desktop"
;;
*)
echo "Usage: $0 [devel / stable]"
exit 1
;;
esac

meson setup build --prefix="/" $MESON_FLAGS
ninja -C build
DESTDIR=$PWD/build/appimagetool/AppDir/usr ninja -C build install

cd build/appimagetool

# Vendor extra files
if [ -d /usr/share/icons/Adwaita ]; then
mkdir -p AppDir/usr/share/icons
cp -rv /usr/share/icons/Adwaita AppDir/usr/share/icons
gtk4-update-icon-cache -q -t -f AppDir/usr/share/icons/Adwaita
else
echo "Warning: cannot vendor Adwaita icons"
fi
if [ -d /usr/share/themes/Adwaita ]; then
mkdir -p AppDir/usr/share/themes
cp -rv /usr/share/themes/Adwaita AppDir/usr/share/themes
else
echo "Warning: cannot vendor Adwaita themes"
fi
if [ -d /usr/share/gtksourceview-5 ]; then
cp -rv /usr/share/gtksourceview-5 AppDir/usr/share/
else
echo "Warning: cannot vendor GtkSourceView 5 data files"
fi
gtk4-update-icon-cache -q -t -f AppDir/usr/share/icons/hicolor

# Start packaging process
[ -x appimagetool-x86_64.AppImage ] || curl -OL https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
[ -x linuxdeploy-x86_64.AppImage ] || curl -OL https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
[ -x linuxdeploy-plugin-gtk.sh ] || curl -OL https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh
chmod +x appimagetool-x86_64.AppImage linuxdeploy-x86_64.AppImage linuxdeploy-plugin-gtk.sh

# First iteration
export DEPLOY_GTK_VERSION=4
./linuxdeploy-x86_64.AppImage --appdir AppDir --plugin gtk --output appimage \
--executable AppDir/usr/bin/cartero \
--icon-file "$ICON_PATH" \
--desktop-file "$DESKTOP_PATH"

# Patch the hook in order to support Adwaita theme.
sed -i '/GTK_THEME/d' AppDir/apprun-hooks/linuxdeploy-plugin-gtk.sh
sed -i '/GDK_BACKEND/d' AppDir/apprun-hooks/linuxdeploy-plugin-gtk.sh

# Recompile with the changes.
./appimagetool-x86_64.AppImage AppDir

0 comments on commit e76f663

Please sign in to comment.