fix: make linux libmpv.so portable (ALSA config dir, fonts, strip)

Two runtime bugs in the shipped artifact:

1. ALSA: the static libasound carried ALSA_CONFIG_DIR pointing at the
   build prefix (linux_prefix/share/alsa), so snd_pcm_open("default")
   failed on any machine without that path ("Unknown PCM default",
   video worked, audio did not). Build alsa-lib with
   --with-configdir=/usr/share/alsa so the compile-time default is the
   canonical system location.

2. Size: the release .so still contained ~110 MB of DWARF debug sections
   (whole ffmpeg tree); strip --strip-all the artifact in the collect
   step, matching the windows build.

Also pin fontconfig's sysconfdir/localstatedir to /etc and /var so the
CONFIGDIR/FONTCONFIG_PATH/FC_CACHEDIR constants compiled into libass's
font stack resolve on any standard install (the runtime config search
falls back to the compiled-in CONFIGDIR and a built-in default config
when no FONTCONFIG_FILE/FONTCONFIG_PATH is set).

The workflow now verifies the artifact: ldd shows only system libs, no
debug sections remain, and no build-machine paths leaked into the
binary.
This commit is contained in:
david
2026-10-02 03:24:18 +02:00
parent ccf3f3913c
commit 0275986720
2 changed files with 40 additions and 1 deletions
+21
View File
@@ -82,6 +82,27 @@ 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)
run: |
cd artifact-libmpv
echo "=== dynamic deps (system libs only) ==="
ldd libmpv.so
echo "=== debug sections (expect none) ==="
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"
exit 1
fi
echo "OK: no build paths"
- name: Checksums
run: |
cd artifact-libmpv