Skip to content

Commit a08103b

Browse files
committed
Use Bloomberg's fork of ocaml compiler, no longer depend on diff
1 parent 1fba23e commit a08103b

9 files changed

+1225
-134992
lines changed

.gitmodules

-3
This file was deleted.

README.md

+15-6
Original file line numberDiff line numberDiff line change
@@ -53,31 +53,40 @@ Note that you have to clone this project with `--recursive` option, as the core
5353
### Linux and Mac OSX
5454

5555

56-
1. Apply the patch to OCaml compiler and build
56+
1. Build the patched OCaml Compiler
5757

58-
Please ignore the warnings generated by git apply
58+
Checkout the `master` branch in the [OCaml Repo](https://github.com/bloomberg/ocaml/tree/master)
59+
60+
For exmaple:
5961

6062
```sh
61-
cd ocaml
62-
git apply ../js.diff
63+
git clone https://github.com/bloomberg/ocaml
64+
cd ./ocaml
65+
git checkout master
6366
./configure -prefix `pwd`
6467
make world.opt
6568
make install
6669
```
6770

71+
The patched compiler is installed locally into your `$(pwd)/bin`
72+
directory, check if `ocamlc.opt` and `ocamlopt.opt` are there, add
73+
them into your `$(PATH)`.
74+
6875
2. Build OCamlScript Compiler
6976

7077
Assume that you have `ocamlopt.opt` in the `PATH`
7178
```sh
72-
cd ../jscomp
79+
cd ./jscomp
7380
ocamlopt.opt -I +compiler-libs -I bin -c bin/compiler.mli bin/compiler.ml
7481
ocamlopt.opt -g -linkall -o bin/osc -I +compiler-libs ocamlcommon.cmxa ocamlbytecomp.cmxa bin/compiler.cmx main.cmx
7582
```
7683

7784
Now you have a binary called `osc` under `jscomp/bin` directory,
7885
put it in your `PATH`.
7986

80-
87+
Our compiler is released as a single file so that for release-builds
88+
it does not need any build system(easier to be supported on Windows Platform).
89+
8190
3. Test
8291

8392
Create a file called `hello.ml`:

js.diff

-134,129
This file was deleted.

jscomp/bin/compiler.ml

+1,065-791
Large diffs are not rendered by default.

jscomp/j_helper.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ module Exp = struct
306306
match v.expression_desc with
307307
| Str (_, x) ->
308308
assert (String.length x = 1) ;
309-
int ~comment:("\"" ^ Ext_string.escaped x ^ "\"")
309+
int ~comment:(Printf.sprintf "%S" x )
310310
(Char.code x.[0])
311311
| Char_of_int v -> v
312312
| _ -> {comment; expression_desc = Char_to_int v }

jscomp/js_cmj_datasets.ml

+40-40
Large diffs are not rendered by default.

jscomp/tools/ocaml_pack.ml

+42
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,48 @@ include
601601
}, []))
602602
}])) : Parsetree.attribute))
603603
};
604+
{
605+
Parsetree.pstr_loc = _loc;
606+
pstr_desc =
607+
(Pstr_attribute
608+
(({ loc = _loc; txt = "ocaml.doc" },
609+
(PStr
610+
[{
611+
Parsetree.pstr_loc = _loc;
612+
pstr_desc =
613+
(Pstr_eval
614+
({
615+
pexp_loc = _loc;
616+
pexp_desc =
617+
(Pexp_constant
618+
(Const_string
619+
({|
620+
OCamlScript compiler
621+
Copyright (C) 2015-2016 Bloomberg Finance L.P.
622+
623+
This program is free software; you can redistribute it and/or modify
624+
it under the terms of the GNU Lesser General Public License as published by
625+
the Free Software Foundation, with linking exception;
626+
either version 2.1 of the License, or (at your option) any later version.
627+
628+
This program is distributed in the hope that it will be useful,
629+
but WITHOUT ANY WARRANTY; without even the implied warranty of
630+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
631+
GNU Lesser General Public License for more details.
632+
633+
You should have received a copy of the GNU Lesser General Public License
634+
along with this program; if not, write to the Free Software
635+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
636+
637+
638+
Author: Hongbo Zhang
639+
640+
|},
641+
None)));
642+
pexp_attributes = []
643+
}, []))
644+
}])) : Parsetree.attribute))
645+
};
604646
str_item]
605647
end
606648
end

jscomp/tools/ocaml_pack_main.ml

+62-21
Original file line numberDiff line numberDiff line change
@@ -47,27 +47,68 @@ let _ =
4747

4848
let str_item = Ocaml_extract.process files in
4949
Pprintast.structure Format.std_formatter
50-
[{
51-
Parsetree.pstr_loc = _loc;
52-
pstr_desc =
53-
(Pstr_attribute
54-
(({ loc = _loc; txt = "warning" },
55-
(PStr
56-
[{
57-
Parsetree.pstr_loc = _loc;
58-
pstr_desc =
59-
(Pstr_eval
60-
({
61-
pexp_loc = _loc;
62-
pexp_desc =
63-
(Pexp_constant (** my personal preferrence *)
64-
(Const_string ("-a", None)));
65-
pexp_attributes = []
66-
}, []))
67-
}])) : Parsetree.attribute))
68-
};
69-
str_item
70-
]
50+
[
51+
{
52+
Parsetree.pstr_loc = _loc;
53+
pstr_desc =
54+
(Pstr_attribute
55+
(({ loc = _loc; txt = "warning" },
56+
(PStr
57+
[{
58+
Parsetree.pstr_loc = _loc;
59+
pstr_desc =
60+
(Pstr_eval
61+
({
62+
pexp_loc = _loc;
63+
pexp_desc =
64+
(Pexp_constant (** my personal preferrence *)
65+
(Const_string ("-a", None)));
66+
pexp_attributes = []
67+
}, []))
68+
}])) : Parsetree.attribute))
69+
} ;
70+
{
71+
Parsetree.pstr_loc = _loc;
72+
pstr_desc =
73+
(Pstr_attribute
74+
(({ loc = _loc; txt = "ocaml.doc"},
75+
(PStr
76+
[{
77+
Parsetree.pstr_loc = _loc;
78+
pstr_desc =
79+
(Pstr_eval
80+
({
81+
pexp_loc = _loc;
82+
pexp_desc =
83+
(Pexp_constant (** Copy right header *)
84+
(Const_string ({|
85+
OCamlScript compiler
86+
Copyright (C) 2015-2016 Bloomberg Finance L.P.
87+
88+
This program is free software; you can redistribute it and/or modify
89+
it under the terms of the GNU Lesser General Public License as published by
90+
the Free Software Foundation, with linking exception;
91+
either version 2.1 of the License, or (at your option) any later version.
92+
93+
This program is distributed in the hope that it will be useful,
94+
but WITHOUT ANY WARRANTY; without even the implied warranty of
95+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
96+
GNU Lesser General Public License for more details.
97+
98+
You should have received a copy of the GNU Lesser General Public License
99+
along with this program; if not, write to the Free Software
100+
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
101+
102+
103+
Author: Hongbo Zhang
104+
105+
|}, None)));
106+
pexp_attributes = []
107+
}, []))
108+
}])) : Parsetree.attribute))
109+
};
110+
str_item
111+
]
71112

72113
(* local variables: *)
73114
(* compile-command: "ocamlbuild -no-hygiene -cflags -annot -use-ocamlfind -pkg compiler-libs.common ocaml_pack_main.byte " *)

ocaml

-1
This file was deleted.

0 commit comments

Comments
 (0)