diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 7de1fce..00ecb65 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -12,23 +12,29 @@ name: build-linux # font stack: libass (a hard mpv dependency) needs fontconfig (-> expat) where # macOS/Windows use CoreText/DirectWrite. # -# 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 (dependency versions, static flags) lives in -# ci/build-libmpv-linux.sh in this repository. +# Pinned to the mpv tag in ci/versions.env - the version whose client API +# (131077) the jlibmpv JNA bindings are validated against. Bump MPV_REF (and +# the dependency pins) there for a libmpv update. The build recipe +# (dependency versions, static flags) lives in ci/build-libmpv-linux.sh. +# +# Triggers: pull requests (all three build workflows act as the PR check), +# manual workflow_dispatch, and workflow_call from release.yml on tag push. +# A push to main builds nothing on its own. on: - push: - branches: [main] + pull_request: workflow_dispatch: + workflow_call: env: - MPV_REF: v0.41.0 TARGET: x86_64-linux jobs: - build: + linux: runs-on: ubuntu-24.04 + outputs: + artifact-name: ${{ steps.artifact.outputs.name }} + version: ${{ steps.artifact.outputs.version }} env: CCACHE_BASEDIR: ${{ github.workspace }} CCACHE_DIR: ${{ github.workspace }}/.ccache @@ -39,11 +45,17 @@ jobs: with: fetch-depth: 1 + - name: Load pinned versions + id: versions + run: | + source ci/versions.env + echo "mpv_ref=$MPV_REF" >> "$GITHUB_OUTPUT" + - name: Check out mpv (pinned tag) uses: actions/checkout@v4 with: repository: mpv-player/mpv - ref: ${{ env.MPV_REF }} + ref: ${{ steps.versions.outputs.mpv_ref }} path: mpv fetch-depth: 1 @@ -118,12 +130,13 @@ jobs: id: artifact run: | VER=$(cat mpv/MPV_VERSION | tr -d '[:space:]') - echo "name=mpv-natives-linux-x86_64-mpv-$VER" >> "$GITHUB_OUTPUT" + # Intermediate artifact is a per-platform directory (zipped by + # upload-artifact) containing libmpv.so + checksums.txt. release.yml + # downloads it and re-uploads the bare .so as the final release asset + # named -.so. + echo "name=mpv-natives-linux-x86_64" >> "$GITHUB_OUTPUT" echo "version=$VER" >> "$GITHUB_OUTPUT" - # upload-artifact zips the directory itself, so handing it the folder - # (not a pre-zipped file) yields a single-level archive without the - # double-zip wrapper. - name: Upload artifact uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 01d52bb..4ce2e4f 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -10,21 +10,25 @@ name: build-macos # 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. +# Pinned to the mpv tag in ci/versions.env - the version whose client API +# (131077) the jlibmpv JNA bindings are validated against. Bump MPV_REF (and +# the dependency pins) there for a libmpv update. The build recipe lives in +# ci/build-libmpv-macos.sh. +# +# Triggers: pull requests (PR check), manual workflow_dispatch, and +# workflow_call from release.yml on tag push. A push to main builds nothing. on: - push: - branches: [main] + pull_request: workflow_dispatch: - -env: - MPV_REF: v0.41.0 + workflow_call: jobs: - build: + macos: runs-on: macos-15 + outputs: + artifact-name: ${{ steps.artifact.outputs.name }} + version: ${{ steps.artifact.outputs.version }} env: CCACHE_BASEDIR: ${{ github.workspace }} CCACHE_DIR: ${{ github.workspace }}/.ccache @@ -35,11 +39,17 @@ jobs: with: fetch-depth: 1 + - name: Load pinned versions + id: versions + run: | + source ci/versions.env + echo "mpv_ref=$MPV_REF" >> "$GITHUB_OUTPUT" + - name: Check out mpv (pinned tag) uses: actions/checkout@v4 with: repository: mpv-player/mpv - ref: ${{ env.MPV_REF }} + ref: ${{ steps.versions.outputs.mpv_ref }} path: mpv fetch-depth: 1 @@ -92,10 +102,17 @@ jobs: cat artifact-libmpv/checksums.txt ls -l artifact-libmpv + - name: Artifact name + id: artifact + run: | + VER=$(cat mpv/MPV_VERSION | tr -d '[:space:]') + echo "name=mpv-natives-macos-universal" >> "$GITHUB_OUTPUT" + echo "version=$VER" >> "$GITHUB_OUTPUT" + - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: mpv-natives-macos-universal-mpv-${{ env.MPV_REF }} + name: ${{ steps.artifact.outputs.name }} path: artifact-libmpv - name: Save ccache diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 6eb6c0a..ca17d4f 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -5,23 +5,28 @@ name: build-windows # into the one DLL together with a static CRT, so the artifact has no runtime # dependency closure to ship (unlike mpv's own shared-DLL CI build). # -# 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 (dependency versions, static flags) lives in -# ci/build-libmpv-mingw64.sh in this repository. +# Pinned to the mpv tag in ci/versions.env - the version whose client API +# (131077) the jlibmpv JNA bindings are validated against. Bump MPV_REF (and +# the dependency pins) there for a libmpv update. The build recipe lives in +# ci/build-libmpv-mingw64.sh. +# +# Triggers: pull requests (PR check), manual workflow_dispatch, and +# workflow_call from release.yml on tag push. A push to main builds nothing. on: - push: - branches: [main] + pull_request: workflow_dispatch: + workflow_call: env: - MPV_REF: v0.41.0 TARGET: x86_64-w64-mingw32 jobs: - build: + windows: runs-on: ubuntu-24.04 + outputs: + artifact-name: ${{ steps.artifact.outputs.name }} + version: ${{ steps.artifact.outputs.version }} env: CCACHE_BASEDIR: ${{ github.workspace }} CCACHE_DIR: ${{ github.workspace }}/.ccache @@ -32,11 +37,17 @@ jobs: with: fetch-depth: 1 + - name: Load pinned versions + id: versions + run: | + source ci/versions.env + echo "mpv_ref=$MPV_REF" >> "$GITHUB_OUTPUT" + - name: Check out mpv (pinned tag) uses: actions/checkout@v4 with: repository: mpv-player/mpv - ref: ${{ env.MPV_REF }} + ref: ${{ steps.versions.outputs.mpv_ref }} path: mpv fetch-depth: 1 @@ -86,12 +97,9 @@ jobs: id: artifact run: | VER=$(cat mpv/MPV_VERSION | tr -d '[:space:]') - echo "name=mpv-natives-windows-x86_64-mpv-$VER" >> "$GITHUB_OUTPUT" + echo "name=mpv-natives-windows-x86_64" >> "$GITHUB_OUTPUT" echo "version=$VER" >> "$GITHUB_OUTPUT" - # upload-artifact zips the directory itself, so handing it the folder - # (not a pre-zipped file) yields a single-level archive without the - # double-zip wrapper. - name: Upload artifact uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4af510c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,69 @@ +name: release + +# Publishes the self-contained libmpv for all three platforms as a GitHub +# Release. Triggered by pushing a tag of the form v (e.g. +# v0.41.0). It reuses the three per-platform build workflows and re-uploads +# their single-file artifacts as bare release assets plus a combined +# checksums.txt. +# +# Asset names are derived from each build job's output and the mpv version +# read from the mpv source tree, so the release tag and the mpv version stay +# in sync: +# mpv-natives-linux-x86_64-.so +# mpv-natives-windows-x86_64-.dll +# mpv-natives-macos-universal-.dylib +# checksums.txt +# +# jlibmpv's RemoteNativeLocator resolves the download URL deterministically +# from (platform, mpv version) against these names. + +on: + push: + tags: ['v*'] + +permissions: + contents: write + +jobs: + build-linux: + uses: ./.github/workflows/build-linux.yml + build-windows: + uses: ./.github/workflows/build-windows.yml + build-macos: + uses: ./.github/workflows/build-macos.yml + + publish: + needs: [build-linux, build-windows, build-macos] + runs-on: ubuntu-24.04 + steps: + - name: Download platform artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Assemble bare release assets + run: | + VER="${{ needs.build-linux.outputs.version }}" + [ -n "$VER" ] || { echo "ERROR: mpv version not set"; exit 1; } + mkdir -p release + # linux: single self-contained libmpv.so + cp "artifacts/mpv-natives-linux-x86_64/libmpv.so" \ + "release/mpv-natives-linux-x86_64-${VER}.so" + # windows: single self-contained libmpv-*.dll (static CRT, no closure) + cp artifacts/mpv-natives-windows-x86_64/libmpv-*.dll \ + "release/mpv-natives-windows-x86_64-${VER}.dll" + # macos: single universal libmpv.dylib + cp "artifacts/mpv-natives-macos-universal/libmpv.dylib" \ + "release/mpv-natives-macos-universal-${VER}.dylib" + (cd release && sha256sum * > checksums.txt) + echo "=== release assets ===" + ls -l release + echo "=== checksums ===" + cat release/checksums.txt + + - name: Publish GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.ref_name }} + files: release/* + generate_release_notes: false \ No newline at end of file diff --git a/ci/build-libmpv-linux.sh b/ci/build-libmpv-linux.sh index a01487d..b3a31c2 100644 --- a/ci/build-libmpv-linux.sh +++ b/ci/build-libmpv-linux.sh @@ -33,8 +33,12 @@ mkdir -p "$prefix_dir" wget="wget -nc --progress=bar:force" -export CC=gcc -export CXX=g++ +# Route compilation through ccache (honored by ffmpeg's configure, meson and +# CMake alike) so rebuilds after a versions.env bump reuse cached objects. In +# CI the cache dir is provided by the workflow (CCACHE_DIR). +CCACHE=${CCACHE:-ccache} +export CC="$CCACHE gcc" +export CXX="$CCACHE g++" export AR=ar export NM=nm export RANLIB=ranlib @@ -47,17 +51,9 @@ export LDFLAGS="" export PKG_CONFIG_PATH="$prefix_dir/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" # --- Pinned dependency versions ------------------------------------------- -# Latest stable tag on or before the mpv v0.41.0 release (2025-12-21). -FFMPEG_VER=n8.0.1 -DAV1D_VER=1.5.2 -LIBPLACEBO_VER=v7.351.0 -LIBASS_VER=0.17.4 -LCMS2_VER=lcms2.17 -FREETYPE_VER=2.14.1 -FRIBIDI_VER=1.0.16 -HARFBUZZ_VER=12.2.0 -FONTCONFIG_VER=2.16.2 -EXPAT_VER=R_2_7_3 +# Centralized in ci/versions.env (single source of truth shared with the other +# platforms and with CI). Bump mpv + deps there. +. "$(dirname "$0")/versions.env" # Static everywhere: every dependency becomes a .a archive that gets linked # into the single libmpv.so. (mpv's own script ships shared libs instead.) diff --git a/ci/build-libmpv-macos.sh b/ci/build-libmpv-macos.sh index 0451042..e0ec7f3 100644 --- a/ci/build-libmpv-macos.sh +++ b/ci/build-libmpv-macos.sh @@ -50,15 +50,9 @@ export LDFLAGS="" export PKG_CONFIG_PATH="$prefix_dir/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" # --- Pinned dependency versions ------------------------------------------- -# Latest stable tag on or before the mpv v0.41.0 release (2025-12-21). -FFMPEG_VER=n8.0.1 -DAV1D_VER=1.5.2 -LIBPLACEBO_VER=v7.351.0 -LIBASS_VER=0.17.4 -LCMS2_VER=lcms2.17 -FREETYPE_VER=2.14.1 -FRIBIDI_VER=1.0.16 -HARFBUZZ_VER=12.2.0 +# Centralized in ci/versions.env (single source of truth shared with the other +# platforms and with CI). Bump mpv + deps there. +. "$(dirname "$0")/versions.env" # Static everywhere: every dependency becomes a .a archive that gets linked # into the single libmpv dylib. (mpv's own script ships shared libs instead.) diff --git a/ci/build-libmpv-mingw64.sh b/ci/build-libmpv-mingw64.sh index a6c0bbb..c175635 100644 --- a/ci/build-libmpv-mingw64.sh +++ b/ci/build-libmpv-mingw64.sh @@ -48,17 +48,9 @@ export PKG_CONFIG_SYSROOT_DIR="$prefix_dir" export PKG_CONFIG_LIBDIR="$PKG_CONFIG_SYSROOT_DIR/lib/pkgconfig" # --- Pinned dependency versions ------------------------------------------- -# Latest stable tag on or before the mpv v0.41.0 release (2025-12-21). -FFMPEG_VER=n8.0.1 -DAV1D_VER=1.5.2 -LIBPLACEBO_VER=v7.351.0 -LIBASS_VER=0.17.4 -LCMS2_VER=lcms2.17 -ICONV_VER=1.18 -ZLIB_VER=1.3.1 -FREETYPE_VER=2.14.1 -FRIBIDI_VER=1.0.16 -HARFBUZZ_VER=12.2.0 +# Centralized in ci/versions.env (single source of truth shared with the other +# platforms and with CI). Bump mpv + deps there. +. "$(dirname "$0")/versions.env" # Static everywhere: every dependency becomes a .a archive that gets linked # into the single libmpv-2.dll. (mpv's own script ships shared .dlls instead.) diff --git a/ci/versions.env b/ci/versions.env new file mode 100644 index 0000000..00d2aa4 --- /dev/null +++ b/ci/versions.env @@ -0,0 +1,32 @@ +# Single source of truth for every pinned version in this repository. +# +# Bumping mpv: change MPV_REF and, if the new mpv release ships newer +# dependencies, bump the affected *_VER variables in the same commit. +# +# Every build script and every workflow sources this file. Do not duplicate +# version numbers anywhere else. +# +# All versions are the latest stable tags that existed on or before the +# mpv v0.41.0 release (2025-12-21), so a rebuild reproduces the same +# binary instead of drifting to upstream git HEAD. + +# --- mpv itself ----------------------------------------------------------- +MPV_REF=v0.41.0 + +# --- shared by all three platforms ---------------------------------------- +FFMPEG_VER=n8.0.1 +DAV1D_VER=1.5.2 +LIBPLACEBO_VER=v7.351.0 +LIBASS_VER=0.17.4 +LCMS2_VER=lcms2.17 +FREETYPE_VER=2.14.1 +FRIBIDI_VER=1.0.16 +HARFBUZZ_VER=12.2.0 + +# --- linux only (fontconfig is the Linux font provider for libass) -------- +FONTCONFIG_VER=2.16.2 +EXPAT_VER=R_2_7_3 + +# --- windows only (no system zlib/iconv on MinGW) ------------------------- +ICONV_VER=1.18 +ZLIB_VER=1.3.1 \ No newline at end of file