Skip to content
Newer
Older
100644 647 lines (519 sloc) 17.5 KB
0d5f017 Add autogenerated OASIS files
David Scott authored
1 (* OASIS_START *)
3d18bc9 @talex5 Added profiling/tracing support
talex5 authored
2 (* DO NOT EDIT (digest: fdc816e08fa029862b625a929a5f7dbe) *)
0d5f017 Add autogenerated OASIS files
David Scott authored
3 module OASISGettext = struct
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
4 (* # 22 "src/oasis/OASISGettext.ml" *)
5
0d5f017 Add autogenerated OASIS files
David Scott authored
6
7 let ns_ str =
8 str
9
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
10
0d5f017 Add autogenerated OASIS files
David Scott authored
11 let s_ str =
12 str
13
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
14
15 let f_ (str: ('a, 'b, 'c, 'd) format4) =
0d5f017 Add autogenerated OASIS files
David Scott authored
16 str
17
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
18
0d5f017 Add autogenerated OASIS files
David Scott authored
19 let fn_ fmt1 fmt2 n =
20 if n = 1 then
21 fmt1^^""
22 else
23 fmt2^^""
24
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
25
0d5f017 Add autogenerated OASIS files
David Scott authored
26 let init =
27 []
28
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
29
0d5f017 Add autogenerated OASIS files
David Scott authored
30 end
31
32 module OASISExpr = struct
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
33 (* # 22 "src/oasis/OASISExpr.ml" *)
34
35
0d5f017 Add autogenerated OASIS files
David Scott authored
36
37
38
39 open OASISGettext
40
41
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
42 type test = string
43
44
45 type flag = string
46
0d5f017 Add autogenerated OASIS files
David Scott authored
47
48 type t =
49 | EBool of bool
50 | ENot of t
51 | EAnd of t * t
52 | EOr of t * t
53 | EFlag of flag
54 | ETest of test * string
55
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
56
57
58 type 'a choices = (t * 'a) list
59
0d5f017 Add autogenerated OASIS files
David Scott authored
60
61 let eval var_get t =
62 let rec eval' =
63 function
64 | EBool b ->
65 b
66
67 | ENot e ->
68 not (eval' e)
69
70 | EAnd (e1, e2) ->
71 (eval' e1) && (eval' e2)
72
73 | EOr (e1, e2) ->
74 (eval' e1) || (eval' e2)
75
76 | EFlag nm ->
77 let v =
78 var_get nm
79 in
80 assert(v = "true" || v = "false");
81 (v = "true")
82
83 | ETest (nm, vl) ->
84 let v =
85 var_get nm
86 in
87 (v = vl)
88 in
89 eval' t
90
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
91
0d5f017 Add autogenerated OASIS files
David Scott authored
92 let choose ?printer ?name var_get lst =
93 let rec choose_aux =
94 function
95 | (cond, vl) :: tl ->
96 if eval var_get cond then
97 vl
98 else
99 choose_aux tl
100 | [] ->
101 let str_lst =
102 if lst = [] then
103 s_ "<empty>"
104 else
105 String.concat
106 (s_ ", ")
107 (List.map
108 (fun (cond, vl) ->
109 match printer with
110 | Some p -> p vl
111 | None -> s_ "<no printer>")
112 lst)
113 in
114 match name with
115 | Some nm ->
116 failwith
117 (Printf.sprintf
118 (f_ "No result for the choice list '%s': %s")
119 nm str_lst)
120 | None ->
121 failwith
122 (Printf.sprintf
123 (f_ "No result for a choice list: %s")
124 str_lst)
125 in
126 choose_aux (List.rev lst)
127
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
128
0d5f017 Add autogenerated OASIS files
David Scott authored
129 end
130
131
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
132 # 132 "myocamlbuild.ml"
0d5f017 Add autogenerated OASIS files
David Scott authored
133 module BaseEnvLight = struct
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
134 (* # 22 "src/base/BaseEnvLight.ml" *)
135
0d5f017 Add autogenerated OASIS files
David Scott authored
136
137 module MapString = Map.Make(String)
138
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
139
0d5f017 Add autogenerated OASIS files
David Scott authored
140 type t = string MapString.t
141
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
142
0d5f017 Add autogenerated OASIS files
David Scott authored
143 let default_filename =
144 Filename.concat
145 (Sys.getcwd ())
146 "setup.data"
147
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
148
0d5f017 Add autogenerated OASIS files
David Scott authored
149 let load ?(allow_empty=false) ?(filename=default_filename) () =
150 if Sys.file_exists filename then
151 begin
152 let chn =
153 open_in_bin filename
154 in
155 let st =
156 Stream.of_channel chn
157 in
158 let line =
159 ref 1
160 in
161 let st_line =
162 Stream.from
163 (fun _ ->
164 try
165 match Stream.next st with
166 | '\n' -> incr line; Some '\n'
167 | c -> Some c
168 with Stream.Failure -> None)
169 in
170 let lexer =
171 Genlex.make_lexer ["="] st_line
172 in
173 let rec read_file mp =
174 match Stream.npeek 3 lexer with
175 | [Genlex.Ident nm; Genlex.Kwd "="; Genlex.String value] ->
176 Stream.junk lexer;
177 Stream.junk lexer;
178 Stream.junk lexer;
179 read_file (MapString.add nm value mp)
180 | [] ->
181 mp
182 | _ ->
183 failwith
184 (Printf.sprintf
185 "Malformed data file '%s' line %d"
186 filename !line)
187 in
188 let mp =
189 read_file MapString.empty
190 in
191 close_in chn;
192 mp
193 end
194 else if allow_empty then
195 begin
196 MapString.empty
197 end
198 else
199 begin
200 failwith
201 (Printf.sprintf
202 "Unable to load environment, the file '%s' doesn't exist."
203 filename)
204 end
205
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
206
207 let rec var_expand str env =
208 let buff =
209 Buffer.create ((String.length str) * 2)
0d5f017 Add autogenerated OASIS files
David Scott authored
210 in
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
211 Buffer.add_substitute
212 buff
213 (fun var ->
214 try
215 var_expand (MapString.find var env) env
216 with Not_found ->
217 failwith
218 (Printf.sprintf
219 "No variable %s defined when trying to expand %S."
220 var
221 str))
222 str;
223 Buffer.contents buff
224
225
226 let var_get name env =
227 var_expand (MapString.find name env) env
228
0d5f017 Add autogenerated OASIS files
David Scott authored
229
230 let var_choose lst env =
231 OASISExpr.choose
232 (fun nm -> var_get nm env)
233 lst
234 end
235
236
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
237 # 237 "myocamlbuild.ml"
0d5f017 Add autogenerated OASIS files
David Scott authored
238 module MyOCamlbuildFindlib = struct
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
239 (* # 22 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *)
240
0d5f017 Add autogenerated OASIS files
David Scott authored
241
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
242 (** OCamlbuild extension, copied from
0d5f017 Add autogenerated OASIS files
David Scott authored
243 * http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild
244 * by N. Pouillard and others
245 *
246 * Updated on 2009/02/28
247 *
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
248 * Modified by Sylvain Le Gall
0d5f017 Add autogenerated OASIS files
David Scott authored
249 *)
250 open Ocamlbuild_plugin
251
3d18bc9 @talex5 Added profiling/tracing support
talex5 authored
252 type conf =
253 { no_automatic_syntax: bool;
254 }
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
255
0d5f017 Add autogenerated OASIS files
David Scott authored
256 (* these functions are not really officially exported *)
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
257 let run_and_read =
0d5f017 Add autogenerated OASIS files
David Scott authored
258 Ocamlbuild_pack.My_unix.run_and_read
259
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
260
261 let blank_sep_strings =
0d5f017 Add autogenerated OASIS files
David Scott authored
262 Ocamlbuild_pack.Lexers.blank_sep_strings
263
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
264
265 let exec_from_conf exec =
266 let exec =
267 let env_filename = Pathname.basename BaseEnvLight.default_filename in
268 let env = BaseEnvLight.load ~filename:env_filename ~allow_empty:true () in
269 try
270 BaseEnvLight.var_get exec env
271 with Not_found ->
272 Printf.eprintf "W: Cannot get variable %s\n" exec;
273 exec
0d5f017 Add autogenerated OASIS files
David Scott authored
274 in
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
275 let fix_win32 str =
276 if Sys.os_type = "Win32" then begin
277 let buff = Buffer.create (String.length str) in
278 (* Adapt for windowsi, ocamlbuild + win32 has a hard time to handle '\\'.
279 *)
280 String.iter
281 (fun c -> Buffer.add_char buff (if c = '\\' then '/' else c))
282 str;
283 Buffer.contents buff
284 end else begin
285 str
286 end
a146bb9 bump version to 0.3.0
David Scott authored
287 in
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
288 fix_win32 exec
289
290 let split s ch =
291 let buf = Buffer.create 13 in
292 let x = ref [] in
293 let flush () =
294 x := (Buffer.contents buf) :: !x;
295 Buffer.clear buf
296 in
297 String.iter
298 (fun c ->
299 if c = ch then
300 flush ()
301 else
302 Buffer.add_char buf c)
303 s;
304 flush ();
305 List.rev !x
306
0d5f017 Add autogenerated OASIS files
David Scott authored
307
308 let split_nl s = split s '\n'
309
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
310
0d5f017 Add autogenerated OASIS files
David Scott authored
311 let before_space s =
312 try
313 String.before s (String.index s ' ')
314 with Not_found -> s
315
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
316 (* ocamlfind command *)
317 let ocamlfind x = S[Sh (exec_from_conf "ocamlfind"); x]
318
319 (* This lists all supported packages. *)
0d5f017 Add autogenerated OASIS files
David Scott authored
320 let find_packages () =
3d18bc9 @talex5 Added profiling/tracing support
talex5 authored
321 List.map before_space (split_nl & run_and_read (exec_from_conf "ocamlfind" ^ " list"))
0d5f017 Add autogenerated OASIS files
David Scott authored
322
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
323
324 (* Mock to list available syntaxes. *)
0d5f017 Add autogenerated OASIS files
David Scott authored
325 let find_syntaxes () = ["camlp4o"; "camlp4r"]
326
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
327
328 let well_known_syntax = [
329 "camlp4.quotations.o";
330 "camlp4.quotations.r";
331 "camlp4.exceptiontracer";
332 "camlp4.extend";
333 "camlp4.foldgenerator";
334 "camlp4.listcomprehension";
335 "camlp4.locationstripper";
336 "camlp4.macro";
337 "camlp4.mapgenerator";
338 "camlp4.metagenerator";
339 "camlp4.profiler";
340 "camlp4.tracer"
341 ]
342
0d5f017 Add autogenerated OASIS files
David Scott authored
343
3d18bc9 @talex5 Added profiling/tracing support
talex5 authored
344 let dispatch conf =
0d5f017 Add autogenerated OASIS files
David Scott authored
345 function
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
346 | After_options ->
347 (* By using Before_options one let command line options have an higher
348 * priority on the contrary using After_options will guarantee to have
349 * the higher priority override default commands by ocamlfind ones *)
0d5f017 Add autogenerated OASIS files
David Scott authored
350 Options.ocamlc := ocamlfind & A"ocamlc";
351 Options.ocamlopt := ocamlfind & A"ocamlopt";
352 Options.ocamldep := ocamlfind & A"ocamldep";
353 Options.ocamldoc := ocamlfind & A"ocamldoc";
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
354 Options.ocamlmktop := ocamlfind & A"ocamlmktop";
355 Options.ocamlmklib := ocamlfind & A"ocamlmklib"
356
0d5f017 Add autogenerated OASIS files
David Scott authored
357 | After_rules ->
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
358
359 (* When one link an OCaml library/binary/package, one should use
360 * -linkpkg *)
0d5f017 Add autogenerated OASIS files
David Scott authored
361 flag ["ocaml"; "link"; "program"] & A"-linkpkg";
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
362
3d18bc9 @talex5 Added profiling/tracing support
talex5 authored
363 if not (conf.no_automatic_syntax) then begin
364 (* For each ocamlfind package one inject the -package option when
365 * compiling, computing dependencies, generating documentation and
366 * linking. *)
367 List.iter
368 begin fun pkg ->
369 let base_args = [A"-package"; A pkg] in
370 (* TODO: consider how to really choose camlp4o or camlp4r. *)
371 let syn_args = [A"-syntax"; A "camlp4o"] in
372 let (args, pargs) =
373 (* Heuristic to identify syntax extensions: whether they end in
374 ".syntax"; some might not.
375 *)
376 if Filename.check_suffix pkg "syntax" ||
377 List.mem pkg well_known_syntax then
378 (syn_args @ base_args, syn_args)
379 else
380 (base_args, [])
381 in
382 flag ["ocaml"; "compile"; "pkg_"^pkg] & S args;
383 flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args;
384 flag ["ocaml"; "doc"; "pkg_"^pkg] & S args;
385 flag ["ocaml"; "link"; "pkg_"^pkg] & S base_args;
386 flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S args;
387
388 (* TODO: Check if this is allowed for OCaml < 3.12.1 *)
389 flag ["ocaml"; "compile"; "package("^pkg^")"] & S pargs;
390 flag ["ocaml"; "ocamldep"; "package("^pkg^")"] & S pargs;
391 flag ["ocaml"; "doc"; "package("^pkg^")"] & S pargs;
392 flag ["ocaml"; "infer_interface"; "package("^pkg^")"] & S pargs;
393 end
394 (find_packages ());
395 end;
0d5f017 Add autogenerated OASIS files
David Scott authored
396
397 (* Like -package but for extensions syntax. Morover -syntax is useless
398 * when linking. *)
399 List.iter begin fun syntax ->
400 flag ["ocaml"; "compile"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
401 flag ["ocaml"; "ocamldep"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
402 flag ["ocaml"; "doc"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
403 flag ["ocaml"; "infer_interface"; "syntax_"^syntax] &
404 S[A"-syntax"; A syntax];
0d5f017 Add autogenerated OASIS files
David Scott authored
405 end (find_syntaxes ());
406
407 (* The default "thread" tag is not compatible with ocamlfind.
408 * Indeed, the default rules add the "threads.cma" or "threads.cmxa"
409 * options when using this tag. When using the "-linkpkg" option with
410 * ocamlfind, this module will then be added twice on the command line.
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
411 *
0d5f017 Add autogenerated OASIS files
David Scott authored
412 * To solve this, one approach is to add the "-thread" option when using
413 * the "threads" package using the previous plugin.
414 *)
415 flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]);
416 flag ["ocaml"; "pkg_threads"; "doc"] (S[A "-I"; A "+threads"]);
417 flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]);
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
418 flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"]);
419 flag ["ocaml"; "package(threads)"; "compile"] (S[A "-thread"]);
420 flag ["ocaml"; "package(threads)"; "doc"] (S[A "-I"; A "+threads"]);
421 flag ["ocaml"; "package(threads)"; "link"] (S[A "-thread"]);
422 flag ["ocaml"; "package(threads)"; "infer_interface"] (S[A "-thread"]);
0d5f017 Add autogenerated OASIS files
David Scott authored
423
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
424 | _ ->
0d5f017 Add autogenerated OASIS files
David Scott authored
425 ()
426 end
427
428 module MyOCamlbuildBase = struct
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
429 (* # 22 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
430
0d5f017 Add autogenerated OASIS files
David Scott authored
431
432 (** Base functions for writing myocamlbuild.ml
433 @author Sylvain Le Gall
434 *)
435
436
437
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
438
439
0d5f017 Add autogenerated OASIS files
David Scott authored
440 open Ocamlbuild_plugin
441 module OC = Ocamlbuild_pack.Ocaml_compiler
442
443
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
444 type dir = string
445 type file = string
446 type name = string
447 type tag = string
448
449
450 (* # 62 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
451
0d5f017 Add autogenerated OASIS files
David Scott authored
452
453 type t =
454 {
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
455 lib_ocaml: (name * dir list * string list) list;
456 lib_c: (name * dir * file list) list;
0d5f017 Add autogenerated OASIS files
David Scott authored
457 flags: (tag list * (spec OASISExpr.choices)) list;
458 (* Replace the 'dir: include' from _tags by a precise interdepends in
459 * directory.
460 *)
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
461 includes: (dir * dir list) list;
462 }
463
0d5f017 Add autogenerated OASIS files
David Scott authored
464
465 let env_filename =
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
466 Pathname.basename
0d5f017 Add autogenerated OASIS files
David Scott authored
467 BaseEnvLight.default_filename
468
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
469
0d5f017 Add autogenerated OASIS files
David Scott authored
470 let dispatch_combine lst =
471 fun e ->
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
472 List.iter
0d5f017 Add autogenerated OASIS files
David Scott authored
473 (fun dispatch -> dispatch e)
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
474 lst
475
0d5f017 Add autogenerated OASIS files
David Scott authored
476
477 let tag_libstubs nm =
478 "use_lib"^nm^"_stubs"
479
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
480
0d5f017 Add autogenerated OASIS files
David Scott authored
481 let nm_libstubs nm =
482 nm^"_stubs"
483
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
484
485 let dispatch t e =
486 let env =
487 BaseEnvLight.load
488 ~filename:env_filename
0d5f017 Add autogenerated OASIS files
David Scott authored
489 ~allow_empty:true
490 ()
491 in
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
492 match e with
0d5f017 Add autogenerated OASIS files
David Scott authored
493 | Before_options ->
494 let no_trailing_dot s =
495 if String.length s >= 1 && s.[0] = '.' then
496 String.sub s 1 ((String.length s) - 1)
497 else
498 s
499 in
500 List.iter
501 (fun (opt, var) ->
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
502 try
0d5f017 Add autogenerated OASIS files
David Scott authored
503 opt := no_trailing_dot (BaseEnvLight.var_get var env)
504 with Not_found ->
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
505 Printf.eprintf "W: Cannot get variable %s\n" var)
0d5f017 Add autogenerated OASIS files
David Scott authored
506 [
507 Options.ext_obj, "ext_obj";
508 Options.ext_lib, "ext_lib";
509 Options.ext_dll, "ext_dll";
510 ]
511
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
512 | After_rules ->
0d5f017 Add autogenerated OASIS files
David Scott authored
513 (* Declare OCaml libraries *)
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
514 List.iter
0d5f017 Add autogenerated OASIS files
David Scott authored
515 (function
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
516 | nm, [], intf_modules ->
517 ocaml_lib nm;
518 let cmis =
519 List.map (fun m -> (String.uncapitalize m) ^ ".cmi")
520 intf_modules in
521 dep ["ocaml"; "link"; "library"; "file:"^nm^".cma"] cmis
522 | nm, dir :: tl, intf_modules ->
0d5f017 Add autogenerated OASIS files
David Scott authored
523 ocaml_lib ~dir:dir (dir^"/"^nm);
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
524 List.iter
525 (fun dir ->
0d5f017 Add autogenerated OASIS files
David Scott authored
526 List.iter
527 (fun str ->
528 flag ["ocaml"; "use_"^nm; str] (S[A"-I"; P dir]))
529 ["compile"; "infer_interface"; "doc"])
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
530 tl;
531 let cmis =
532 List.map (fun m -> dir^"/"^(String.uncapitalize m)^".cmi")
533 intf_modules in
534 dep ["ocaml"; "link"; "library"; "file:"^dir^"/"^nm^".cma"]
535 cmis)
0d5f017 Add autogenerated OASIS files
David Scott authored
536 t.lib_ocaml;
537
538 (* Declare directories dependencies, replace "include" in _tags. *)
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
539 List.iter
0d5f017 Add autogenerated OASIS files
David Scott authored
540 (fun (dir, include_dirs) ->
541 Pathname.define_context dir include_dirs)
542 t.includes;
543
544 (* Declare C libraries *)
545 List.iter
546 (fun (lib, dir, headers) ->
547 (* Handle C part of library *)
548 flag ["link"; "library"; "ocaml"; "byte"; tag_libstubs lib]
549 (S[A"-dllib"; A("-l"^(nm_libstubs lib)); A"-cclib";
550 A("-l"^(nm_libstubs lib))]);
551
552 flag ["link"; "library"; "ocaml"; "native"; tag_libstubs lib]
553 (S[A"-cclib"; A("-l"^(nm_libstubs lib))]);
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
554
0d5f017 Add autogenerated OASIS files
David Scott authored
555 flag ["link"; "program"; "ocaml"; "byte"; tag_libstubs lib]
556 (S[A"-dllib"; A("dll"^(nm_libstubs lib))]);
557
558 (* When ocaml link something that use the C library, then one
559 need that file to be up to date.
3d18bc9 @talex5 Added profiling/tracing support
talex5 authored
560 This holds both for programs and for libraries.
0d5f017 Add autogenerated OASIS files
David Scott authored
561 *)
3d18bc9 @talex5 Added profiling/tracing support
talex5 authored
562 dep ["link"; "ocaml"; tag_libstubs lib]
563 [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)];
0d5f017 Add autogenerated OASIS files
David Scott authored
564
3d18bc9 @talex5 Added profiling/tracing support
talex5 authored
565 dep ["compile"; "ocaml"; tag_libstubs lib]
566 [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)];
0d5f017 Add autogenerated OASIS files
David Scott authored
567
568 (* TODO: be more specific about what depends on headers *)
569 (* Depends on .h files *)
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
570 dep ["compile"; "c"]
0d5f017 Add autogenerated OASIS files
David Scott authored
571 headers;
572
573 (* Setup search path for lib *)
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
574 flag ["link"; "ocaml"; "use_"^lib]
0d5f017 Add autogenerated OASIS files
David Scott authored
575 (S[A"-I"; P(dir)]);
576 )
577 t.lib_c;
578
579 (* Add flags *)
580 List.iter
581 (fun (tags, cond_specs) ->
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
582 let spec = BaseEnvLight.var_choose cond_specs env in
583 let rec eval_specs =
584 function
585 | S lst -> S (List.map eval_specs lst)
586 | A str -> A (BaseEnvLight.var_expand str env)
587 | spec -> spec
0d5f017 Add autogenerated OASIS files
David Scott authored
588 in
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
589 flag tags & (eval_specs spec))
0d5f017 Add autogenerated OASIS files
David Scott authored
590 t.flags
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
591 | _ ->
0d5f017 Add autogenerated OASIS files
David Scott authored
592 ()
593
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
594
3d18bc9 @talex5 Added profiling/tracing support
talex5 authored
595 let dispatch_default conf t =
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
596 dispatch_combine
0d5f017 Add autogenerated OASIS files
David Scott authored
597 [
598 dispatch t;
3d18bc9 @talex5 Added profiling/tracing support
talex5 authored
599 MyOCamlbuildFindlib.dispatch conf;
0d5f017 Add autogenerated OASIS files
David Scott authored
600 ]
601
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
602
0d5f017 Add autogenerated OASIS files
David Scott authored
603 end
604
605
3d18bc9 @talex5 Added profiling/tracing support
talex5 authored
606 # 606 "myocamlbuild.ml"
0d5f017 Add autogenerated OASIS files
David Scott authored
607 open Ocamlbuild_plugin;;
608 let package_default =
609 {
9e8fb47 Update _oasis and regenerate files
David Scott authored
610 MyOCamlbuildBase.lib_ocaml =
fce6a4c Move the xen protocol rings (xenstore, console) into a subpackage
David Scott authored
611 [
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
612 ("shared_memory_ring", ["lib"], []);
613 ("console_ring", ["xen"], []);
614 ("xenstore_ring", ["xen"], []);
615 ("lwt_shared_memory_ring", ["lwt"], [])
fce6a4c Move the xen protocol rings (xenstore, console) into a subpackage
David Scott authored
616 ];
5119943 Fix up the build with the minimal amount of C headers
David Scott authored
617 lib_c =
618 [
fb314fb Move the C xenstore/console stubs to the test directory and out of th…
David Scott authored
619 ("shared_memory_ring", "lib", ["lib/barrier.h"]);
620 ("ring_test",
621 "lib_test",
622 [
623 "lib_test/console.h";
624 "lib_test/xenstore.h";
625 "lib_test/barrier.h"
626 ])
5119943 Fix up the build with the minimal amount of C headers
David Scott authored
627 ];
0d5f017 Add autogenerated OASIS files
David Scott authored
628 flags = [];
b9d9b44 Update _oasis and autogenerated files
David Scott authored
629 includes =
fce6a4c Move the xen protocol rings (xenstore, console) into a subpackage
David Scott authored
630 [
631 ("xen", ["lib"]);
632 ("lwt_test", ["lib"; "lwt"]);
633 ("lwt", ["lib"]);
de254bd Add new example to OASIS
David Scott authored
634 ("lib_test", ["lib"; "xen"]);
635 ("examples", ["lib"; "lwt"])
306369c [xen] add {read,write} to go along with unsafe_{read,write}. Release …
David Scott authored
636 ]
637 }
0d5f017 Add autogenerated OASIS files
David Scott authored
638 ;;
639
3d18bc9 @talex5 Added profiling/tracing support
talex5 authored
640 let conf = {MyOCamlbuildFindlib.no_automatic_syntax = false}
641
642 let dispatch_default = MyOCamlbuildBase.dispatch_default conf package_default;;
0d5f017 Add autogenerated OASIS files
David Scott authored
643
3d18bc9 @talex5 Added profiling/tracing support
talex5 authored
644 # 645 "myocamlbuild.ml"
0d5f017 Add autogenerated OASIS files
David Scott authored
645 (* OASIS_STOP *)
646 Ocamlbuild_plugin.dispatch dispatch_default;;
Something went wrong with that request. Please try again.