Files
lutris/Makefile
Daniel Johnson 053933a34c Add AppImage packaging proof-of-concept
Flathub's recent ban on AI-using projects (see #6724) puts Lutris's
Flatpak channel at risk, and Flatpak has always been an awkward fit
anyway: Lutris is fundamentally an unsandboxed game manager that needs
to call host xrandr, 7z, fuser, wine, flatpak, mount drives, and reach
the user's whole $HOME. AppImage gives us a single-file distribution
that does none of that sandboxing.

This adds `make appimage`, which builds a self-contained AppImage in
a Docker/Podman container based on Ubuntu 22.04 (glibc 2.35, Python
3.10, GTK3, WebKit2GTK 4.1). The pipeline:

  utils/appimage/build.sh          — host wrapper (docker or podman)
  utils/appimage/Dockerfile        — build env with all GI typelibs
  utils/appimage/build-in-container.sh
                                   — assembles AppDir via linuxdeploy
                                     + linuxdeploy-plugin-gtk, runs
                                     appimagetool
  utils/appimage/AppRun            — launcher; sources plugin-gtk hook,
                                     sets PYTHONPATH, execs bundled
                                     python3 with bin/lutris

Design notes worth flagging for review:

* The bundled Python is the build image's /usr/bin/python3.10 plus its
  stdlib, with tkinter/test/idle stripped.

* PyGObject and dbus-python are taken from apt (python3-gi, python3-dbus)
  rather than pip — both have switched to meson-python build backends
  that drag in a sizeable toolchain, and the prebuilt packages link
  against exactly the libgirepository/libdbus we already bundle from
  the same distro.

* AppRun deliberately does NOT export LD_LIBRARY_PATH. linuxdeploy
  already sets $ORIGIN-relative RPATH on every binary it deploys, and
  exporting LD_LIBRARY_PATH would leak into every host subprocess —
  which surfaced immediately when flatpak crashed loading our bundled
  libssl 3.0 instead of the host's 3.4. The build script patchelf's
  the RPATH on the manually-copied _gi.so / _dbus*.so so they still
  find the bundled libgirepository without the env override.

* PATH is left intact apart from prepending $APPDIR/usr/bin, so host
  tools (xrandr, 7z, wine, flatpak) still win — that's the whole
  point of choosing AppImage over Flatpak here.

Output is dist/Lutris-<version>-x86_64.AppImage at ~83 MB. Smoke-tested
end-to-end on Fedora 43 Nobara: boots GUI, GPU detection, DB load,
service auth, GTK theme, and host subprocess invocations all work.

Refs #6724.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-11 17:15:30 -04:00

148 lines
3.5 KiB
Makefile

VERSION=`grep "__version__" lutris/__init__.py | cut -d" " -f 3 | sed 's|"\(.*\)"|\1|'`
GITBRANCH ?= master
# Default GPG key ID to use for package signing.
PPA_GPG_KEY_ID ?= 82D96E430A1F1C0F0502747E37B90EDD4E3EFAE4
PYTHON:=$(shell which python3)
PIP:=$(PYTHON) -m pip
all:
export GITBRANCH=master
debuild
debclean
unsigned:
export GITBRANCH=master
debuild -i -us -uc -b
debclean
# Build process for GitHub runners.
# Requires two environment variables related to package signing.
# PPA_GPG_KEY_ID
# Key ID used to sign the .deb package files.
# PPA_GPG_PASSPHRASE
# Decrypts the private key associated with GPG_KEY_ID.
#
# When running from a GitHub workflow. The above environment variables
# are passed in from .github/scripts/build-ubuntu.sh and that script
# receives those variables from the .github/workflows/publish-lutris-ppa.yml
# which receives them from the repository secrets.
github-ppa:
export GITBRANCH=master
# Automating builds for different Ubuntu codenames manipulates the
# version string, and so that lintian check is suppressed. Also note
# that all parameters after "--lintian-opts" are passed to lintian
# so that _must_ be the last parameter.
echo "y" | debuild -S \
-k"${PPA_GPG_KEY_ID}" \
-p"gpg --batch --passphrase ${PPA_GPG_PASSPHRASE} --pinentry-mode loopback" \
--lintian-opts --suppress-tags malformed-debian-changelog-version
build-deps-ubuntu:
sudo apt install devscripts debhelper dh-python meson
build:
gbp buildpackage --git-debian-branch=${GITBRANCH}
clean:
debclean
build-source: clean
gbp buildpackage -S --git-debian-branch=${GITBRANCH}
mkdir build
mv ../lutris_${VERSION}* build
release: build-source upload upload-ppa
test:
rm tests/fixtures/pga.db -f
nose2
cover:
rm tests/fixtures/pga.db -f
rm tests/coverage/ -rf
nose2 --with-coverage --cover-package=lutris --cover-html --cover-html-dir=tests/coverage
pgp-renew:
osc signkey --extend home:strycore
osc rebuildpac home:strycore --all
changelog-add:
EDITOR=vim dch -i
changelog-edit:
EDITOR=vim dch -e
upload:
scp build/lutris_${VERSION}.tar.xz anaheim:~/volumes/releases/
upload-ppa:
dput ppa:lutris-team/lutris build/lutris_${VERSION}*_source.changes
upload-staging:
dput --force ppa:lutris-team/lutris-staging build/lutris_${VERSION}*_source.changes
snap:
snapcraft clean lutris -s pull
snapcraft
appimage:
utils/appimage/build.sh
req-python:
pip3 install PyYAML lxml requests Pillow setproctitle python-magic distro dbus-python types-requests \
types-PyYAML evdev PyGObject pypresence protobuf moddb
install-hooks:
ln -sf -t .git/hooks/ ../../.hooks/pre-commit
dev: install-hooks
pip3 install ruff==0.12.1 mypy==1.16.1 mypy-baseline nose2
pip3 install 'pygobject-stubs>=2.17.0' --no-cache-dir --config-settings=config=Gtk3,Gdk3,Soup2
# ============
# Style checks
# ============
style:
ruff format . --check
format:
ruff check --select I --fix
ruff format .
# ===============
# Static analysis
# ===============
check: ruff_lint mypy syntax-compat annotation-compat po-check
ruff_lint:
ruff check .
syntax-compat:
python3 -m compileall -q lutris/
annotation-compat:
python3 utils/check_annotations.py
po-check:
@for f in po/*.po; do msgfmt --check "$$f" -o /dev/null; done
mypy:
mypy . --python-version 3.10 --install-types --non-interactive 2>&1 | mypy-baseline filter
mypy-reset-baseline: # Add new typing errors to mypy. Use sparingly.
mypy . --python-version 3.10 --install-types --non-interactive 2>&1 | mypy-baseline sync
# =============
# Abbreviations
# =============
sc: style check
styles: style
checks: check