Skip to content

Commit

Permalink
Create AppImage compilation script
Browse files Browse the repository at this point in the history
  • Loading branch information
danirod committed Nov 21, 2024
1 parent e5fd2b6 commit d523d4a
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/appimage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2024 the Cartero authors
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0-or-later

on:
pull_request:
branches:
- trunk
name: AppImage
jobs:
stable:
name: Build (default profile)
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
- uses: actions/checkout@v4
- name: Build
run: build-aux/appimage-build.sh stable
devel:
name: Build (development profile)
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
- uses: actions/checkout@v4
- name: Build
run: build-aux/appimage-build.sh stable
48 changes: 48 additions & 0 deletions build-aux/appimage-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/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
[ -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

DEPLOY_GTK_VERSION=4

export DEPLOY_GTK_VERSION

# First iteration
./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 d523d4a

Please sign in to comment.