build(embedded-mpv): streamline macOS native output handling and packaging process

Entire-Checkpoint: c6e522b4276c
This commit is contained in:
4gray committed 2026-04-27 11:33:57 +02:00
1 parent 6aa4f2521b
commit b25fc040b5
5 files changed
+34 -42

No files matched your search

+1 -1
View File
@@ -70,7 +70,7 @@ The build manifest records source URLs, downloaded archive SHA-256 values where
`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`.
The Electron builder and Nx package/make targets package `dist/apps/electron-backend/native/` into `electron-backend/native/` and unpack that whole native directory from ASAR so the addon, runtime manifest, dylibs, and non-`.dylib` Mach-O runtime files are available as real files.
The macOS `afterPack` hook copies `dist/apps/electron-backend/native/` into `app.asar.unpacked/electron-backend/native/` so the addon, runtime manifest, dylibs, and non-`.dylib` Mach-O runtime files are available as real files. Linux and Windows artifacts do not include that native directory.
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.
+30
View File
@@ -17,6 +17,30 @@ function isTruthy(value) {
);
}
function copyEmbeddedMpvNativeOutput(resourceDir, projectDir) {
const sourceDir = path.join(
projectDir,
'dist',
'apps',
'electron-backend',
'native'
);
if (!fs.existsSync(sourceDir)) {
return;
}
const destinationDir = path.join(
resourceDir,
'app.asar.unpacked',
'electron-backend',
'native'
);
fs.rmSync(destinationDir, { recursive: true, force: true });
fs.cpSync(sourceDir, destinationDir, { recursive: true });
}
async function afterPackHook(params) {
await linuxAfterPack(params);
@@ -46,6 +70,12 @@ async function afterPackHook(params) {
'Resources'
)
: params.appOutDir;
copyEmbeddedMpvNativeOutput(
resourceDir,
params.packager.projectDir ?? process.cwd()
);
const errors = validatePackagedEmbeddedMpv(resourceDir, {
required: requireEmbeddedMpv,
});