Files
marfrit-packages/debian/daedalus-v4l2/build-deb.sh
T
test0r a0e0d123b2 fourier-debian: Path A — ffmpeg into /opt/fourier prefix
Stock Debian trixie ships FFmpeg 7.1 (libavcodec.so.61), our fork
ships FFmpeg 8.1 (libavcodec.so.62) — different SONAMEs, NOT a
drop-in for trixie's libavcodec61-consuming desktop.  Previous
Conflicts: libavcodec61, libavformat61, ... triggered apt to remove
~50 packages (kde-plasma-desktop, vlc, dolphin, ...) when a user
just wanted ffmpeg-v4l2-request-fourier installed alongside.

This commit:

1. ffmpeg-v4l2-request-fourier (pkgrel=2):
   - --prefix=/opt/fourier (instead of /usr)
   - --extra-ldexeflags / --extra-ldsoflags: -Wl,-rpath,/opt/fourier/lib
     so /opt/fourier/bin/ffmpeg finds its own libs without external help
   - Ship /etc/ld.so.conf.d/fourier.conf with /opt/fourier/lib + ldconfig
     in postinst/postrm.  dlopen-by-SONAME consumers (firefox, daedalus)
     find libavcodec.so.62 via ld.so cache without LD_LIBRARY_PATH.
   - Drop ALL Conflicts/Replaces/Provides for libav* / libpostproc /
     libsw* — no SONAME clash with stock libavcodec61, no reason to
     evict anything.
   - /usr/bin/ffmpeg-fourier + ffprobe-fourier convenience symlinks.

2. daedalus-v4l2 (pkgrel=2):
   - Depends: ffmpeg-v4l2-request-fourier (>= 2:8.1+rfourier)
     instead of stock 'ffmpeg (>= 7.1)'.  The daedalus binary was
     linked against libavcodec.so.62 at build time (CI runner had
     marfrit/ffmpeg-v4l2-request-fourier installed); at runtime it
     needs the .so.62 that only the fourier pkg provides.

Not touched:
  - libva-v4l2-request-fourier: ships only v4l2_request_drv_video.so
    at /usr/lib/<triplet>/dri/ which libva dlopens by file pattern.
    Path A would break the lookup unless every consumer launcher sets
    LIBVA_DRIVERS_PATH.  Driver name is unique; no conflict.  STAY.
  - mpv-fourier: Depends already correctly bound to fourier ffmpeg.
    Will receive libavcodec.so.62 via the ld.so.cache mechanism
    above without recipe changes.
2026-05-19 10:12:36 +02:00

107 lines
3.9 KiB
Bash
Executable File

#!/bin/bash
# Build daedalus-v4l2_<ver>_arm64.deb (userspace daemon + test tools).
#
# Mirrors arch/daedalus-v4l2 (Arch Linux build). The companion DKMS
# package (debian/daedalus-v4l2-dkms) carries the kernel module
# separately so apt/dpkg can split kernel-version-tied and userspace
# upgrade cadence.
#
# Sibling Arch package: ../../arch/daedalus-v4l2/PKGBUILD
# Sibling DKMS package: ../daedalus-v4l2-dkms/build-deb.sh
# Upstream repo: https://git.reauktion.de/reauktion/daedalus-v4l2
set -euo pipefail
# Same pin as the Arch PKGBUILD. f55b2cd = "Phase 8.13: byte-exact
# end-to-end via libva (consumer target hit)" — first commit where the
# full ffmpeg -hwaccel vaapi → libva → /dev/video0 → daemon path lands
# a pixel-correct decoded frame back in ffmpeg.
UPSTREAM_COMMIT=f55b2cdab8a8c0bc04e8c1bb1d0b6ca85e7d96d2
PKGVER=0.1.0+r16+gf55b2cd
PKGREL=2 # pkgrel=2 — Depends on ffmpeg-v4l2-request-fourier (Path A SONAME .so.62)
HERE=$(dirname "$(readlink -f "$0")")
# Reproducible build. 2026-05-18 23:00 UTC — Phase 8.13 close.
export SOURCE_DATE_EPOCH=1779231600
work=$(mktemp -d)
trap "rm -rf $work" EXIT
cd "$work"
curl -sSLfo daedalus-v4l2.tar.gz \
"https://git.reauktion.de/reauktion/daedalus-v4l2/archive/${UPSTREAM_COMMIT}.tar.gz"
tar xzf daedalus-v4l2.tar.gz
SRCDIR=daedalus-v4l2
# Build daemon (CMake)
cd "$SRCDIR/daemon"
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr
cmake --build build
# Build test tools (in-tree Makefile)
cd "$work/$SRCDIR/tools"
make
# Stage
ROOT="$work/pkgroot"
mkdir -p "$ROOT/DEBIAN" \
"$ROOT/usr/bin" \
"$ROOT/usr/libexec/daedalus-v4l2" \
"$ROOT/usr/include" \
"$ROOT/usr/share/doc/daedalus-v4l2"
install -m 755 "$work/$SRCDIR/daemon/build/daedalus_v4l2_daemon" \
"$ROOT/usr/bin/daedalus_v4l2_daemon"
install -m 755 "$work/$SRCDIR/tools/test_chardev_pingpong" \
"$ROOT/usr/libexec/daedalus-v4l2/test_chardev_pingpong"
install -m 755 "$work/$SRCDIR/tools/test_m2m_decode" \
"$ROOT/usr/libexec/daedalus-v4l2/test_m2m_decode"
install -m 755 "$work/$SRCDIR/tools/test_m2m_stream" \
"$ROOT/usr/libexec/daedalus-v4l2/test_m2m_stream"
install -m 644 "$work/$SRCDIR/include/daedalus_v4l2_proto.h" \
"$ROOT/usr/include/daedalus_v4l2_proto.h"
install -m 644 "$work/$SRCDIR/README.md" \
"$ROOT/usr/share/doc/daedalus-v4l2/README.md"
for d in "$work/$SRCDIR/docs/"*.md; do
install -m 644 "$d" "$ROOT/usr/share/doc/daedalus-v4l2/$(basename "$d")"
done
install -Dm644 "$HERE/debian/copyright" "$ROOT/usr/share/doc/daedalus-v4l2/copyright"
install -Dm644 "$HERE/debian/changelog" "$ROOT/usr/share/doc/daedalus-v4l2/changelog.Debian"
gzip -9 -n "$ROOT/usr/share/doc/daedalus-v4l2/changelog.Debian"
cat > "$ROOT/DEBIAN/control" <<EOF
Package: daedalus-v4l2
Version: ${PKGVER}-${PKGREL}
Section: video
Priority: optional
Architecture: arm64
Depends: ffmpeg-v4l2-request-fourier (>= 2:8.1+rfourier), libdrm2
Recommends: daedalus-v4l2-dkms
Maintainer: Markus Fritsche <mfritsche@reauktion.de>
Homepage: https://git.reauktion.de/reauktion/daedalus-v4l2
Description: Userspace daemon for the daedalus_v4l2 stateless decoder shim
daedalus-v4l2 ships the userspace daemon that backs the daedalus_v4l2
out-of-tree V4L2 kernel module on Raspberry Pi 5 / CM5. Together they
expose /dev/videoNN + /dev/mediaNN as a V4L2 stateless decoder for
VP9, AV1, and H.264 — actual decoding happens in this single-threaded
daemon via dlopen'd FFmpeg, with decoded NV12 / P010 frames shipped
back through dmabuf.
.
Consumed end-to-end by libva-v4l2-request-fourier (>= 1.0.0+r376) so
that 'ffmpeg -hwaccel vaapi' against vp9_small.ivf produces a
byte-exact NV12 frame.
.
The kernel module ships separately in daedalus-v4l2-dkms; install
both to actually serve V4L2 clients.
EOF
DEB_OUT="daedalus-v4l2_${PKGVER}-${PKGREL}_arm64.deb"
dpkg-deb --root-owner-group --build "$ROOT" "$HERE/$DEB_OUT"
echo "built: $HERE/$DEB_OUT"