Skip to content

Commit e507ad1

Browse files
committed
Patch ninja.js to handle building with env ocaml
1 parent 0b8f847 commit e507ad1

File tree

1 file changed

+33
-14
lines changed

1 file changed

+33
-14
lines changed

scripts/ninja.js

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ async function runtimeNinja(devmode = true) {
861861
var externalDeps = devmode ? [compilerTarget] : [];
862862
var ninjaOutput = devmode
863863
? useEnv
864-
? "env.ninja"
864+
? "build.ninja"
865865
: "build.ninja"
866866
: "release.ninja";
867867
var templateRuntimeRules = `
@@ -959,7 +959,7 @@ async function othersNinja(devmode = true) {
959959
var externalDeps = [runtimeTarget];
960960
var ninjaOutput = devmode
961961
? useEnv
962-
? "env.ninja"
962+
? "build.ninja"
963963
: "build.ninja"
964964
: "release.ninja";
965965
var ninjaCwd = "others";
@@ -1081,7 +1081,7 @@ async function stdlibNinja(devmode = true) {
10811081
var externalDeps = [othersTarget];
10821082
var ninjaOutput = devmode
10831083
? useEnv
1084-
? "env.ninja"
1084+
? "build.ninja"
10851085
: "build.ninja"
10861086
: "release.ninja";
10871087
var bsc_flags = "bsc_flags";
@@ -1224,7 +1224,7 @@ function baseName(x) {
12241224
* @returns {Promise<void>}
12251225
*/
12261226
async function testNinja() {
1227-
var ninjaOutput = useEnv ? "env.ninja" : "build.ninja";
1227+
var ninjaOutput = useEnv ? "build.ninja" : "build.ninja";
12281228
var ninjaCwd = `test`;
12291229
var templateTestRules = `
12301230
${BSC_COMPILER}
@@ -1394,16 +1394,25 @@ function updateRelease() {
13941394
function updateDev() {
13951395
if (useEnv) {
13961396
writeFileAscii(
1397-
path.join(jscompDir, "env.ninja"),
1397+
path.join(jscompDir, "build.ninja"),
13981398
`
13991399
${getEnnvConfigNinja()}
14001400
stdlib = ${version6() ? `stdlib-406` : `stdlib-402`}
14011401
subninja compilerEnv.ninja
1402-
subninja runtime/env.ninja
1403-
subninja others/env.ninja
1404-
subninja $stdlib/env.ninja
1405-
subninja test/env.ninja
1402+
subninja runtime/build.ninja
1403+
subninja others/build.ninja
1404+
subninja $stdlib/build.ninja
1405+
subninja test/build.ninja
14061406
build all: phony runtime others $stdlib test
1407+
`
1408+
);
1409+
writeFileAscii(
1410+
path.join(jscompDir, "..", "lib", "build.ninja"),
1411+
`
1412+
ocamlopt = ocamlopt.opt
1413+
ext = exe
1414+
INCL= ${version6() ? "4.06.1+BS" : "4.02.3+BS"}
1415+
include body.ninja
14071416
`
14081417
);
14091418
} else {
@@ -1492,6 +1501,7 @@ function getEnnvConfigNinja() {
14921501
ocamlopt = ocamlopt.opt
14931502
ocamllex = ocamllex.opt
14941503
ocamlmklib = ocamlmklib
1504+
ocaml = ocaml
14951505
`;
14961506
}
14971507

@@ -1750,7 +1760,7 @@ function main() {
17501760
switch (subcommand) {
17511761
case "build":
17521762
try {
1753-
cp.execFileSync(vendorNinjaPath, {
1763+
cp.execFileSync(path.resolve(jscompDir, vendorNinjaPath), {
17541764
encoding: "utf8",
17551765
cwd: jscompDir,
17561766
stdio: [0, 1, 2]
@@ -1782,10 +1792,19 @@ function main() {
17821792

17831793
break;
17841794
case "cleanbuild":
1785-
console.log(`run cleaning first`)
1786-
cp.execSync(`node ${__filename} clean`,{cwd:__dirname,stdio:[0,1,2]})
1787-
cp.execSync(`node ${__filename} config`,{cwd:__dirname,stdio:[0,1,2]})
1788-
cp.execSync(`node ${__filename} build`,{cwd:__dirname,stdio:[0,1,2]})
1795+
console.log(`run cleaning first`);
1796+
cp.execSync(`node ${__filename} clean`, {
1797+
cwd: __dirname,
1798+
stdio: [0, 1, 2]
1799+
});
1800+
cp.execSync(`node ${__filename} config`, {
1801+
cwd: __dirname,
1802+
stdio: [0, 1, 2]
1803+
});
1804+
cp.execSync(`node ${__filename} build`, {
1805+
cwd: __dirname,
1806+
stdio: [0, 1, 2]
1807+
});
17891808
break;
17901809
case "docs":
17911810
console.log(`building docs`);

0 commit comments

Comments
 (0)