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.
This commit is contained in:
david
2026-10-02 19:59:21 +02:00
parent 8548d464e0
commit 4a0f1686b5
6 changed files with 85 additions and 11 deletions
+10 -1
View File
@@ -12,6 +12,7 @@ name: release
# mpv-natives-linux-x86_64-<ver>.so
# mpv-natives-windows-x86_64-<ver>.dll
# mpv-natives-macos-universal-<ver>.dylib
# LICENSE-NOTICE.txt
# checksums.txt
#
# jlibmpv's RemoteNativeLocator resolves the download URL deterministically
@@ -41,9 +42,16 @@ jobs:
with:
path: artifacts
- name: Check out mpv-natives (for LICENSE-NOTICE.txt)
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Assemble bare release assets
run: |
VER="${{ needs.build-linux.outputs.version }}"
# Reusable workflows expose their called job's outputs nested under
# the job name used in the called file (here: "linux").
VER="${{ needs.build-linux.linux.outputs.version }}"
[ -n "$VER" ] || { echo "ERROR: mpv version not set"; exit 1; }
mkdir -p release
# linux: single self-contained libmpv.so
@@ -55,6 +63,7 @@ jobs:
# macos: single universal libmpv.dylib
cp "artifacts/mpv-natives-macos-universal/libmpv.dylib" \
"release/mpv-natives-macos-universal-${VER}.dylib"
cp LICENSE-NOTICE.txt release/
(cd release && sha256sum * > checksums.txt)
echo "=== release assets ==="
ls -l release
+39
View File
@@ -0,0 +1,39 @@
License notice for the mpv-natives release assets
=================================================
Each platform asset (mpv-natives-<platform>-<version>.<ext>) is a single,
self-contained libmpv build:
libmpv is built from mpv on its LGPL-2.1-or-later license path
(-Dgpl=false) and from FFmpeg without --enable-gpl. All statically
linked dependencies (ffmpeg, libass, libplacebo, harfbuzz, freetype,
fribidi, dav1d, lcms2, ...) are either LGPL-2.1, BSD-licensed, or in
the public domain. The result is a library you may distribute under
LGPL-2.1-or-later.
Using it: an application may load this library in-process (e.g. via
JNA, as jlibmpv does) or link against it. The LGPL does not make your
application's own code open source. It does require that you allow
the end user to replace the library with a differently licensed build
(re-linking for static builds; a configurable load path such as
jlibmpv's mpv.libmpv.path satisfies this for dynamic loading) and
that you preserve the library's copyright and license information.
Source availability
-------------------
The library is built exclusively from source code that is publicly
available:
mpv v0.41.0 https://github.com/mpv-player/mpv (LGPL-2.1+/GPL-2+)
FFmpeg n8.0.1 https://github.com/FFmpeg/FFmpeg (LGPL-2.1+/GPL-2+)
The exact pins for every dependency are listed in ci/versions.env of
the mpv-natives repository, and the build is fully reproducible via
the scripts in ci/build-libmpv-*.sh.
Relevant license texts:
LGPL-2.1 https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
GPL-2.0 https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
BSD-2 (per dependency, in its source tree)
The build scripts and CI workflows in the mpv-natives repository are
MIT-licensed (see LICENSE in that repository).
+20 -7
View File
@@ -5,10 +5,14 @@ Self-built [libmpv](https://mpv.io/manual/#libmpv) native binaries for
## Why this repository exists
`jlibmpv` is 100% MIT and deliberately does not bundle any native binaries
(libmpv is GPL-licensed). End users who want a drop-in native they can point
`mpv.libmpv.path` at (or that a `RemoteNativeLocator` can download) find them
here, as versioned GitHub release assets.
`jlibmpv` is 100% MIT and deliberately does not bundle any native binaries.
The build here targets mpv's LGPL-2.1-or-later license path (`-Dgpl=false`,
ffmpeg without `--enable-gpl`), so the resulting `libmpv` can be embedded into
arbitrary — including closed-source — applications that load it in-process via
JNA, without the GPL's copyleft obligations reaching into their code. End
users who want a drop-in native they can point `mpv.libmpv.path` at (or that a
`RemoteNativeLocator` can download) find them here, as versioned GitHub
release assets.
- **Pinned version:** mpv `v0.41.0` — the exact client API (131077) the
jlibmpv JNA bindings are validated against. A libmpv update means bumping
@@ -73,6 +77,15 @@ Builds run on GitHub Actions. There is nothing to build locally.
## License
The artifacts are built from mpv (GPL-3.0-or-later) and its dependencies
(LGPL/GPL) and are distributed under those licenses. See [LICENSE](LICENSE)
for the repository's license terms.
The release artifacts are built from mpv on its **LGPL-2.1-or-later** path
(`-Dgpl=false`) and from FFmpeg without `--enable-gpl`, so the resulting
`libmpv` is LGPL-2.1-or-later (the ffmpeg libraries inside are likewise
LGPL, with BSD-licensed components such as dav1d). Distributing an
application that loads one of these libraries is fine under any license;
the LGPL only requires that the user be able to replace the library with a
different build (which is exactly what `mpv.libmpv.path` allows) and that
you keep the library's license and source-available terms for the library
itself. If you use a GPL distribution instead, the GPL's obligations apply.
The build scripts and workflows in this repository are MIT-licensed. See
[LICENSE](LICENSE) for the repository's license terms.
+6 -1
View File
@@ -172,11 +172,15 @@ _lcms2_mark=lib/liblcms2.a
_ffmpeg () {
gitpin https://github.com/FFmpeg/FFmpeg.git ffmpeg "$FFMPEG_VER"
builddir ffmpeg
# No --enable-gpl: every feature we enable (mjpeg/png encoders, spdif
# muxer, libdav1d, all decoders) is available under LGPL, and a GPL
# build would taint every application embedding this library. jlibmpv
# loads libmpv in-process via JNA, so the library must stay LGPL.
# --enable-pic: the static archives are linked into the shared
# libmpv.so (ffmpeg's configure does not force PIC for static builds).
args=(
--prefix="$prefix_dir" --pkg-config=pkg-config --target-os=linux
--enable-gpl --enable-pic $commonflags
--enable-pic $commonflags
--disable-{doc,programs}
--enable-muxer=spdif --enable-encoder=mjpeg,png --enable-libdav1d
)
@@ -287,6 +291,7 @@ meson setup $build \
--buildtype release -Dstrip=true \
-Ddefault_library=shared \
-Dlibmpv=true \
-Dgpl=false \
-Dcplayer=false \
-Dtests=false \
-Dlua=disabled \
+5 -1
View File
@@ -158,12 +158,15 @@ _lcms2_mark=lib/liblcms2.a
_ffmpeg () {
gitpin https://github.com/FFmpeg/FFmpeg.git ffmpeg "$FFMPEG_VER"
builddir ffmpeg
# No --enable-gpl: we only need LGPL-available features (see the linux
# script for the rationale) so the resulting libmpv stays LGPL and can be
# embedded via JNA without taint.
# --arch is explicit: ffmpeg would otherwise auto-detect aarch64 from
# uname -m on the runner even for the cross-compiled x86_64 slice.
args=(
--prefix="$prefix_dir" --pkg-config=pkg-config --target-os=darwin
--arch="$ARCH"
--enable-gpl $commonflags
$commonflags
--cc="$CC" --cxx="$CXX"
--disable-{doc,programs}
--enable-muxer=spdif --enable-encoder=mjpeg,png --enable-libdav1d
@@ -263,6 +266,7 @@ meson setup $build $MESON_EXTRA \
--buildtype release -Dstrip=true \
-Ddefault_library=shared \
-Dlibmpv=true \
-Dgpl=false \
-Dcplayer=false \
-Dtests=false \
-Dlua=disabled \
+5 -1
View File
@@ -181,8 +181,11 @@ _lcms2_mark=lib/liblcms2.a
_ffmpeg () {
gitpin https://github.com/FFmpeg/FFmpeg.git ffmpeg "$FFMPEG_VER"
builddir ffmpeg
# No --enable-gpl: we only need LGPL-available features (see the linux
# script for the rationale) so the resulting libmpv stays LGPL and can be
# embedded via JNA without taint.
local args=(
--pkg-config=pkg-config --target-os=mingw32 --enable-gpl
--pkg-config=pkg-config --target-os=mingw32
--enable-cross-compile --cross-prefix=$TARGET- --arch=${TARGET%%-*}
--cc="$CC" --cxx="$CXX" $commonflags
--disable-{doc,programs}
@@ -273,6 +276,7 @@ meson setup $build --cross-file "$prefix_dir/crossfile" \
--buildtype release \
-Ddefault_library=shared \
-Dlibmpv=true \
-Dgpl=false \
-Dcplayer=false \
-Dtests=false \
-Dlua=disabled \