Files
mpv-natives/.github/workflows/build-macos.yml
T
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

78 lines
2.4 KiB
YAML

name: build-macos
# Builds a universal (arm64 + x86_64) self-contained libmpv.dylib for macOS
# from mpv source pinned to a release tag. Two native builds run in parallel
# (x86_64 on macos-14, arm64 on macos-15); a merge job combines the two dylibs
# with lipo into one universal library and uploads it.
#
# Every dependency is built static and linked into the one dylib (same
# approach as the Windows build). jlibmpv expects the file name
# `libmpv.dylib` (no -2) and one universal binary for both architectures.
#
# 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.
# The build recipe lives in ci/build-libmpv-macos.sh in this repository.
on:
push:
branches: [main]
workflow_dispatch:
env:
MPV_REF: v0.41.0
jobs:
build-x86_64:
uses: ./.github/workflows/build-macos-arch.yml
with:
arch: x86_64
runner: macos-14
build-arm64:
uses: ./.github/workflows/build-macos-arch.yml
with:
arch: arm64
runner: macos-15
merge:
needs: [build-x86_64, build-arm64]
runs-on: macos-15
steps:
- name: Check out mpv-natives (build scripts)
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Check out mpv (pinned tag)
uses: actions/checkout@v4
with:
repository: mpv-player/mpv
ref: ${{ env.MPV_REF }}
path: mpv
fetch-depth: 1
- name: Download architecture artifacts
uses: actions/download-artifact@v4
with:
pattern: mpv-natives-macos-${{ env.MPV_REF }}-*
path: arch
merge-multiple: true
- name: Create universal dylib
run: |
mkdir -p artifact-libmpv
lipo -create \
"arch/x86_64/libmpv-2.dylib" \
"arch/arm64/libmpv-2.dylib" \
-output artifact-libmpv/libmpv.dylib
lipo -info artifact-libmpv/libmpv.dylib
cp -pv mpv/mpvrender.h mpv/mpv/client.h mpv/ebml_types.h artifact-libmpv/ 2>/dev/null || true
sha256sum artifact-libmpv/libmpv.dylib > artifact-libmpv/checksums.txt
cat artifact-libmpv/checksums.txt
ls -l artifact-libmpv
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mpv-natives-macos-universal-mpv-${{ env.MPV_REF }}
path: artifact-libmpv