Skip to content

Commit 5d11fb0

Browse files
authored
Merge pull request #3825 from ulrikstrid/build-with-esy
Build with esy
2 parents 1223c8f + 8abe4d6 commit 5d11fb0

File tree

7 files changed

+132
-9
lines changed

7 files changed

+132
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*~
22
_build
3+
_esy
34
*.exe
45
*.obj
56
*.out

esy.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "bs-platform",
3+
"version": "5.2.0-dev.2",
4+
"dependencies": {
5+
"ocaml": "4.02.3000+BS"
6+
},
7+
"devDependencies": {
8+
"ocaml": "4.02.3000+BS"
9+
},
10+
"resolutions": {
11+
"ocaml": "ulrikstrid/ocaml:package.json#e433d5b3fbe8963ac98257d1ed3b32c01515e07d"
12+
},
13+
"esy": {
14+
"buildsInSource": true,
15+
"build": [
16+
["node", "./scripts/install.js"],
17+
["cp", "-r", "-f", "#{self.root / 'bsconfig.json'}", "#{self.install}"],
18+
["cp", "-r", "-f", "#{self.root / 'esy.json'}", "#{self.install}"],
19+
["cp", "-r", "-f", "#{self.root / 'package.json'}", "#{self.install}"],
20+
["cp", "-r", "-f", "#{self.root / 'jscomp'}", "#{self.install}"],
21+
["cp", "-r", "-f", "#{self.root / 'lib'}", "#{self.install}"],
22+
["cp", "-r", "-f", "#{self.root / 'scripts'}", "#{self.install}"],
23+
["cp", "-r", "-f", "#{self.root / 'vendor'}", "#{self.install}"]
24+
],
25+
"buildEnv": {
26+
"ESY": "true"
27+
},
28+
"exportedEnv": {
29+
"OCAMLLIB": {
30+
"val": "#{self.lib / 'ocaml' }",
31+
"scope": "global"
32+
},
33+
"CAML_LD_LIBRARY_PATH": {
34+
"val": "#{self.lib / 'ocaml' / 'stublibs' : self.lib / 'ocaml' : $CAML_LD_LIBRARY_PATH}",
35+
"scope": "global"
36+
},
37+
"OCAML_TOPLEVEL_PATH": {
38+
"val": "#{self.lib / 'ocaml' }",
39+
"scope": "global"
40+
},
41+
"bs_custom_resolution": {
42+
"val": "true",
43+
"scope": "global"
44+
},
45+
"bs_platform__install": {
46+
"val": "#{self.install}",
47+
"scope": "global"
48+
},
49+
"PATH": {
50+
"val": "#{self.lib : $PATH}",
51+
"scope": "global"
52+
}
53+
}
54+
},
55+
"description": "bucklescript compiler for use in esy, ocaml standard libary by bucklescript and its required runtime support",
56+
"repository": {
57+
"type": "git",
58+
"url": "git+https://github.com/bucklescript/bucklescript.git"
59+
},
60+
"keywords": ["ocaml", "bucklescript", "stdlib", "functional programming"],
61+
"author": {
62+
"name": "Hongbo Zhang"
63+
},
64+
"maintainers": [
65+
{
66+
"name": "hongbo_zhang",
67+
"email": "[email protected]"
68+
}
69+
],
70+
"license": "SEE LICENSE IN LICENSE",
71+
"bugs": {
72+
"url": "https://github.com/bucklescript/bucklescript/issues"
73+
},
74+
"homepage": "https://github.com/bucklescript/bucklescript#readme"
75+
}

esy.lock/.gitattributes

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

esy.lock/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

esy.lock/index.json

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/buildocaml.js

Lines changed: 4 additions & 1 deletion
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

Lines changed: 11 additions & 8 deletions
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)