Skip to content

Commit ff81596

Browse files
committed
Use install.js when building for release
1 parent 20f6f9f commit ff81596

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

esy.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"esy": {
1414
"buildsInSource": true,
15-
"build": [
15+
"buildDev": [
1616
"echo 'config'",
1717
["node", "./scripts/ninja.js", "config", "-env"],
1818
"echo 'build'",
@@ -26,6 +26,10 @@
2626
["cp", "-r", "-f", "#{self.root / 'scripts'}", "#{self.install}"],
2727
["cp", "-r", "-f", "#{self.root / 'vendor'}", "#{self.install}"]
2828
],
29+
"build": [["node", "./scripts/install.js"]],
30+
"buildEnv": {
31+
"ESY": "true"
32+
},
2933
"exportedEnv": {
3034
"OCAMLLIB": {
3135
"val": "#{self.lib / 'ocaml' }",

scripts/buildocaml.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ var cp = require("child_process");
44
var path = require("path");
55
var fs = require("fs");
66

7-
var ocamlSrcDir = path.join(__dirname, "..", "ocaml");
7+
var ocamlSrcDir =
8+
process.env.ESY === "true"
9+
? process.env.OCAMLLIB
10+
: path.join(__dirname, "..", "ocaml");
811
var ocamlVersionFilePath = path.join(ocamlSrcDir, "VERSION");
912

1013
/**

scripts/install.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,17 @@ function provideCompiler() {
310310
return myVersion;
311311
} else {
312312
myVersion = require("./buildocaml.js").getVersionPrefix();
313-
var ocamlopt = path.join(
314-
__dirname,
315-
"..",
316-
"native",
317-
myVersion,
318-
"bin",
319-
"ocamlopt.opt"
320-
);
313+
var ocamlopt =
314+
process.env.ESY === "true"
315+
? "ocamlopt.opt"
316+
: path.join(
317+
__dirname,
318+
"..",
319+
"native",
320+
myVersion,
321+
"bin",
322+
"ocamlopt.opt"
323+
);
321324
if (!fs.existsSync(ocamlopt)) {
322325
require("./buildocaml.js").build(true);
323326
} else {

0 commit comments

Comments
 (0)