build(packaging): add the Arch package, systemd unit and gamescope config

The PKGBUILD builds from the surrounding source tree (makepkg's -flto is
disabled because it breaks the libspa-sys C shim). The user unit and the
env example ship the intended deployment, and gamescope-tv.conf documents the
gamescope session it is meant to run against.
This commit is contained in:
2026-09-12 10:11:01 +03:00
parent e2b1c2983d
commit 9bb2d7d690
4 changed files with 125 additions and 0 deletions
+64
View File
@@ -0,0 +1,64 @@
# Arch Linux package built from this source tree (the directory above this PKGBUILD).
#
# cd contrib && makepkg -si
pkgname=gamescope-hyperhdr
pkgver=0.1.0
pkgrel=1
pkgdesc="Feeds gamescope's PipeWire picture, downscaled by gamescope, to HyperHDR's flatbuffers server"
arch=('x86_64' 'aarch64')
license=('MIT')
depends=('libpipewire' 'libgcc' 'glibc')
makedepends=('cargo' 'clang' 'pkgconf')
optdepends=('wireplumber: links the capture stream to the gamescope node')
# makepkg's -flto turns libspa-sys' C shim into LTO bytecode that the Rust link step cannot
# resolve (undefined spa_*_libspa_rs symbols).
options=('!lto')
_tree() {
realpath "$startdir/.."
}
pkgver() {
sed -n 's/^version = "\(.*\)"$/\1/p' "$(_tree)/Cargo.toml" | head -n1
}
prepare() {
rm -rf "$srcdir/$pkgname"
mkdir -p "$srcdir/$pkgname"
cp -a "$(_tree)"/{Cargo.toml,Cargo.lock,src,tests,examples,schema} "$srcdir/$pkgname/"
cd "$srcdir/$pkgname"
export RUSTUP_TOOLCHAIN=stable
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}
build() {
cd "$srcdir/$pkgname"
export RUSTUP_TOOLCHAIN=stable
# Outside the copied tree, so rebuilds stay incremental.
export CARGO_TARGET_DIR="$srcdir/target"
cargo build --frozen --release --bin gamescope-hyperhdr
}
check() {
cd "$srcdir/$pkgname"
export RUSTUP_TOOLCHAIN=stable
export CARGO_TARGET_DIR="$srcdir/target"
cargo test --frozen --release
}
package() {
local tree
tree="$(_tree)"
install -Dm755 "$srcdir/target/release/gamescope-hyperhdr" "$pkgdir/usr/bin/gamescope-hyperhdr"
install -Dm644 "$tree/contrib/systemd/gamescope-hyperhdr.service" \
"$pkgdir/usr/lib/systemd/user/gamescope-hyperhdr.service"
install -Dm644 "$tree/contrib/gamescope-hyperhdr.env.example" \
"$pkgdir/usr/share/doc/$pkgname/gamescope-hyperhdr.env.example"
install -Dm644 "$tree/contrib/systemd/gamescope-tv.conf" \
"$pkgdir/usr/share/doc/$pkgname/gamescope-tv.conf"
install -Dm644 "$tree/README.md" "$pkgdir/usr/share/doc/$pkgname/README.md"
install -Dm644 "$tree/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
install -Dm644 "$tree/schema/NOTICE" "$pkgdir/usr/share/licenses/$pkgname/NOTICE.HyperHDR"
}
+23
View File
@@ -0,0 +1,23 @@
# ~/.config/gamescope-hyperhdr/env — every flag can also be set here.
# HyperHDR host (required)
GSHDR_HOST=192.168.1.50
#GSHDR_PORT=19400
# Must be lower (= more important) than the USB grabber's priority (240)
#GSHDR_PRIORITY=150
#GSHDR_ORIGIN=gamescope
# Frame size sent to HyperHDR and CPU supersampling factor (gamescope renders SIZE x N)
#GSHDR_SIZE=320x180
#GSHDR_SUPERSAMPLE=1
#GSHDR_MAX_FPS=30
#GSHDR_KEEPALIVE_MS=1000
# Clear the priority after this many seconds without new frames (0 = off)
#GSHDR_IDLE_CLEAR_SECS=0
# node.name of the gamescope PipeWire node
#GSHDR_TARGET=gamescope
#RUST_LOG=info
@@ -0,0 +1,25 @@
# User unit for gamescope-hyperhdr. The Arch package installs it into /usr/lib/systemd/user;
# for a manual install copy it to ~/.config/systemd/user. It runs as the user of the PipeWire
# session and waits for the gamescope node, so it can simply stay enabled. To run it only
# together with gamescope-tv.service, add the gamescope-tv.conf drop-in.
[Unit]
Description=gamescope → HyperHDR ambilight feed
After=pipewire.service wireplumber.service
Wants=pipewire.service
[Service]
Type=simple
# System-wide settings, overridden by the per-user file.
EnvironmentFile=-/etc/gamescope-hyperhdr.env
EnvironmentFile=-%h/.config/gamescope-hyperhdr/env
# No absolute path: systemd searches /usr/local/bin and /usr/bin, which covers both the package
# and a manual install.
ExecStart=gamescope-hyperhdr
Restart=on-failure
RestartSec=2
# Exit code 2 is a configuration error (e.g. GSHDR_HOST not set); restarting will not help.
RestartPreventExitStatus=2
NoNewPrivileges=yes
[Install]
WantedBy=default.target
+13
View File
@@ -0,0 +1,13 @@
# Drop-in for gamescope-hyperhdr.service: run the feed only together with gamescope-tv.service,
# starting with it and stopping when it stops.
#
# install -Dm644 gamescope-tv.conf ~/.config/systemd/user/gamescope-hyperhdr.service.d/gamescope-tv.conf
# systemctl --user daemon-reload
# systemctl --user add-wants gamescope-tv.service gamescope-hyperhdr.service
#
# The Arch package ships this file as /usr/share/doc/gamescope-hyperhdr/gamescope-tv.conf.
# add-wants makes gamescope-tv.service pull the feed in. Do not also `enable` the feed:
# BindsTo= would then start gamescope-tv.service whenever the feed starts.
[Unit]
BindsTo=gamescope-tv.service
After=gamescope-tv.service