47 lines
1.7 KiB
Bash
47 lines
1.7 KiB
Bash
# librepods-bin - prebuilt package of https://github.com/librepods-org/librepods
|
|
# (AirPods integration for Linux, Qt6/C++ client in the linux/ subdirectory).
|
|
#
|
|
# Upstream releases carry only Android APKs, so build_artifact() builds the
|
|
# Linux client from the release tarball. Upstream tags look like v1.0.0-rc1;
|
|
# pkgver strips the hyphen (1.0.0rc1, sorts before 1.0.0 in vercmp) and
|
|
# build_artifact re-inserts it for the tag URL.
|
|
|
|
UPSTREAM_REPO="librepods-org/librepods"
|
|
|
|
# Installed in CI (pacman) before build_artifact runs.
|
|
BUILD_DEPS=(cmake qt6-base qt6-connectivity qt6-declarative qt6-tools
|
|
libpulse openssl)
|
|
|
|
latest_version() {
|
|
gh api "repos/$UPSTREAM_REPO/releases/latest" --jq '.tag_name' | sed 's/^v//; s/-//g'
|
|
}
|
|
|
|
# build_artifact <version> <output-file>
|
|
build_artifact() {
|
|
local ver="$1" outfile="$2"
|
|
local upver workdir destdir srctree
|
|
upver="$(sed -E 's/([a-z])/-\1/' <<< "$ver")"
|
|
workdir="$(mktemp -d)"
|
|
destdir="$(mktemp -d)"
|
|
|
|
curl -sfL "https://github.com/$UPSTREAM_REPO/archive/refs/tags/v$upver.tar.gz" | tar -xz -C "$workdir"
|
|
srctree="$workdir/librepods-$upver"
|
|
|
|
cmake -B "$workdir/build" -S "$srctree/linux" -Wno-dev \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
-DCMAKE_SKIP_RPATH=TRUE
|
|
cmake --build "$workdir/build" -j"$(nproc)"
|
|
DESTDIR="$destdir" cmake --install "$workdir/build"
|
|
|
|
# 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"
|
|
}
|