Skip to content

Commit 738f929

Browse files
author
Mindless999
committed
Allow build to run on MacOS
1 parent e9bee2e commit 738f929

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

make.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ import { execSync } from "child_process";
22
import { copyFileSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
33
import { platform } from "os";
44

5+
//Check if using MacOS
6+
const isMac = process.platform === "darwin";
7+
8+
// Used to have items writable during build on MacOS
9+
import fs from "fs";
10+
511
const run = (cmd) => execSync(cmd, { stdio: "inherit" });
612

713
const binPath = platform() === "win32" ? ".\\build\\float.exe" : "./build/float";
@@ -22,7 +28,19 @@ copyFileSync(process.execPath, binPath);
2228
writeFileSync("./build/version", JSON.parse(readFileSync("./package.json")).version);
2329

2430
// Create the blob
25-
run("node --experimental-sea-config ./sea-config.json");
31+
if (isMac) {
32+
execSync("node --experimental-sea-config sea-config.json", {
33+
stdio: "inherit",
34+
});
35+
// Set permissions for float which otherwise breaks the build or run
36+
fs.chmodSync("./build/float", 0o755);
37+
38+
console.log("macOS SEA build complete (no postject)");
39+
process.exit(0);
40+
}
41+
else{
42+
run("node --experimental-sea-config ./sea-config.json");
43+
}
2644

2745
// Inject the blob
2846
run(`npx postject ${binPath} NODE_SEA_BLOB ./dist/float.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 --macho-segment-name NODE_SEA`);

0 commit comments

Comments
 (0)