Skip to content

Commit d41d177

Browse files
committed
fix prebuilt scripts
1 parent 5b7e606 commit d41d177

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

scripts/ninjaFactory.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
// ../native/4.06.1/bin/ocamlopt.opt -c -O2 -nodynlink -I 4.06.1 -g -w a+32 4.06.1/whole_compiler.mli 4.06.1/whole_compiler.ml &> warning.log
88
/**
99
*
10-
* @param {{ocamlopt : string ; ext : string ; INCL : string, isWin : boolean}} config
10+
* @param {{ocamlopt : string ; INCL : string, isWin : boolean}} config
1111
*
1212
*/
1313
function libNinja(config) {
1414
return `
1515
ocamlopt = ${config.ocamlopt}
16-
ext = ${config.ext}
16+
ext = .exe
1717
INCL = ${config.INCL}
1818
flags = -nodynlink -I $INCL -g -w -a ../jscomp/stubs/ext_basic_hash_stubs.c
1919
rule cc

scripts/prebuilt.js

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,18 @@
22
//@ts-check
33
var cp = require("child_process");
44
var path = require("path");
5-
var { sys_extension, is_windows } = require("./config.js");
5+
var { is_windows } = require("./config.js");
66

77
var root = path.join(__dirname, "..");
8-
var root_config = { cwd: root, stdio: [0, 1, 2], encoding: 'utf8' };
8+
var root_config = { cwd: root, stdio: [0, 1, 2], encoding: "utf8" };
99
process.env.BS_RELEASE_BUILD = "true";
1010

1111
var ocamlVersion = require("./buildocaml.js").getVersionPrefix();
1212
var fs = require("fs");
1313
var hostPlatform = "darwin";
1414

1515
function rebuild() {
16-
cp.execSync(`node ${path.join(__dirname, "ninja.js")} clean`, {
17-
cwd: __dirname,
18-
stdio: [0, 1, 2]
19-
});
20-
cp.execSync(`node ${path.join(__dirname, "ninja.js")} config`, {
21-
cwd: __dirname,
22-
stdio: [0, 1, 2]
23-
});
24-
cp.execSync(`node ${path.join(__dirname, "ninja.js")} build`, {
16+
cp.execSync(`node ${path.join(__dirname, "ninja.js")} cleanbuild`, {
2517
cwd: __dirname,
2618
stdio: [0, 1, 2]
2719
});
@@ -36,22 +28,24 @@ function buildCompiler() {
3628
ocamlopt: is_windows
3729
? `ocamlopt.opt.exe`
3830
: `../native/${ocamlVersion}/bin/ocamlopt.opt`,
39-
ext: sys_extension,
4031
INCL: ocamlVersion,
4132
isWin: is_windows
4233
});
4334

4435
fs.writeFileSync(path.join(root, "lib", prebuilt), content, "ascii");
45-
process.env.PATH=
46-
`${path.join(__dirname,'..','vendor','ninja','snapshot')}${path.delimiter}${process.env.PATH}`
47-
let ninjaPath = `ninja${sys_extension}`
36+
process.env.PATH = `${path.join(__dirname, "..", process.platform)}${
37+
path.delimiter
38+
}${process.env.PATH}`;
39+
let ninjaPath = `ninja.exe`;
4840
cp.execSync(
49-
`${ninjaPath} -C lib -f ${prebuilt} -t clean && ${ninjaPath} -v -C lib -f ${prebuilt}`,
41+
`${ninjaPath} -C lib -f ${prebuilt} -v -t clean && ${ninjaPath} -v -C lib -f ${prebuilt}`,
5042
root_config
5143
);
5244
}
5345
if (!is_windows) {
54-
rebuild();
46+
if (!process.argv.includes("-noclean")) {
47+
rebuild();
48+
}
5549
require("./ninja.js").updateRelease();
5650
}
5751
var os = require("os");

0 commit comments

Comments
 (0)