Files
PKGBUILDS/planify-bin/pkg.sh
T

58 lines
2.6 KiB
Bash

# planify-bin - prebuilt package of https://github.com/alainm23/planify
# (task manager with Todoist/Nextcloud support, Vala/GTK4 + LibAdwaita).
#
# Upstream publishes no binary assets, so build_artifact() builds from the
# release tarball. The chrono and gxml dependencies are resolved through the
# meson wrap subprojects upstream ships (gxml is not packaged in the official
# Arch repos, so the library ends up bundled inside this package).
UPSTREAM_REPO="alainm23/planify"
# Installed in CI (pacman) before build_artifact runs. gxml is deliberately
# absent: meson then falls back to the bundled gxml-0.20.wrap subproject.
BUILD_DEPS=(meson ninja vala git gobject-introspection gettext glib2-devel
gtk4 libadwaita libgee gtksourceview5 json-glib libical libportal
libportal-gtk4 libsecret libsoup3 libspelling sqlite
evolution-data-server icu)
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
workdir="$(mktemp -d)"
destdir="$(mktemp -d)"
curl -sfL "https://github.com/$UPSTREAM_REPO/archive/refs/tags/v$ver.tar.gz" | tar -xz -C "$workdir"
srctree="$workdir/planify-$ver"
# The preferences dialog suggests a flatpak-only quick-add command; point it
# at the plain binary instead (same fix as the AUR source package).
grep -q 'flatpak run --command=io.github.alainm23.planify.quick-add' \
"$srctree/src/Dialogs/Preferences/Pages/QuickAdd.vala" \
&& sed -i 's|flatpak run --command=io.github.alainm23.planify.quick-add|io.github.alainm23.planify.quick-add|' \
"$srctree/src/Dialogs/Preferences/Pages/QuickAdd.vala" \
|| echo "WARNING: quick-add flatpak command not found, sed skipped" >&2
meson setup "$workdir/build" "$srctree" --prefix=/usr --buildtype=release
meson install -C "$workdir/build" --destdir "$destdir"
# convenience names, as in the AUR source package
ln -s io.github.alainm23.planify "$destdir/usr/bin/planify"
ln -s io.github.alainm23.planify.quick-add "$destdir/usr/bin/planify.quick-add"
# 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"
}