Files
dotfiles/system/rebuild-ffmpeg.sh
thomas 4a57e9902f Feature: Bootstrap script for new installs
bootstrap.sh installs everything listed in system/packages.txt (pacman,
AUR via yay, flatpak, official install scripts), auto-detects CPU
microcode and GPU drivers, enables services, links dotfiles with stow
and runs system/install.sh. Optional --svt-av1 installs
svt-av1-essential-git and rebuilds ffmpeg against it via
system/rebuild-ffmpeg.sh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 18:10:27 +01:00

28 lines
1023 B
Bash
Executable File

#!/usr/bin/env bash
# Rebuilds Arch's ffmpeg package from source so it links against the installed
# svt-av1-essential-git instead of the repo svt-av1 it was built with.
#
# Re-run this after a `pacman -Syu` that updates ffmpeg, otherwise the repo
# build replaces this one.
set -euo pipefail
if ! pacman -Qq svt-av1-essential-git >/dev/null 2>&1; then
echo "svt-av1-essential-git is not installed; nothing to rebuild against." >&2
exit 1
fi
build="$(mktemp -d)"
trap 'rm -rf "$build"' EXIT
git clone --depth 1 https://gitlab.archlinux.org/archlinux/packaging/packages/ffmpeg.git "$build/ffmpeg"
cd "$build/ffmpeg"
# The PKGBUILD verifies a signed ffmpeg tag; makepkg won't fetch the keys itself
mapfile -t keys < <(source ./PKGBUILD && printf '%s\n' "${validpgpkeys[@]}")
if (( ${#keys[@]} )); then
gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "${keys[@]}"
fi
# No --needed: the version matches what's installed, we want it replaced anyway
makepkg --syncdeps --install --cleanbuild --noconfirm