#!/usr/bin/env bash # Build the punktfunk-host RPM from the committed tree, for the Gitea RPM registry (Bazzite). # # Counterpart to ../debian/build-deb.sh. The library Requires (libavcodec.so.NN, …) are # auto-generated by rpmbuild from the binary it links — so build this in the Fedora 43 image # (ci/fedora-rpm.Dockerfile) to match Bazzite's sonames. libcuda is excluded in the spec. # # Usage: PF_VERSION=0.0.1 [PF_RELEASE=0.ci42.gdeadbee] bash packaging/rpm/build-rpm.sh # Output: dist/punktfunk--..rpm (+ the -debuginfo/-debugsource subpkgs) set -euo pipefail PF_VERSION="${PF_VERSION:-0.2.0}" PF_RELEASE="${PF_RELEASE:-1}" # PF_WITH_WEB=1 builds the punktfunk-web subpackage too (needs `bun` on PATH — present in the CI # builder image, not in a plain mock chroot). Default off so a bare `rpmbuild`/COPR still works. WEB_OPT=() [ "${PF_WITH_WEB:-0}" = "1" ] && WEB_OPT=(--with web) ROOTDIR="$(cd "$(dirname "$0")/../.." && pwd)" cd "$ROOTDIR" TOP="$(mktemp -d)" trap 'rm -rf "$TOP"' EXIT mkdir -p "$TOP"/{SOURCES,SPECS,BUILD,BUILDROOT,RPMS,SRPMS} # Source tarball with the prefix %autosetup expects (punktfunk-/). From HEAD so the # build is reproducible from a commit (CI checks one out); the spec is read from the working # tree directly, so spec edits apply without a re-commit. git archive --format=tar.gz --prefix="punktfunk-${PF_VERSION}/" \ -o "$TOP/SOURCES/punktfunk-${PF_VERSION}.tar.gz" HEAD # --nodeps: the spec's BuildRequires (cargo, rust, *-devel) are for COPR's mock chroot, which # resolves them from RPMs. Our builder image provides the toolchain via rustup (so # rust-toolchain.toml's pinned channel works) and the -devel libs via dnf, neither of which # rpmbuild's RPM-level check sees — skip it; a genuinely missing dep fails the compile/link. rpmbuild -bb --nodeps "${WEB_OPT[@]}" \ --define "_topdir $TOP" \ --define "pf_version ${PF_VERSION}" \ --define "pf_release ${PF_RELEASE}" \ packaging/rpm/punktfunk.spec mkdir -p dist find "$TOP/RPMS" -name '*.rpm' -exec cp -v {} dist/ \; echo "== Requires (must NOT contain libcuda) ==" rpm -qp --requires dist/punktfunk-${PF_VERSION}-*.rpm 2>/dev/null | grep -iE 'cuda|nvidia' \ && echo " !! NVIDIA/CUDA leak !!" || echo " clean"