Files
punktfunk/packaging/gamescope/punktfunk-gamescope.spec
enricobuehler eb8c943572
ci / web (pull_request) Successful in 1m4s
ci / bun-nix (pull_request) Successful in 26s
apple / swift (pull_request) Successful in 1m40s
apple / screenshots (pull_request) Skipped
ci / rust (pull_request) Failing after 2m3s
ci / docs-site (pull_request) Successful in 1m41s
ci / rust-arm64 (pull_request) Successful in 2m44s
android / android (pull_request) Successful in 4m50s
nix / flake (pull_request) Failing after 16m12s
feat(packaging): ship punktfunk-gamescope on RPM and apt too
Until now the patched gamescope reached exactly four kinds of box: the
Bazzite/Fedora-Atomic sysext, the Arch package, the SteamOS installer and a NixOS
option. Everyone else was told to build gamescope from source. A traditional
Fedora-family box — Nobara, plain Fedora, the HTPCs people actually stream from —
therefore ran stock gamescope by default, which streams SDR, cursorless, and
tells every game its display is 60 Hz. That is not a user error; there was no
package to install.

Both new packages REPACK the binary CI already builds rather than building
gamescope again: it is a ~10-minute meson compile of an unrelated tree, cached
per distro base because the binary is soname-coupled to it. The Arch PKGBUILD
stays the one recipe that builds from source, because that is what makepkg is
for.

- packaging/gamescope/punktfunk-gamescope.spec + build-gamescope-rpm.sh. Version
  is derived from the binary's own banner (3.16.25.pfhdr4) — the only source that
  cannot drift from what is in the package. rpmbuild's automatic ELF Requires are
  what stop an f43 build installing on f44.
- packaging/debian/build-gamescope-deb.sh, same shape, with dpkg-shlibdeps for
  Depends.
- rpm.yml packages and publishes it beside the host RPMs; deb.yml gains a cached
  gamescope build (keyed on packaging/gamescope/** alone) and packages it into the
  existing publish loop. Both legs are best-effort, matching the sysext's existing
  rule: no binary, no package, and the host stays on its current SDR path.

Neither package Provides or Conflicts with gamescope — it installs as
/usr/bin/punktfunk-gamescope and only the sessions the host starts itself resolve
it, so a box's own Game Mode keeps using the distro binary.

Both refuse to package a binary without the +pfhdr marker. That marker is the
host's entire capability probe, so a build that lost the patches would install
fine and then silently stream SDR with no cursor.

Verified: build-gamescope-deb.sh produces an installable .deb from a stand-in
binary (correct version derived from the banner, 0755 tree, control fields) and
exits 1 on an unmarked one. The .spec is not yet exercised — no rpm tooling on
the box I had; CI's Fedora leg is its first run.
2026-08-08 15:36:19 +02:00

79 lines
3.8 KiB
RPMSpec

# punktfunk-gamescope — gamescope carrying punktfunk's capture patches, installed under its own
# name so it sits BESIDE the distro's gamescope (Game Mode keeps using that one).
#
# This spec REPACKS a binary that was already built, rather than building gamescope itself: the
# build is a ~10-minute meson compile of an unrelated tree that CI already does once per Fedora
# major and caches (.gitea/workflows/rpm.yml). Rebuilding it inside rpmbuild would double that for
# no gain, and would need network access in the build root to fetch the upstream tree.
#
# The counterpart for Arch is packaging/gamescope/PKGBUILD, which DOES build from source, because
# makepkg fetches sources by design and the AUR-style recipe is what an Arch user expects.
#
# Usage: bash packaging/gamescope/build-gamescope-rpm.sh --binary <path-to-punktfunk-gamescope>
Name: punktfunk-gamescope
Version: %{pf_version}
Release: %{pf_release}%{?dist}
Summary: gamescope with punktfunk's PipeWire capture patches (HDR, cursor, overlay, virtual-display modes)
# gamescope is BSD-2-Clause; our patches are contributed under the same terms.
License: BSD-2-Clause
URL: https://git.unom.io/unom/punktfunk
Source0: punktfunk-gamescope
# Not `Provides: gamescope` and not `Conflicts:` either — this ships a differently-named binary and
# is designed to coexist. A box's Game Mode session keeps running the distro's gamescope; only the
# sessions punktfunk-host starts itself resolve this one (PUNKTFUNK_GAMESCOPE_BIN >
# punktfunk-gamescope > gamescope).
#
# The runtime library Requires are auto-generated by rpmbuild from the binary's ELF NEEDED entries,
# which is exactly right here: this binary is soname-coupled to the Fedora major it was compiled
# on, and the generated Requires are what stop it installing on the wrong one.
Recommends: punktfunk-host
# Nothing is compiled here, so there is no debuginfo to extract; without this rpmbuild fails
# looking for sources it was never given.
%global debug_package %{nil}
%description
gamescope built from the upstream revision punktfunk pins, plus the patches in
packaging/gamescope/patches:
* 10-bit BT.2020/PQ capture formats on the PipeWire node, so an HDR game reaches a capture
consumer as HDR instead of pre-tonemapped SDR.
* --pipewire-composite-cursor: paint the pointer into the capture stream, so a consumer with no
cursor of its own gets one and the host stops blending one in, which frees the encoder's
fastest zero-copy source.
* A headless session advertises its real mode and refresh rates (and --custom-refresh-rates), so
Steam and games see the resolution and refresh the stream actually runs at instead of an
unnamed 60 Hz panel.
* --pipewire-composite-external-overlay: paint the mangoapp performance overlay into the capture
stream, so the fps/stats readout is visible to someone watching remotely.
Installed as /usr/bin/punktfunk-gamescope. Your system gamescope is untouched.
%prep
# Nothing to unpack: Source0 IS the binary.
%build
# Nothing to build — see the header.
%install
install -Dm0755 %{SOURCE0} %{buildroot}%{_bindir}/punktfunk-gamescope
%check
# The marker is the host's entire capability probe (`gamescope_patch_level()`): a binary that lost
# the patches would install fine and then silently stream SDR with no cursor. Refuse to package it.
#
# Executed in the build root, which is the same container the binary was compiled in — if that ever
# stops being true this check is the thing that notices.
%{buildroot}%{_bindir}/punktfunk-gamescope --version 2>&1 | grep -q '+pfhdr' || {
echo "punktfunk-gamescope: the +pfhdr marker is missing — the patches did not take" >&2
exit 1
}
%files
%{_bindir}/punktfunk-gamescope
%changelog
# Generated per build; see the git history for the patch set's own changes.