Skip to content
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*~
_build
_esy
*.exe
*.obj
*.out
Expand Down
75 changes: 75 additions & 0 deletions esy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"name": "bs-platform",
"version": "5.2.0-dev.2",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need maintain this, if so, which other fields do we need watch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for "dependencies", "devDependencies", "resolutions" and "esy" it's a copy of the normal package.json, I think we could just remove most fields if we don't want them here.

"dependencies": {
"ocaml": "4.02.3000+BS"
},
"devDependencies": {
"ocaml": "4.02.3000+BS"
},
"resolutions": {
"ocaml": "ulrikstrid/ocaml:package.json#e433d5b3fbe8963ac98257d1ed3b32c01515e07d"
},
"esy": {
"buildsInSource": true,
"build": [
["node", "./scripts/install.js"],
["cp", "-r", "-f", "#{self.root / 'bsconfig.json'}", "#{self.install}"],
["cp", "-r", "-f", "#{self.root / 'esy.json'}", "#{self.install}"],
["cp", "-r", "-f", "#{self.root / 'package.json'}", "#{self.install}"],
["cp", "-r", "-f", "#{self.root / 'jscomp'}", "#{self.install}"],
["cp", "-r", "-f", "#{self.root / 'lib'}", "#{self.install}"],
["cp", "-r", "-f", "#{self.root / 'scripts'}", "#{self.install}"],
["cp", "-r", "-f", "#{self.root / 'vendor'}", "#{self.install}"]
],
"buildEnv": {
"ESY": "true"
},
"exportedEnv": {
"OCAMLLIB": {
"val": "#{self.lib / 'ocaml' }",
"scope": "global"
},
"CAML_LD_LIBRARY_PATH": {
"val": "#{self.lib / 'ocaml' / 'stublibs' : self.lib / 'ocaml' : $CAML_LD_LIBRARY_PATH}",
"scope": "global"
},
"OCAML_TOPLEVEL_PATH": {
"val": "#{self.lib / 'ocaml' }",
"scope": "global"
},
"bs_custom_resolution": {
"val": "true",
"scope": "global"
},
"bs_platform__install": {
"val": "#{self.install}",
"scope": "global"
},
"PATH": {
"val": "#{self.lib : $PATH}",
"scope": "global"
}
}
},
"description": "bucklescript compiler for use in esy, ocaml standard libary by bucklescript and its required runtime support",
"repository": {
"type": "git",
"url": "git+https://github.com/bucklescript/bucklescript.git"
},
"keywords": ["ocaml", "bucklescript", "stdlib", "functional programming"],
"author": {
"name": "Hongbo Zhang"
},
"maintainers": [
{
"name": "hongbo_zhang",
"email": "bobzhang1988@gmail.com"
}
],
"license": "SEE LICENSE IN LICENSE",
"bugs": {
"url": "https://github.com/bucklescript/bucklescript/issues"
},
"homepage": "https://github.com/bucklescript/bucklescript#readme"
}
3 changes: 3 additions & 0 deletions esy.lock/.gitattributes

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions esy.lock/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions esy.lock/index.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion scripts/buildocaml.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ var cp = require("child_process");
var path = require("path");
var fs = require("fs");

var ocamlSrcDir = path.join(__dirname, "..", "ocaml");
var ocamlSrcDir =
process.env.ESY === "true"
? process.env.OCAMLLIB
: path.join(__dirname, "..", "ocaml");
var ocamlVersionFilePath = path.join(ocamlSrcDir, "VERSION");

/**
Expand Down
19 changes: 11 additions & 8 deletions scripts/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,17 @@ function provideCompiler() {
return myVersion;
} else {
myVersion = require("./buildocaml.js").getVersionPrefix();
var ocamlopt = path.join(
__dirname,
"..",
"native",
myVersion,
"bin",
"ocamlopt.opt"
);
var ocamlopt =
process.env.ESY === "true"
? "ocamlopt.opt"
: path.join(
__dirname,
"..",
"native",
myVersion,
"bin",
"ocamlopt.opt"
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

if (!fs.existsSync(ocamlopt)) {
require("./buildocaml.js").build(true);
} else {
Expand Down