- Introduced tooling for building and staging the macOS `libmpv` runtime for IPTVnator's embedded MPV player. - Added `build-macos-runtime.mjs` for building an LGPL-compatible runtime from source. - Created `stage-macos-runtime.mjs` for staging the built runtime artifacts. - Implemented validation for the packaged embedded MPV runtime in `electron-after-pack.cjs` and `embedded-mpv-macos.cjs`. - Updated packaging scripts to ensure the embedded MPV runtime is correctly integrated and validated during the build process. - Added README files to document the expected layout and usage for the embedded MPV runtime artifacts. Entire-Checkpoint: c6e522b4276c
3.4 KiB
Embedded MPV macOS Runtime
This folder contains tooling for preparing the macOS libmpv runtime that is bundled with IPTVnator's experimental embedded MPV player.
Runtime Policy
Release builds must use an LGPL-compatible runtime:
- FFmpeg must be built without
--enable-gpland without--enable-nonfree. - mpv must be built with
-Dlibmpv=trueand-Dgpl=false. - The runtime must be dynamically linked so users can inspect and replace LGPL libraries.
- The exact source URLs, versions, build flags, local patches, and checksums must be published with the release.
Do not ship the Homebrew mpv runtime. It is acceptable only for local development when IPTVNATOR_EMBEDDED_MPV_ALLOW_HOMEBREW=1 is set, and release packaging rejects it.
Expected Layout
The native addon build consumes:
vendor/embedded-mpv/
darwin-arm64/
include/mpv/client.h
lib/*.dylib
runtime-manifest.json
darwin-x64/
include/mpv/client.h
lib/*.dylib
runtime-manifest.json
The generated lib/ and include/ directories are release inputs, not source files. They are ignored by git by default.
Staging A Built Runtime
After building an LGPL-compatible prefix for one architecture, stage it with:
node tools/embedded-mpv/stage-macos-runtime.mjs arm64 /path/to/lgpl-prefix
node tools/embedded-mpv/stage-macos-runtime.mjs x64 /path/to/lgpl-prefix
The prefix must contain include/mpv/client.h, lib/libmpv.2.dylib or lib/libmpv.dylib, and all non-system dylib dependencies required by libmpv.
If the prefix contains runtime-manifest.json, the staging script copies its build metadata into the vendored manifest. At minimum, record:
- FFmpeg version, source URL, checksum, configure flags, and patches
- mpv version, source URL, checksum, Meson flags, and patches
- source-distribution URL for the corresponding release
Building The CI Runtime
Tagged macOS release builds build the runtime from pinned source archives before electron-backend:build:
pnpm embedded-mpv:build-runtime -- arm64 /tmp/embedded-mpv-prefix
pnpm embedded-mpv:stage-runtime -- arm64 /tmp/embedded-mpv-prefix
The builder currently pins:
- FFmpeg
8.1, configured without--enable-gplor--enable-nonfree, and with autodetected external libraries disabled - mpv
0.41.0, configured with-Dlibmpv=true -Dgpl=false - libplacebo
7.360.1 - libass
0.17.3plus FreeType, FriBidi, and HarfBuzz
The build manifest records source URLs, downloaded source SHA-256 values, and the exact FFmpeg/mpv flags. The staged manifest is normalized to origin: vendored-lgpl, which is the only embedded MPV runtime origin allowed in required macOS release packaging.
Build Integration
apps/electron-backend/build-embedded-mpv.js links the native addon against the staged runtime, copies dylibs into apps/electron-backend/native/build/Release/lib/, rewrites Mach-O paths to @loader_path, and writes embedded-mpv-runtime.json.
During release packaging, tools/packaging/electron-after-pack.cjs verifies that the packaged app uses a vendored-lgpl runtime and has no /opt/homebrew or /usr/local dynamic links for embedded MPV.
Set IPTVNATOR_REQUIRE_EMBEDDED_MPV=1 when packaging a macOS release artifact that must include Embedded MPV. PR and non-tag development builds leave that variable unset or 0, so the same in-tree code can package without a staged runtime while Settings keeps Embedded MPV hidden.