isle-portable/packaging/linux/appimage/Build
Damglador 54694a4611
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>
2025-06-29 22:53:54 +02:00

100 lines
3.1 KiB
Bash
Executable File

#!/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