Skip to content

Commit 5cb5eec

Browse files
committed
Merge pull request #366 from mransan/patch-1
2 parents bfe147f + 0d3fe8b commit 5cb5eec

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

docs/Installation.md

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,37 @@
22

33
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.
44

5-
## Installing the BuckleScript OCaml compiler
5+
## Default installation procedure (using package managers)
6+
7+
### 1. OCaml compiler from opam (optional)
8+
9+
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.
610

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.
911
Once you have `opam` installed, ask `opam` to switch to using our version of the compiler:
1012

1113
```sh
1214
opam update
1315
opam switch ocaml-4.02.3+buckle-1
16+
eval `opam config env`
1417
```
1518

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):
1836

1937
For detailed build instructions, follow the directions in the [repo](https://github.com/bloomberg/ocaml). A simple build would look something like this:
2038

@@ -28,27 +46,18 @@ make install
2846
The patched compiler is installed locally into your `$(pwd)/bin`
2947
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`).
3048

31-
## Installing BuckleScript
49+
### 2. Installing BuckleScript
3250

3351
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.
3452

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-
4553
Download the source from the [repository](https://github.com/bloomberg/bucklescript/releases). Then run the following commands:
4654

4755
```sh
4856
cd ./jscomp
4957
make world
5058
```
5159
*******
60+
5261
At the end, you should have a binary called `bsc` under `jscomp/bin` directory,
5362
which you can add to your `$PATH`. You could also set an environment variable
5463
pointing to the stdlib, e.g. `BSC_LIB=/path/to/jscomp/stdlib` for ease of use.

0 commit comments

Comments
 (0)