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): retarget the macOS floor to 13, matching the declared support

Etienne Lescotf05c7163e7c1
diff --git a/scripts/before-pack.cjs b/scripts/before-pack.cjs
index b54060ba9..b06568008 100644
--- a/scripts/before-pack.cjs
+++ b/scripts/before-pack.cjs
@@ -514,16 +514,13 @@ const MAX_SYMBOL_VERSION = { GLIBC: "2.35", GLIBCXX: "3.4.30", CXXABI: "1.3.13"
* The oldest macOS anything in the payload may demand — the macOS twin of
* MAX_SYMBOL_VERSION above, and the same class of bug on a different libc.
*
- * Keep in step with README.md's system requirements and with Electron's own
- * LSMinimumSystemVersion, which the .app inherits verbatim (electron-builder writes the
- * key only when `mac.minimumSystemVersion` is set, and it is not).
- *
- * before-pack.test.mjs ties this to the README so the two cannot drift apart quietly. The
- * invariant it asserts is one-directional on purpose: this floor must be no HIGHER than
- * the oldest macOS the README promises. Building for something older than we advertise is
- * harmless; building for something newer is #515.
+ * Must equal `mac.minimumSystemVersion` in electron-builder.json5, which is what the .app
+ * tells LaunchServices; before-pack.test.mjs asserts exactly that, so the two cannot drift
+ * apart quietly. Not read from the config at runtime because this hook must keep working
+ * if that file is ever restructured — a guard that throws while parsing is a guard that
+ * gets deleted.
*/
-const MAC_MIN_OS_FLOOR = "12.0";
+const MAC_MIN_OS_FLOOR = "13.0";
/**
* The one supported way past the ceiling, for the one case it does not fit: a developer
diff --git a/scripts/before-pack.test.mjs b/scripts/before-pack.test.mjs
index 3e993a665..5c34f59cd 100644
--- a/scripts/before-pack.test.mjs
+++ b/scripts/before-pack.test.mjs
@@ -197,8 +197,19 @@ describe("machoMinOs", () => {
});
describe("checkMacOsVersionFloor", () => {
- it("passes a payload built at the floor", () => {
- withPayload({ a: thinMachO("12.0"), b: thinMachO("11.0") }, (dir) => {
+ /**
+ * Fixtures are derived from the floor rather than written as literals. An earlier
+ * revision hardcoded the then-current floor as "the offending version", and raising
+ * the floor silently turned the offender into a compliant binary — the guard's own
+ * tests stopped testing it. The exact versions were never the point; being on the
+ * wrong side of the floor is.
+ */
+ const floorMajor = Number(testing().MAC_MIN_OS_FLOOR.split(".")[0]);
+ const above = (bump = 1) => `${floorMajor + bump}.0`;
+ const below = () => `${floorMajor - 1}.0`;
+
+ it("passes a payload built at or below the floor", () => {
+ withPayload({ a: thinMachO(testing().MAC_MIN_OS_FLOOR), b: thinMachO(below()) }, (dir) => {
expect(() => testing().checkMacOsVersionFloor(dir)).not.toThrow();
});
});
@@ -209,7 +220,7 @@ describe("checkMacOsVersionFloor", () => {
* hits it to understand the consequence rather than just raise the constant.
*/
it("refuses a binary built above the floor, and says which and why", () => {
- withPayload({ "openscreen-macos-cursor-helper": thinMachO("13.0") }, (dir) => {
+ withPayload({ "openscreen-macos-cursor-helper": thinMachO(above()) }, (dir) => {
let message = "";
try {
testing().checkMacOsVersionFloor(dir);
@@ -217,8 +228,8 @@ describe("checkMacOsVersionFloor", () => {
message = err.message;
}
expect(message).toContain("openscreen-macos-cursor-helper");
- expect(message).toContain("macOS 13.0.0");
- expect(message).toContain("12.0");
+ expect(message).toContain(`macOS ${above()}.0`);
+ expect(message).toContain(testing().MAC_MIN_OS_FLOOR);
expect(message).toContain("#515");
// The mechanism, so nobody "fixes" it by assuming dyld gates on the number.
expect(message).toContain("Symbol not found");
@@ -227,7 +238,11 @@ describe("checkMacOsVersionFloor", () => {
it("reports every offender, not just the first", () => {
withPayload(
- { ok: thinMachO("12.0"), bad1: thinMachO("13.0"), bad2: thinMachO("26.0") },
+ {
+ ok: thinMachO(testing().MAC_MIN_OS_FLOOR),
+ bad1: thinMachO(above(1)),
+ bad2: thinMachO(above(2)),
+ },
(dir) => {
expect(() => testing().checkMacOsVersionFloor(dir)).toThrow(/bad1[\s\S]*bad2/);
},
@@ -252,23 +267,22 @@ describe("checkMacOsVersionFloor", () => {
});
describe("MAC_MIN_OS_FLOOR", () => {
- it("is no higher than the oldest macOS the README promises", () => {
- const readme = readFileSync(path.join(path.dirname(BEFORE_PACK), "..", "README.md"), "utf8");
- const claimed = readme.match(/^-\s+\*\*macOS\*\*:\s*(\d+(?:\.\d+)?)/m);
- expect(claimed, "no macOS line found in README.md system requirements").not.toBeNull();
+ it("matches the floor the .app declares to LaunchServices", () => {
+ const config = readFileSync(
+ path.join(path.dirname(BEFORE_PACK), "..", "electron-builder.json5"),
+ "utf8",
+ );
+ const declared = config.match(/"minimumSystemVersion"\s*:\s*"([\d.]+)"/);
+ expect(
+ declared,
+ 'no "minimumSystemVersion" in electron-builder.json5 — without it the .app ' +
+ "inherits Electron's own floor, which is what let #515 ship",
+ ).not.toBeNull();
const { MAC_MIN_OS_FLOOR } = testing();
- const asNumbers = (v) => v.split(".").map(Number);
- const [floorMajor, floorMinor = 0] = asNumbers(MAC_MIN_OS_FLOOR);
- const [claimedMajor, claimedMinor = 0] = asNumbers(claimed[1]);
-
- // One-directional: building for older than advertised is harmless, building for
- // newer is the bug. So floor <= claimed, not floor === claimed.
- expect(
- floorMajor * 1000 + floorMinor,
- `before-pack.cjs builds for macOS ${MAC_MIN_OS_FLOOR} but README.md promises ` +
- `${claimed[1]} or later. Shipping binaries that cannot run on a version the ` +
- "README claims to support is issue #515.",
- ).toBeLessThanOrEqual(claimedMajor * 1000 + claimedMinor);
+ const norm = (v) => v.split(".").concat(["0", "0"]).slice(0, 2).join(".");
+ // Equal, not merely <=: a pack-time guard looser than the app's own declaration
+ // would wave through exactly the binaries LaunchServices then refuses to run.
+ expect(norm(MAC_MIN_OS_FLOOR)).toBe(norm(declared[1]));
});
});
diff --git a/scripts/build-whisper-stt.sh b/scripts/build-whisper-stt.sh
index 71cfa6e6f..74f5be046 100644
--- a/scripts/build-whisper-stt.sh
+++ b/scripts/build-whisper-stt.sh
@@ -74,9 +74,9 @@ readonly OS_ARCH="$(os_arch_tag)"
readonly OUT_DIR="${OUT_ROOT}/${OS_ARCH}"
# Kept beside the other build constants so it is greppable next to the ffmpeg one in
-# scripts/fetch-ffmpeg-macos.mjs; the two must agree, and both must be <= the app's
-# LSMinimumSystemVersion.
-readonly MACOS_DEPLOYMENT_TARGET="12.0"
+# scripts/fetch-ffmpeg-macos.mjs; the two must agree, and both must match
+# `mac.minimumSystemVersion` in electron-builder.json5.
+readonly MACOS_DEPLOYMENT_TARGET="13.0"
# Determine the default backend flag for this host.
backend_flag_for_host() {
@@ -310,8 +310,8 @@ BUILD_FLAGS=()
if [[ -n "${DEFAULT_FLAG}" ]]; then
BUILD_FLAGS+=("${DEFAULT_FLAG}")
fi
-# Pin the macOS floor the app actually ships against (Electron's own
-# LSMinimumSystemVersion, and what README/installation.md promise). Without it CMake
+# Pin the macOS floor the app actually ships against (`mac.minimumSystemVersion` in
+# electron-builder.json5). Without it CMake
# defaults the deployment target to the BUILD MACHINE's SDK, so whisper-stt-server and
# the libwhisper/libggml*/libparakeet dylibs inherit whatever macOS built them —
# measured 26.0 on the shipped v1.10.0 payload, and ~15.x from CI's `macos-latest`,
diff --git a/scripts/fetch-ffmpeg-macos.mjs b/scripts/fetch-ffmpeg-macos.mjs
index 52563ee97..48d92669b 100644
--- a/scripts/fetch-ffmpeg-macos.mjs
+++ b/scripts/fetch-ffmpeg-macos.mjs
@@ -29,8 +29,10 @@ const ROOT = path.join(__dirname, "..");
const CRATES_DIR = path.join(ROOT, "crates");
/** Pinned release. The directory name is what build.rs looks for. */
-// The macOS floor the app ships against (Electron 41's own LSMinimumSystemVersion, and
-// what README/installation.md promise). Without it, clang defaults the deployment target
+// The macOS floor the app ships against — keep in step with `mac.minimumSystemVersion`
+// in electron-builder.json5, which is what the .app tells LaunchServices.
+//
+// Without it, clang defaults the deployment target
// to the BUILD MACHINE's SDK, so the vendored dylibs inherit whatever macOS built them —
// measured 26.0 on a local build and ~15.x from CI's `macos-latest`, a floor that moves on
// its own every time GitHub rolls that image. That is the same class of leak the configure
@@ -39,7 +41,7 @@ const CRATES_DIR = path.join(ROOT, "crates");
// Note this is NOT a loader version gate: dyld does not refuse a dylib whose minos exceeds
// the running OS (verified). Setting it is what makes the LINKER enforce macOS 12 symbol
// availability, which is the thing that actually breaks at load time. See issue #515.
-const MACOS_DEPLOYMENT_TARGET = "12.0";
+const MACOS_DEPLOYMENT_TARGET = "13.0";
const VERSION = "8.1.2";
const TARBALL_SHA256 = "464beb5e7bf0c311e68b45ae2f04e9cc2af88851abb4082231742a74d97b524c";