AppImage packaging (#439)

* AppImage packaging

* Add flags to specify location of required local files

`--build=path` specifies where on the system is the directory with pre-build game binaries (must have binaries `isle` and `isle-config` in `path/bin` and game-specific libraries in `path/lib`)
`--apprun=path` specifies where the apprun is
`--desktop-file=path` same for the desktop file

* Move to packaging/linux

* Move building to appimage/build and ignore it in git

* Use local icon. Option to specify location for it

* Cleaning

* Attempt at Github automation

* Update CMakeLists.txt

* Fix build

* I guess it doesn't need quotes

* Update CMakeLists.txt

* Update release.yml

* Work around for liblego1.so loading, fix arguments

* Create testing.yml

* Update testing.yml

* I should pay more attention to what docs say

* Fix copy-pasting mistake

* Add AppImage packaging to the Release workflow

* Try fixing filepicker

* Delete testing.yml

* Fix releases

Can't specify where linuxdeploy leaves the file without specifying the name of the file, which I don't want to do, so just move the file in `dist` after packaging.

* Remove unnecessary changes

* Add qt6-xdgdesktopportal-platformtheme as deps

Needed to call the xdg filepicker, basically desktop-specific filepicker. Hopefully this will allow to use it in AppImage

* Get back flatpak in release

* Update release.yml

* Remove libglew-dev from apt install

* Fix duplicate upload artifact

* Update release.yml

Co-authored-by: Christian Semmler <mail@csemmler.com>

* Remove *.AppImage pattern in Download All Artifacts

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Damglador 2025-06-29 22:53:54 +02:00 committed by GitHub
parent 6e7347621c
commit 54694a4611
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 155 additions and 2 deletions

View File

@ -46,7 +46,7 @@ jobs:
sudo apt-get install -y \
libx11-dev libxext-dev libxrandr-dev libxrender-dev libxfixes-dev libxi-dev libxinerama-dev \
libxcursor-dev libwayland-dev libxkbcommon-dev wayland-protocols libgl1-mesa-dev qt6-base-dev \
libasound2-dev
libasound2-dev qt6-xdgdesktopportal-platformtheme
- name: Install macOS dependencies (brew)
if: ${{ matrix.brew }}
@ -84,12 +84,36 @@ jobs:
cd build
cpack .
- name: Install linuxdeploy
if: ${{ matrix.linux }}
id: install-linuxdeploy
uses: miurahr/install-linuxdeploy-action@v1.8.0
with:
plugins: qt appimage
- name: Package (AppImage)
if: ${{ matrix.linux }}
run: |
cd build && \
export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH" && \
NO_STRIP=1 ${{ steps.install-linuxdeploy.outputs.linuxdeploy }} \
-p qt \
-e isle \
-e isle-config \
-d packaging/linux/org.legoisland.Isle.desktop \
-i icons/org.legoisland.Isle.svg \
--custom-apprun=../packaging/linux/appimage/AppRun \
--appdir packaging/linux/appimage/AppDir \
--output appimage && \
mv *.AppImage dist/
- name: Upload Artifact
uses: actions/upload-artifact@main
with:
name: Release-${{ matrix.name }}
path: |
build/dist/isle-*
build/dist/*.AppImage
flatpak:
name: "Flatpak (${{ matrix.arch }})"
@ -118,7 +142,7 @@ jobs:
bundle: org.legoisland.Isle.${{ matrix.arch }}.flatpak
manifest-path: packaging/linux/flatpak/org.legoisland.Isle.json
arch: ${{ matrix.arch }}
release:
name: 'Release'
runs-on: ubuntu-latest

View File

@ -5,6 +5,9 @@ set(APP_SPDX "LGPL-3.0-or-later")
string(TIMESTAMP BUILD_DATE UTC)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/icons)
file(COPY_FILE icons/isle.svg ${CMAKE_BINARY_DIR}/icons/${APP_ID}.svg)
# The following will need to be refined if we wish to post actual releases to a repo such as Flathub
if(DEFINED ENV{GITHUB_ACTIONS} AND ENV{GITHUB_ACTIONS} EQUAL TRUE)
# Use the sequential run# of the current pipeline when running in GH Actions

25
packaging/linux/appimage/AppRun Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
HERE="$(dirname "$(readlink -f "${0}")")"
MAIN=$(grep -r "^Exec=.*" "$HERE"/*.desktop | head -n 1 | cut -d "=" -f 2 | cut -d " " -f 1)
# MAIN_BIN=$(find "$HERE/usr/bin" -name "$MAIN" | head -n 1)
MAIN_BIN="$HERE/usr/bin/isle-config"
export PATH="${HERE}/usr/bin/":$PATH # Prefer bundled binaries
export QT_QPA_PLATFORMTHEME=xdgdesktopportal # Use XDG filepicker for forward compatability
[ -z "$QT_PLUGIN_PATH" ] && export QT_PLUGIN_PATH=/usr/lib/qt6/plugins:/usr/lib64/qt6/plugins # Use system Qt theme, will fallback to the default one if unavailable
if [ ! -z $APPIMAGE ]; then
BINARY_NAME=$(basename "$ARGV0")
if [ -e "$HERE/usr/bin/$BINARY_NAME" ]; then
exec "$HERE/usr/bin/$BINARY_NAME" "$@"
else
exec "${MAIN_BIN}" "$@"
fi
else
exec "${MAIN_BIN}" "$@"
fi

100
packaging/linux/appimage/Build Executable file
View File

@ -0,0 +1,100 @@
#!/usr/bin/env bash
set -e
export LD_LIBRARY_PATH="build/source/lib:$LD_LIBRARY_PATH"
[ -z "$QMAKE" ] && export QMAKE=/usr/lib/qt6/bin/qmake
# Sets a directory that has to have a following structure:
# build
# ├── bin
# │   ├── isle
# │   └── isle-config
# └── lib
# ├── liblego1.so
# ├── libSDL3.so -> libSDL3.so.0 # Not important if available on the system
# ├── libSDL3.so.0 -> libSDL3.so.0.3.0 # Not important if available on the system
# └── libSDL3.so.0.3.0 # Not important if available on the system
# Can also be defined using --build=path
BUILD_SOURCE=source
# Sets where AppRun for AppImage is, can also be defined using --apprun=path
APPRUN_SOURCE=AppRun
# Sets where desktop file for AppImage is, can also be defined using --desktop-file=path
DESKTOP_FILE_SOURCE=isledecomp.desktop
# You know the drill
ICON_SOURCE=../../icons/isle.svg
cd $(dirname $0)
clean(){
echo "Deleting build directory"
rm -rf build
}
download(){
if [ ! -e "$1" ]; then
curl -Lo "$1" "$2"
fi
}
prepare(){
mkdir -p build/tools
mkdir -p build/assets
download build/tools/appimagetool.AppImage https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-$(uname -m).AppImage
chmod u+x build/tools/appimagetool.AppImage
download build/tools/linuxdeploy.AppImage https://github.com/linuxdeploy/linuxdeploy/releases/latest/download/linuxdeploy-$(uname -m).AppImage
chmod u+x build/tools/linuxdeploy.AppImage
download build/tools/linuxdeploy-plugin-qt.AppImage https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/latest/download/linuxdeploy-plugin-qt-$(uname -m).AppImage
chmod u+x build/tools/linuxdeploy-plugin-qt.AppImage
if [ ! -f "build/assets/isledecomp.desktop" ]; then
cp $DESKTOP_FILE_SOURCE build/assets/isledecomp.desktop
cp $APPRUN_SOURCE build/assets/AppRun
cp ../../icons/isle.svg build/assets/isle.svg
fi
if [ ! -d "build/source" ]; then
cp -r $BUILD_SOURCE build/source
fi
}
compile(){
NO_STRIP=1 build/tools/linuxdeploy.AppImage \
--plugin qt \
-e build/source/bin/isle \
-e build/source/bin/isle-config \
-d build/assets/isledecomp.desktop \
-i build/assets/isle.svg \
--custom-apprun=AppRun \
--appdir=build/AppDir
}
package(){
build/tools/appimagetool.AppImage build/AppDir build/"LEGO_Island-$(uname -m).AppImage"
}
stop(){ # Can be used to do `Build clean stop` to just clean the directory
exit
}
for arg in "$@"; do
case "$arg" in
--build=*) BUILD_SOURCE="${arg#--build=}";;
--apprun=*) APPRUN_SOURCE="${arg#--apprun=}";;
--desktop-file=*) DESKTOP_FILE_SOURCE="${arg#--desktop-file=}";;
--icon=*) ICON_SOURCE="${arg#--icon=}";;
*) "$arg"
esac
done
prepare
compile
package
# Symlinks named as binaries in appimage can call these binaries specifically
# ln -s "LEGO_Island-$(uname -m).AppImage" isle-config
# ln -s "LEGO_Island-$(uname -m).AppImage" isle

View File

@ -18,6 +18,7 @@ Keywords[ja]=LEGO;lego;レゴアイランドの大冒険
Keywords[ko]=LEGO;lego;
Keywords[pt]=LEGO;lego;A Ilha LEGO
Keywords[ru]=LEGO;lego;Остров LEGO
Keywords[uk_UA]=LEGO;lego;LEGO острів
SingleMainWindow=true