mirror of
https://github.com/kirbylink/mpv-natives
synced 2026-11-30 00:32:27 +01:00
chore: initial mpv-natives repo with Windows libmpv build workflow
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
name: build-windows
|
||||
|
||||
# Builds libmpv for Windows (x86_64) from mpv source pinned to a release tag.
|
||||
# Recipe is adapted from mpv's own CI (mpv-player/mpv .github/workflows/build.yml,
|
||||
# job "mingw"): same dependency setup, same ci/build-mingw64.sh invocation. The
|
||||
# only additions are collecting libmpv-2.dll plus the DLL closure and shipping
|
||||
# them as an artifact with SHA-256 checksums.
|
||||
#
|
||||
# Pinned to mpv v0.41.0 — the version whose client API (131077) the jlibmpv
|
||||
# JNA bindings are validated against. Bump the ref here for a libmpv update.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
MPV_REF: v0.41.0
|
||||
TARGET: x86_64-w64-mingw32
|
||||
RUST_TARGET: x86_64-pc-windows-gnu
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
env:
|
||||
CCACHE_BASEDIR: ${{ github.workspace }}
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
||||
CCACHE_MAXSIZE: 500M
|
||||
steps:
|
||||
- name: Check out mpv (pinned tag)
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: mpv-player/mpv
|
||||
ref: ${{ env.MPV_REF }}
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Get time
|
||||
id: get_time
|
||||
run: echo "timestamp=$(date +%s%N)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Restore ccache
|
||||
uses: actions/cache/restore@v6
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: ${{ env.TARGET }}-${{ steps.get_time.outputs.timestamp }}
|
||||
restore-keys: ${{ env.TARGET }}-
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
rustup target add ${{ env.RUST_TARGET }}
|
||||
sudo apt-get update
|
||||
sudo apt-get install --no-install-recommends -y \
|
||||
ccache g++-mingw-w64 gcc-multilib python3-pip nasm ninja-build pkgconf \
|
||||
wine64 wine
|
||||
python3 -m pip install meson
|
||||
|
||||
- name: Install Meson Wraps
|
||||
run: |
|
||||
mkdir subprojects -p
|
||||
meson wrap install mujs
|
||||
meson subprojects download
|
||||
|
||||
- name: Build mpv dependencies
|
||||
run: |
|
||||
./ci/build-mingw64.sh
|
||||
|
||||
- name: Build mpv and pack artifact
|
||||
id: build
|
||||
run: |
|
||||
./ci/build-mingw64.sh meson pack
|
||||
|
||||
- name: Print meson log on failure
|
||||
if: failure()
|
||||
run: cat ./mingw_build/meson-logs/meson-log.txt
|
||||
|
||||
- name: Collect libmpv and DLL closure
|
||||
run: |
|
||||
mkdir -p artifact-libmpv
|
||||
cp -pv artifact/*.dll artifact-libmpv/
|
||||
LIBMPV=$(find mingw_build -maxdepth 1 -name "libmpv-*.dll" | head -n 1)
|
||||
[ -n "$LIBMPV" ] || { echo "libmpv DLL not found in mingw_build"; ls -l mingw_build | head -50; exit 1; }
|
||||
cp -pv "$LIBMPV" artifact-libmpv/
|
||||
echo "=== contents ==="
|
||||
ls -l artifact-libmpv
|
||||
|
||||
- name: Checksums
|
||||
run: |
|
||||
cd artifact-libmpv
|
||||
sha256sum *.dll > checksums.txt
|
||||
cat checksums.txt
|
||||
|
||||
- name: Artifact name
|
||||
id: artifact
|
||||
run: |
|
||||
VERSION_FILE=$(find . -path "*/common/version.h" -type f | head -n 1)
|
||||
VER=$(grep VERSION "$VERSION_FILE" | cut -d'"' -f2)
|
||||
echo "name=mpv-natives-windows-x86_64-mpv-$VER" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Zip artifact
|
||||
run: |
|
||||
cd artifact-libmpv
|
||||
zip -9r "../${{ steps.artifact.outputs.name }}.zip" .
|
||||
ls -l ..
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: ${{ steps.artifact.outputs.name }}
|
||||
path: ${{ steps.artifact.outputs.name }}.zip
|
||||
|
||||
- name: Save ccache
|
||||
uses: actions/cache/save@v6
|
||||
if: always()
|
||||
with:
|
||||
path: ${{ env.CCACHE_DIR }}
|
||||
key: ${{ env.TARGET }}-${{ steps.get_time.outputs.timestamp }}
|
||||
@@ -0,0 +1,3 @@
|
||||
build/
|
||||
*.zip
|
||||
.ccache/
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 kirbylink
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,49 @@
|
||||
# mpv-natives
|
||||
|
||||
Self-built [libmpv](https://mpv.io/manual/#libmpv) native binaries for
|
||||
[jlibmpv](https://github.com/kirbylink/jlibmpv), the Java/JNA wrapper library.
|
||||
|
||||
## 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.
|
||||
|
||||
- **Pinned version:** mpv `v0.41.0` — the exact client API (131077) the
|
||||
jlibmpv JNA bindings are validated against. A libmpv update means bumping
|
||||
`MPV_REF` in the workflows.
|
||||
- **Build source:** the mpv source tree is checked out at that tag by
|
||||
GitHub Actions and built with mpv's own CI scripts
|
||||
(`ci/build-mingw64.sh`, ...). No mpv source or third-party binaries are
|
||||
stored in this repository.
|
||||
|
||||
## Releases
|
||||
|
||||
Each platform build produces a zip with the native library, its runtime
|
||||
dependency closure, and a `checksums.txt` (SHA-256) for verification.
|
||||
|
||||
| Asset | Contents |
|
||||
|---|---|
|
||||
| `mpv-natives-windows-x86_64-mpv-<ver>.zip` | `libmpv-2.dll` + ffmpeg/decoder DLL closure (mingw64 build) |
|
||||
| `mpv-natives-macos-<arch>-mpv-<ver>.zip` | `libmpv.dylib` (in preparation) |
|
||||
|
||||
Linux users can normally use the distribution package (`apt install libmpv1`)
|
||||
instead; a self-built Linux artifact is planned only if needed.
|
||||
|
||||
## How to use with jlibmpv
|
||||
|
||||
1. Download the release asset for your platform and extract it.
|
||||
2. Point jlibmpv at the extracted `libmpv-2.dll` / `libmpv.dylib`:
|
||||
`-Dmpv.libmpv.path=/path/to/extracted/libmpv-2.dll`.
|
||||
|
||||
## Building
|
||||
|
||||
Builds run on GitHub Actions and are triggered by pushes to `main` or
|
||||
manually (Actions tab). 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.
|
||||
Reference in New Issue
Block a user