55 lines
2.3 KiB
Bash
55 lines
2.3 KiB
Bash
# faugus-launcher-bin - prebuilt package of https://github.com/Faugus/faugus-launcher
|
|
# (GTK4 game launcher for running Windows games through UMU-Launcher, Python).
|
|
#
|
|
# Upstream ships AppImage/deb/rpm but no Arch-friendly binary, so
|
|
# build_artifact() builds the meson project from the release tarball.
|
|
|
|
UPSTREAM_REPO="Faugus/faugus-launcher"
|
|
|
|
# Installed in CI (pacman) before build_artifact runs.
|
|
# (Translations ship as prebuilt .mo files, so no gettext needed.)
|
|
BUILD_DEPS=(meson ninja python)
|
|
|
|
latest_version() {
|
|
gh api "repos/$UPSTREAM_REPO/releases/latest" --jq '.tag_name' | sed 's/^v//'
|
|
}
|
|
|
|
# build_artifact <version> <output-file>
|
|
build_artifact() {
|
|
local ver="$1" outfile="$2"
|
|
local workdir destdir srctree sitedir
|
|
workdir="$(mktemp -d)"
|
|
destdir="$(mktemp -d)"
|
|
|
|
curl -sfL "https://github.com/$UPSTREAM_REPO/archive/refs/tags/$ver.tar.gz" | tar -xz -C "$workdir"
|
|
srctree="$workdir/faugus-launcher-$ver"
|
|
|
|
meson setup "$workdir/build" "$srctree" --prefix=/usr --buildtype=release
|
|
meson install -C "$workdir/build" --destdir "$destdir"
|
|
|
|
# meson installs the python modules into site-packages, whose path changes
|
|
# with every Python minor bump and would silently break a prebuilt package.
|
|
# Relocate to a fixed dir and put it on the launcher's PYTHONPATH (the
|
|
# launcher script already appends any pre-set PYTHONPATH to its own).
|
|
sitedir="$(find "$destdir/usr/lib" -maxdepth 2 -type d -name site-packages)"
|
|
[[ -d "$sitedir/faugus" ]] || { echo "faugus module not found in $sitedir" >&2; return 1; }
|
|
mkdir -p "$destdir/usr/lib/faugus-launcher"
|
|
mv "$sitedir/faugus" "$destdir/usr/lib/faugus-launcher/"
|
|
rm -rf "$destdir/usr/lib/python"*
|
|
|
|
head -1 "$destdir/usr/bin/faugus-launcher" | grep -qx '#!/bin/sh' \
|
|
|| { echo "unexpected launcher script format" >&2; return 1; }
|
|
sed -i '1a export PYTHONPATH="/usr/lib/faugus-launcher${PYTHONPATH:+:$PYTHONPATH}"' \
|
|
"$destdir/usr/bin/faugus-launcher"
|
|
|
|
# These caches are generated by pacman hooks; shipping them would cause
|
|
# file conflicts on install.
|
|
rm -f "$destdir/usr/share/applications/mimeinfo.cache" \
|
|
"$destdir/usr/share/icons/hicolor/icon-theme.cache"
|
|
|
|
tar --zstd --sort=name --owner=0 --group=0 --numeric-owner --mtime='@0' \
|
|
-cf "$outfile" -C "$destdir" usr
|
|
|
|
rm -rf "$workdir" "$destdir"
|
|
}
|