50 lines
2.0 KiB
Bash
50 lines
2.0 KiB
Bash
# timetable-bin - prebuilt package of https://codeberg.org/ostfriese4/untis
|
|
# ("Timetable", a GTK4 + LibAdwaita WebUntis client written in Python).
|
|
#
|
|
# Upstream publishes no binary release assets, so build_artifact() builds the
|
|
# app from the release tarball and the resulting install tree is published as
|
|
# a GitHub release asset of this repository, which the PKGBUILD then uses.
|
|
|
|
UPSTREAM_REPO="ostfriese4/untis"
|
|
|
|
# Installed in CI (pacman) before build_artifact runs.
|
|
BUILD_DEPS=(meson ninja glib2 glib2-devel gtk4 libadwaita python python-gobject python-pip gettext)
|
|
|
|
latest_version() {
|
|
curl -sf "https://codeberg.org/api/v1/repos/$UPSTREAM_REPO/releases/latest" \
|
|
| jq -r '.tag_name' | sed 's/^v//'
|
|
}
|
|
|
|
# build_artifact <version> <output-file>
|
|
build_artifact() {
|
|
local ver="$1" outfile="$2"
|
|
local workdir destdir
|
|
workdir="$(mktemp -d)"
|
|
destdir="$(mktemp -d)"
|
|
|
|
curl -sfL "https://codeberg.org/$UPSTREAM_REPO/archive/v$ver.tar.gz" | tar -xz -C "$workdir"
|
|
|
|
# Upstream does not maintain the version in meson.build; use the release tag
|
|
# so the About dialog shows the right version.
|
|
sed -i "0,/version:/s/version: *'[^']*'/version: '$ver'/" "$workdir/untis/meson.build"
|
|
|
|
meson setup "$workdir/build" "$workdir/untis" --prefix=/usr --buildtype=release
|
|
meson install -C "$workdir/build" --destdir "$destdir"
|
|
|
|
# Bundle the pure-python webuntis library: it is packaged neither in the
|
|
# Arch repos nor on the AUR. /usr/share/untis is on the launcher's sys.path.
|
|
pip download --no-deps --only-binary :all: --dest "$workdir/wheels" webuntis
|
|
python -m zipfile -e "$workdir"/wheels/webuntis-*.whl "$destdir/usr/share/untis/"
|
|
|
|
# These caches are generated by pacman hooks; shipping them would cause
|
|
# file conflicts on install.
|
|
rm -f "$destdir/usr/share/glib-2.0/schemas/gschemas.compiled" \
|
|
"$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"
|
|
}
|