29 Commits
Author SHA1 Message Date
david ea42f65e46 build: stop depending on the flaky GNU tarball front hosts
download.savannah.gnu.org and ftpmirror.gnu.org (which share one front
host) intermittently time out from the GitHub runners, which has already
broken the freetype and libiconv steps. Route the affected dependencies
around that host:

- freetype is now fetched via git (gitlab.freedesktop.org, pinned tag
  VER-2-14-1) like the other git dependencies, instead of a savanna
  tarball that no longer has a working host.
- libiconv now tries several independent GNU mirrors, the first one that
  serves it winning.
- gettar() generalizes to accept a list of fallback URLs so any future
  tarball dependency can name its mirrors too.
2026-10-06 09:13:07 +02:00
kirbylink b6fbd997d6 Merge pull request #3 from kirbylink/refactor/lgpl
refactor: build libmpv on the LGPL license path
2026-10-06 07:09:00 +02:00
davidandClaude dcdb633095 build: pin macOS deployment target and Swift cross-compile target
The x86_64 slice cross-compiled Swift for the host architecture (arm64)
because swiftc did not inherit clang's --target; the generated
Application/AppHub objects therefore never landed in the x86_64 slice and
the universal dylib failed to dlopen on Intel machines. mpv's swiftc
invocation takes its own --target triple, which also carries the deployment
version, so a single -Dswift-flags pins both the architecture and the min
OS per slice.

The C/ObjC deployment target is set in CFLAGS/CXXFLAGS/LDFLAGS so meson
and ffmpeg (both read them from the environment) propagate it to every
statically linked dependency; the linker takes the max of the objects it
links, so omitting it anywhere would leave the dylib pinned to the runner
SDK minimum. mpv gates its macOS feature flags on the SDK version, not the
deployment target, so no features are lost.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-10-03 03:16:56 +02:00
david 4a0f1686b5 refactor: build libmpv on the LGPL license path
mpv is dual-licensed (LGPL-2.1+/GPL-2+). We build it with -Dgpl=false
and FFmpeg without --enable-gpl (every enabled feature - mjpeg/png
encoders, spdif muxer, libdav1d, all decoders - is LGPL-available), so
the resulting library is LGPL-2.1-or-later instead of GPL. That is the
license path applications embedding libmpv in-process (via JNA, as
jlibmpv does) need, since a GPL build's copyleft obligations would
reach into them.

Also ship a LICENSE-NOTICE.txt with each release and fix the release
workflow's reference to the reusable workflows' job outputs (needs.<id>.
<jobname>.outputs). Docs: README license section now states the LGPL
position explicitly.
2026-10-02 19:59:21 +02:00
david b8986116d6 build: harden dependency downloads against transient mirror failures
wget now retries 3 times with a 60s timeout and 5s backoff. The linux
build failed once because a savannah mirror redirect (freetype)
returned HTTP 500.

Route the macOS build through ccache (CC/CXX) like linux and windows;
the workflow installs it but the script never used it, so the two-arch
build always recompiled from scratch.
2026-10-02 19:19:48 +02:00
david bcb7263ec6 ci: add tag-driven release workflow and centralize pinned versions
- Introduce ci/versions.env as the single source of truth for the mpv tag
  and every dependency pin; the three build scripts and all workflows now
  source it instead of redeclaring versions inline.
- Add release.yml: on a v* tag it reuses the three per-platform build
  workflows (workflow_call) and publishes the bare libmpv.so / .dll / .dylib
  assets plus a combined checksums.txt as a GitHub Release.
- Rework build-*.yml: trigger on pull_request (PR check) and workflow_call
  instead of push to main, and expose the artifact name/version as job
  outputs so release.yml can assemble the release assets.
- Route the Linux build through ccache (CC/CXX) so the CI ccache is actually
  populated and reused, fixing the 'Path Validation Error' on cache save.
2026-10-02 19:11:15 +02:00
kirbylinkanddavid 8ad01bbab1 fix: enable PipeWire/Pulse AOs so audio works on PipeWire desktops (#1)
* fix: link libmpv against the system libasound instead of a static build

A statically linked libasound fails at runtime with 'Unknown PCM
cards.pcm.default': the default PCM is resolved dynamically per sound card
(load_for_all_cards hook enumerating cards and loading cards/<driver>.conf),
and that machinery did not work in the vendored archive, so audio produced no
output even though the config file itself was found (the earlier
--with-configdir prefix bug is fixed).

Link libasound.so.2 dynamically from the system (libasound2-dev), exactly like
CoreAudio on macOS and WASAPI on Windows: the OS audio stack stays external,
all video dependencies remain static and self-contained.

The build script no longer builds alsa-lib (the _alsa step, ALSA_VER pin and
the autoreconf dependency it needed are gone); meson resolves the system
'alsa' dependency via pkg-config. The workflow installs libasound2-dev, drops
autoconf/automake/libtool, and verifies ldd shows libasound.so.2 instead of
asserting a baked-in config dir.

* fix: enable PipeWire/Pulse AOs so audio works on PipeWire desktops

On a desktop where PipeWire owns the sound cards, the direct ALSA/dmix
'default' path is broken: snd_pcm_open('default') resolves to a dmix slave
that cannot be opened (verified: aplay -D default fails identically, while
aplay -D pulse works). libmpv with only the ALSA AO therefore got no sound.

mpv auto-probes audio drivers in the order pipewire -> pulse -> alsa, so
enable all three (each linked against its system shared lib, consistent with
CoreAudio/WASAPI). On a PipeWire/Pulse box it now uses the working server
before ever falling back to the direct ALSA path.

The workflow installs libpipewire-0.3-dev and libpulse-dev alongside
libasound2-dev, and the artifact verification now accepts any of the three
system audio libs instead of only libasound.

---------

Co-authored-by: david <david@phoenix.ipv64.de>
2026-10-02 18:25:12 +02:00
david 61b5018811 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.
2026-10-02 05:01:15 +02:00
david 0275986720 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.
2026-10-02 03:24:18 +02:00
david ccf3f3913c fix: build expat position-independent too
expat is built with CMake, which does not force -fPIC for a static
library; like alsa-lib it is linked into the shared libmpv.so and
fails with the same relocation error. Enable CMAKE_POSITION_INDEPENDENT_CODE.
(The meson-built dependencies already default to -fPIC for static libs.)
2026-10-01 19:49:02 +02:00
david 1beeae9d0e fix: build ffmpeg and alsa-lib position-independent
The static archives are linked into the shared libmpv.so, but neither
ffmpeg (configure static build) nor alsa-lib (autotools static build)
force -fPIC in that case. Linking then fails with a TPOFF32 relocation
error from libasound. Pass --enable-pic to ffmpeg and -fPIC to alsa-lib.
2026-10-01 19:26:30 +02:00
david 56afac8c8f fix: install static deps to libdir=lib on the linux runner
Meson on a Debian/Ubuntu host defaults libdir to the multiarch path
lib/x86_64-linux-gnu/, so the static archives and .pc files never land in
the expected <prefix>/lib that the later builds look in. Force libdir=lib
for every vendored dependency build.
2026-10-01 18:58:50 +02:00
david 248a9a0ecf build: add Linux libmpv.so build and drop the stray headers
Add a native x86_64 Linux build (ci/build-libmpv-linux.sh,
build-linux.yml). Every dependency is static and linked into a single
libmpv.so; only glibc/pthread/dl/m and the system zlib remain external.
The Linux-only additions are the font stack (fontconfig -> expat, where
macOS/Windows use CoreText/DirectWrite) and alsa audio output; gl is the
plain render-API support (no X11/Wayland context, since jlibmpv supplies
the GL context via JOGL).

For consistency, ship a single native per platform and no public headers
(jlibmpv loads the library via JNA and never compiles against it). Remove
the accidental header/import-library copies from the Windows build and the
phantom header copy from the macOS build.
2026-10-01 18:10:21 +02:00
david 1e8e053f21 build: add objc to the x86_64 cross file
mpv enables Objective-C for the macOS audio/video output backends via
add_languages('objc'); the cross file needs the objc binary defined or
meson setup fails.
2026-10-01 06:55:32 +02:00
david 0f2c42a57a build: pass explicit --arch to ffmpeg for the x86_64 cross-slice
ffmpeg auto-detects the CPU architecture from uname -m, which is
aarch64 on the macOS runner, and then compiles Arm assembly for the
x86_64 slice. Pass --arch explicitly so the cross build uses the
correct SIMD code paths.
2026-10-01 06:39:31 +02:00
david c92a9ef033 build: look for libmpv.2.dylib (dot) in the macOS build
meson names the shared library libmpv.2.dylib on macOS, not
libmpv-2.dylib as on Windows. Fix the collect step in the build script
and the lipo inputs in the workflow.
2026-10-01 06:23:37 +02:00
david 384f1544df build: fix freetype meson options (no pcf/zstd/glib in 2.14.1) 2026-10-01 05:43:23 +02:00
david e5fa58bfde build: fix macOS dependency meson options for harfbuzz/libass/freetype
harfbuzz 12.2.0's option is utilities, not utils; enable coretext as the
system font provider. libass gets coretext (fontconfig would drag the
arm64-only brew package into the x86_64 slice) and asm disabled for
determinism. freetype disables all optional third-party providers except
the universal system zlib. libplacebo disables optional xxhash for the
same reason.
2026-10-01 05:33:05 +02:00
david 744018c986 build: use --target-os=darwin for ffmpeg on macOS 2026-10-01 04:37:41 +02:00
david 7ef5fab53d build: fix ffmpeg configure args and videotoolbox option for macOS
The local array declaration for ffmpeg configure args mis-parsed on the
macOS runner's bash 3.2; pass the args as a plain array. Use
videotoolbox-gl instead of videotoolbox-pl: the pl variant requires
vulkan in mpv v0.41.0's meson.build, while the gl variant only needs the
gl-cocoa feature which is enabled.
2026-10-01 03:42:05 +02:00
david 58ed2725fa build: rebuild macOS CI as single arm64 runner with x86_64 cross-compile
GitHub's macOS runners are all arm64 now, so the two parallel per-arch
jobs are obsolete: one macos-15 runner builds the arm64 slice natively
and the x86_64 slice via clang --target=x86_64-apple-darwin, then lipo
merges both into the universal libmpv.dylib. The build script is now
parameterized by ARCH, installs every meson dependency into its own
macos_prefix-<arch> (meson's macOS default prefix is /opt/homebrew),
uses release buildtype for the static deps, and disables harfbuzz icu
(the brew icu4c on the runner is arm64-only and must not leak into the
x86_64 slice).
2026-10-01 01:54:20 +02:00
david 4845b5e44f build: fix macOS CI (brew meson, cocoa/gl-cocoa, system zlib)
pip installs are blocked by PEP 668 on the macOS runners, so install meson
via brew. Enable cocoa and gl-cocoa: on macOS the OpenGL render API
backend of libmpv requires them (system frameworks only). Build no zlib
ourselves - macOS ships it in the system like iconv. Use PKG_CONFIG_PATH
additively instead of overriding PKG_CONFIG_LIBDIR so system pkg-config
files (icu-uc, ...) stay visible.
2026-10-01 01:01:22 +02:00
david 4b385cd92f build: add macOS universal libmpv.dylib CI build
Vendor ci/build-libmpv-macos.sh, which builds every dependency statically
for the native runner architecture and links them into a single
self-contained libmpv dylib (coreaudio output, videotoolbox hardware
decode, OpenGL render API; no vulkan/cocoa player). build-macos.yml runs
it on macos-14 (x86_64) and macos-15 (arm64) in parallel and a merge job
combines the two dylibs into one universal libmpv.dylib with lipo, matching
the file name jlibmpv expects on macOS.
2026-10-01 00:36:24 +02:00
david ca0a5de2a9 build: strip debug sections and remove double-zip from Windows artifact
The release build type emits DWARF .debug_* sections even for the MinGW
cross build, inflating libmpv-2.dll to ~169 MB. Strip them with
TARGET-strip --strip-all so only code/data remain. Also hand upload-artifact
the folder directly instead of a pre-zipped file, so the artifact is a
single-level archive rather than a zip containing a zip.
2026-09-30 17:40:12 +02:00
david 5d267ed82e build: link static C++ runtime into libmpv for libplacebo 2026-09-30 17:00:55 +02:00
david 8bc2416da0 build: fetch git dependency submodules (libplacebo glad) 2026-09-30 16:22:53 +02:00
david 9fca848d9b build: fix libplacebo mark-file name so it actually builds 2026-09-30 15:58:22 +02:00
david 0d95ab0f02 build: fix zlib download and lcms2 meson option in static build script 2026-09-30 15:32:36 +02:00
david 60663d7f4c build: build self-contained static libmpv for Windows
Vendored ci/build-libmpv-mingw64.sh builds every dependency statically and
links the single libmpv-2.dll against those archives with a static CRT, so
the artifact depends only on Windows system DLLs. Dependency versions are
pinned to the latest stable tag on the mpv v0.41.0 release date. Vulkan,
shaderc and SPIRV-Cross are dropped (jlibmpv renders through an external
OpenGL context). The workflow no longer needs a Rust toolchain.
2026-09-30 15:03:24 +02:00