Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(build): address review comments and format before-pack.cjs

Etienne Lescot369f16ac1d7e
diff --git a/scripts/before-pack.cjs b/scripts/before-pack.cjs
index a43455b17..dd1c78c75 100644
--- a/scripts/before-pack.cjs
+++ b/scripts/before-pack.cjs
@@ -129,7 +129,7 @@ const MAC_REQUIRED = [
what: "the LGPL ffmpeg CLI (spawned for waveform peaks and STT audio extraction)",
breaks:
"transcription falls back to the renderer decode or fails outright on machines with no\n" +
- "system ffmpeg, shown to the user only as \"Failed to fetch\" (#616)",
+ 'system ffmpeg, shown to the user only as "Failed to fetch" (#616)',
fix: "Build it with:\n\n npm run build:native:compositor:mac\n\nwhich stages the SDK's ffmpeg beside the vendored dylibs.",
},
];
diff --git a/scripts/build-macos-compositor-addon.mjs b/scripts/build-macos-compositor-addon.mjs
index 4b1491495..a9b939fc3 100644
--- a/scripts/build-macos-compositor-addon.mjs
+++ b/scripts/build-macos-compositor-addon.mjs
@@ -291,7 +291,7 @@ function stageFfmpegBinary(outDir, ffmpegDir) {
const fileDeps = execFileSync("otool", ["-L", file], { encoding: "utf8" })
.split("\n")
.map((line) => line.trim().split(" ")[0])
- .filter((p) => p.startsWith("/") && /lib(av|sw)\w+\.\d+\.dylib$/.test(p));
+ .filter((p) => /(^\/|@executable_path).*lib(av|sw)\w+\.\d+\.dylib$/.test(p));
for (const dep of fileDeps) {
execFileSync("install_name_tool", ["-change", dep, `@rpath/${path.basename(dep)}`, file]);
}
diff --git a/scripts/fetch-ffmpeg-macos.mjs b/scripts/fetch-ffmpeg-macos.mjs
index 94b8d29b8..d165af762 100644
--- a/scripts/fetch-ffmpeg-macos.mjs
+++ b/scripts/fetch-ffmpeg-macos.mjs
@@ -176,8 +176,15 @@ function isAtDeploymentTarget(dir) {
const build = execFileSync("vtool", ["-show-build", bin], { encoding: "utf8" });
const minos = /minos (\d+(?:\.\d+)+)/.exec(build)?.[1];
if (minos === undefined) return false;
- const toNum = (v) => v.split(".").reduce((acc, part) => acc * 100 + Number(part), 0);
- return toNum(minos) <= toNum(MACOS_DEPLOYMENT_TARGET);
+ const compareVersions = (a, b) => {
+ const left = a.split(".").map(Number);
+ const right = b.split(".").map(Number);
+ for (let i = 0; i < Math.max(left.length, right.length); i++) {
+ if ((left[i] ?? 0) !== (right[i] ?? 0)) return (left[i] ?? 0) - (right[i] ?? 0);
+ }
+ return 0;
+ };
+ return compareVersions(minos, MACOS_DEPLOYMENT_TARGET) <= 0;
}
if (process.platform !== "darwin") {