You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Installation.md
+25-16Lines changed: 25 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,37 @@
2
2
3
3
To use BuckleScript, you need both, a specific version of the OCaml compiler (tweaked to make BuckleScript possible), and the BuckleScript software itself. The instructions below show how to install both of these using standard package managers as well as how to build from source for Unix/Linux systems. Build directions will be updated once Windows systems are supported.
When working with OCaml we recommend using [opam](https://opam.ocaml.org) package manager, available [here](https://opam.ocaml.org/doc/Install.html). You will benefit from the existing OCaml ecosystem.
6
10
7
-
### 1. Using opam
8
-
You can use the vanilla [opam](https://opam.ocaml.org) package manager, available [here](https://opam.ocaml.org/doc/Install.html), to access the OCaml compiler version necessary to use BuckleScript.
9
11
Once you have `opam` installed, ask `opam` to switch to using our version of the compiler:
10
12
11
13
```sh
12
14
opam update
13
15
opam switch ocaml-4.02.3+buckle-1
16
+
eval`opam config env`
14
17
```
15
18
16
-
### 2. Building from source
17
-
To build OCaml compiler from source, download the compiler source [here](https://github.com/bloomberg/ocaml/releases) (version 4.02.3+buckle-1):
19
+
> This step is optional. npm installation will build the compiler from source if not installed from opam
20
+
21
+
### 2. BuckleScript from npm (required)
22
+
23
+
The standard npm package management tool can be used to install BuckleScript. If you don't already have npm installed, follow the directions listed [here](https://docs.npmjs.com/getting-started/installing-node). Once npm is installed, run the following command:
24
+
25
+
```sh
26
+
npm install --save bs-platform
27
+
```
28
+
29
+
## Advanced installation procedure (from source)
30
+
31
+
BuckleScript has very little dependencies and building from source can easily be done.
32
+
33
+
### 1. OCaml compiler
34
+
35
+
To build OCaml compiler from source, download the modified OCaml compiler source [here](https://github.com/bloomberg/ocaml/releases) (version 4.02.3+buckle-1):
18
36
19
37
For detailed build instructions, follow the directions in the [repo](https://github.com/bloomberg/ocaml). A simple build would look something like this:
20
38
@@ -28,27 +46,18 @@ make install
28
46
The patched compiler is installed locally into your `$(pwd)/bin`
29
47
directory. To start using it temporarily, check if `ocamlc.opt` and `ocamlopt.opt` exist in `$(pwd)/bin`, and temporarily add the location to your `$(PATH)` (e.g. - `PATH=$(pwd)/bin:$PATH`).
30
48
31
-
## Installing BuckleScript
49
+
### 2. Installing BuckleScript
32
50
33
51
The following directions assume you already have the correct version of `ocamlopt.opt` in your `$PATH`, having followed the process described in the previous section.
34
52
35
-
### 1. Using npm
36
-
37
-
The standard npm package management tool can be used to install BuckleScript. If you don't already have npm installed, follow the directions listed [here](https://docs.npmjs.com/getting-started/installing-node). Once npm is installed, run the following command:
38
-
39
-
```sh
40
-
npm install --save bs-platform
41
-
```
42
-
43
-
### 2. Building from source
44
-
45
53
Download the source from the [repository](https://github.com/bloomberg/bucklescript/releases). Then run the following commands:
46
54
47
55
```sh
48
56
cd ./jscomp
49
57
make world
50
58
```
51
59
*******
60
+
52
61
At the end, you should have a binary called `bsc` under `jscomp/bin` directory,
53
62
which you can add to your `$PATH`. You could also set an environment variable
54
63
pointing to the stdlib, e.g. `BSC_LIB=/path/to/jscomp/stdlib` for ease of use.
0 commit comments