From 61b501881132b3fae9d5c81bf3d0f2f39b9b6b0a Mon Sep 17 00:00:00 2001 From: david Date: Fri, 2 Oct 2026 05:01:15 +0200 Subject: [PATCH] fix: fontconfig build must not pin sysconfdir=/etc Pinning fontconfig's sysconfdir to /etc made the build try to install its own conf files into the real /etc/fonts/conf.d, which fails without root on the runner (PermissionError). Revert to the default prefix: the prefix-baked config paths are harmless because fontconfig falls back to a built-in config that scans /usr/share/fonts and /usr/local/share/fonts when no config file exists at the compiled-in path - so libass's font lookup works on any standard box without env vars. Also tighten the artifact verification: instead of a broad build-path grep (which would false-positive on fontconfig's benign prefix strings), assert the ALSA config dir is the system path and not the build prefix - the specific regression that broke audio. --- .github/workflows/build-linux.yml | 33 ++++++++++++++++++++----------- ci/build-libmpv-linux.sh | 18 +++++++++-------- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index dd09797..9e66089 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -82,26 +82,37 @@ jobs: echo "=== contents ===" ls -l artifact-libmpv - # Verify the artifact is self-contained and portable: (1) it only links - # against system libs (no vendored .so), (2) it carries no debug sections - # (strip worked, artifact stays small), and (3) no build-machine paths - # leaked into the binary (the runtime config lookup must not depend on the - # runner's prefix - that is what broke ALSA before). - - name: Verify artifact (ldd, size, no build paths) + # Verify the artifact is self-contained and portable: + # (1) ldd shows only system libs (no vendored .so to ship), + # (2) no .debug sections remain (strip worked, artifact stays small), + # (3) the ALSA config dir is the system path, not the build prefix. + # (The prefix-baked ALSA_CONFIG_DIR is what broke audio before: + # snd_pcm_open("default") looked for /share/alsa/alsa.conf + # on the target box. fontconfig also bakes its prefix into the + # binary, but that is benign - with no config at that path it falls + # back to a built-in config that scans /usr/share/fonts, so we do + # NOT fail on fontconfig prefix strings.) + - name: Verify artifact (ldd, size, alsa config dir) run: | cd artifact-libmpv echo "=== dynamic deps (system libs only) ===" ldd libmpv.so - echo "=== debug sections (expect none) ===" + echo "=== debug sections (expect 0) ===" readelf -S libmpv.so | grep -c '\.debug' || true echo "=== size ===" du -h libmpv.so - echo "=== build-machine paths (expect no match) ===" - if strings -a libmpv.so | grep -q "linux_prefix\|/home/runner\|mpv-natives"; then - echo "ERROR: build paths found in libmpv.so" + echo "=== ALSA config dir baked into the lib (must be /usr/share/alsa) ===" + if strings -a libmpv.so | grep -q "linux_prefix/share/alsa\|/share/alsa"; then + strings -a libmpv.so | grep -o "[^ ]*share/alsa" | sort -u + else + echo "ERROR: no ALSA config dir found in libmpv.so (libasound not linked?)" exit 1 fi - echo "OK: no build paths" + if strings -a libmpv.so | grep -q "linux_prefix/share/alsa"; then + echo "ERROR: ALSA config dir points at the build prefix (audio will be broken)" + exit 1 + fi + echo "OK" - name: Checksums run: | diff --git a/ci/build-libmpv-linux.sh b/ci/build-libmpv-linux.sh index 57e6bfc..86fc6bd 100644 --- a/ci/build-libmpv-linux.sh +++ b/ci/build-libmpv-linux.sh @@ -155,15 +155,17 @@ _fontconfig () { # expat is the XML backend (our static build); no tests/tools/nls. freetype # resolves to our own static build via PKG_CONFIG_PATH (we link it into # libmpv, not fc's system one). - # sysconfdir/localstatedir are pinned to the canonical system paths so the - # config paths compiled into libfontconfig (CONFIGDIR, FONTCONFIG_PATH, - # FC_CACHEDIR) point at /etc/fonts on any machine, not at our build prefix. - # fontconfig loads its config from (in order): $FONTCONFIG_FILE, - # $FONTCONFIG_PATH, the compiled-in CONFIGDIR, then its built-in default - # config. With sysconfdir=/etc the compiled-in paths match every standard - # Linux install, so libass's font lookup works without any env vars. + # + # Leave the default prefix (do NOT pin sysconfdir=/etc): the config paths + # compiled into libfontconfig (FONTCONFIG_PATH/CONFIGDIR/FC_CACHEDIR) point + # at the build prefix, which does not exist on the target machine. That is + # harmless - when fontconfig finds no config file at the compiled-in path it + # falls back to its built-in default config, which scans /usr/share/fonts + # and /usr/local/share/fonts. So libass's font lookup works on any standard + # Linux box without env vars, and `make install` stays inside the prefix + # (no root needed). Pinning sysconfdir=/etc would instead make the build + # try to install its conf files into the real /etc/fonts and fail. meson setup .. --buildtype release -Dprefix="$prefix_dir" -Dlibdir=lib \ - -Dsysconfdir=/etc -Dlocalstatedir=/var \ -Dxml-backend=expat -Dtests=disabled -Dtools=disabled -Dnls=disabled \ -Ddefault_library=static makeplusinstall