@@ -104,13 +104,6 @@ let from_cmi (files : string list) (output_file : string) =
104
104
let content =
105
105
Marshal. to_string
106
106
cmi
107
- (* cmi_name, crcs can be saved, but only a tiny bit *)
108
- (* (cmi.cmi_sign) *)
109
- (* (Array.of_list cmi.cmi_sign) *)
110
- (* ({ with
111
- (* cmi_crcs = [] *)
112
- cmi_flags = []
113
- }) *)
114
107
[] in
115
108
Printf. sprintf {|% S (* %d *) | } module_name (String. length content) ,
116
109
Printf. sprintf {| (* %s *) % S | } module_name content) in
@@ -141,6 +134,11 @@ let stdlib = "stdlib-406"
141
134
let (// ) = Filename. concat
142
135
let (|~ ) = Ext_string. contain_substring
143
136
137
+ let release_cmi = Array. exists ((= ) " -release" ) Sys. argv
138
+ let () =
139
+ if release_cmi then
140
+ print_endline " collecting cmi from ../lib/ocaml in release mode"
141
+
144
142
let () =
145
143
let cmj_files =
146
144
(
@@ -150,14 +148,18 @@ let () =
150
148
from_cmj cmj_files
151
149
(Filename. concat " main" " builtin_cmj_datasets.ml" );
152
150
let cmi_files =
153
- " runtime" // " js.cmi" ::
154
- (get_files Literals. suffix_cmi stdlib @
155
- get_files Literals. suffix_cmi " others" )
156
- |> List. filter (fun x ->
157
- x|~ " js_internalOO" ||
158
- x|~ " camlinternal" ||
159
- not (x |~ " internal" ))
151
+ if release_cmi then
152
+ get_files Literals. suffix_cmi (" .." // " lib" // " ocaml" )
153
+ else
154
+ " runtime" // " js.cmi" ::
155
+ (get_files Literals. suffix_cmi stdlib @
156
+ get_files Literals. suffix_cmi " others" )
157
+ |> List. filter (fun x ->
158
+ x|~ " js_internalOO" ||
159
+ x|~ " camlinternal" ||
160
+ not (x |~ " internal" ))
160
161
in
161
- from_cmi cmi_files
162
+ from_cmi
163
+ cmi_files
162
164
(Filename. concat " main" " builtin_cmi_datasets.ml" )
163
165
0 commit comments