Codebase list postgresql-ocaml / 0e63fc9
Merge tag 'upstream/2.0.5' Upstream version 2.0.5 Stephane Glondu 10 years ago
11 changed file(s) with 1488 addition(s) and 441 deletion(s). Raw diff Collapse all Expand all
00 repo: 02a7076512f3f9a3175427da3d38d621c65dedd7
1 node: 2937b40bfc9227081d0df77468e8f875b0d1b5d9
1 node: aaeea3baa74dfe0b3bfc768c6773d5f651139cdb
22 branch: default
3 tag: release-2.0.4
3 tag: release-2.0.5
2929 4bd47ba4b2aa86695c79ca7f0a9fc70b7aff1d9a release-2.0.1
3030 d2f762df51ec03db259fd2c33f31cf16d8f8af13 release-2.0.2
3131 ad17e4d306f94eab4c6cbf75d67ff671bbd7e47c release-2.0.3
32 2937b40bfc9227081d0df77468e8f875b0d1b5d9 release-2.0.4
00 (* OASIS_START *)
1 (* DO NOT EDIT (digest: da66a27ffeed64edb08069c7a973785c) *)
1 (* DO NOT EDIT (digest: 5cd2d4ec584f25e55d5c8bc833957508) *)
22 This is the INSTALL file for the postgresql-ocaml distribution.
33
44 This package uses OASIS to generate its build system. See section OASIS for
2323 Uninstalling
2424 ============
2525
26 1. Go to the root of the package
26 1. Go to the root of the package
2727 2. Run 'ocaml setup.ml -uninstall'
2828
2929 OASIS
00 # OASIS_START
1 # DO NOT EDIT (digest: bc1e05bfc8b39b664f29dae8dbd3ebbb)
1 # DO NOT EDIT (digest: 7b2408909643717852b95f994b273fee)
22
33 SETUP = ocaml setup.ml
44
1111 test: setup.data build
1212 $(SETUP) -test $(TESTFLAGS)
1313
14 all:
14 all:
1515 $(SETUP) -all $(ALLFLAGS)
1616
1717 install: setup.data
2323 reinstall: setup.data
2424 $(SETUP) -reinstall $(REINSTALLFLAGS)
2525
26 clean:
26 clean:
2727 $(SETUP) -clean $(CLEANFLAGS)
2828
29 distclean:
29 distclean:
3030 $(SETUP) -distclean $(DISTCLEANFLAGS)
3131
3232 setup.data:
0 OASISFormat: 0.3
0 OASISFormat: 0.4
11 Name: postgresql-ocaml
2 Version: 2.0.4
2 Version: 2.0.5
33 Synopsis: postgresql-ocaml - bindings to the PostgreSQL library
44 Description: postgresql-ocaml offers library functions for accessing PostgreSQL databases
55 Authors: Alain Frisch <alain.frisch@lexifi.com>,
1616 #Categories:
1717 #FilesAB:
1818
19 Plugins: META (0.3), StdFiles (0.3), DevFiles (0.3)
19 Plugins: META (0.4), StdFiles (0.4), DevFiles (0.4)
2020 XStdFilesREADME: false
2121
2222 BuildTools: ocamldoc, ocamlbuild
9999
100100 Document API
101101 Title: API reference for PCRE-OCaml
102 Type: OCamlbuild (0.3)
102 Type: OCamlbuild (0.4)
103103 InstallDir: $docdir/api
104104 XOCamlbuildPath: .
105105 XOCamlbuildLibraries: postgresql
00 # OASIS_START
1 # DO NOT EDIT (digest: 43df01d3de74c562c3e79142c075ea8b)
2 # Ignore VCS directories, you can use the same kind of rule outside
3 # OASIS_START/STOP if you want to exclude directories that contains
1 # DO NOT EDIT (digest: 6130d565a6b8b66ced080f5471d86dbf)
2 # Ignore VCS directories, you can use the same kind of rule outside
3 # OASIS_START/STOP if you want to exclude directories that contains
44 # useless stuff for the build process
55 <**/.svn>: -traverse
66 <**/.svn>: not_hygienic
5656 <examples/*.ml{,i}>: pkg_threads
5757 <examples/*.ml{,i}>: pkg_bigarray
5858 # OASIS_STOP
59 <**/*.ml{,i}>: warn_A, warn_e, warn_r, annot
59
60 true: -traverse
61 <{lib,examples}/**>: traverse
62
63 <**/*.ml{,i}>: warn(Aer-44), strict_sequence, annot
64 "lib/postgresql.cmxs": use_libpostgresql_stubs
00 #!/bin/sh
11
22 # OASIS_START
3 # DO NOT EDIT (digest: 425187ed8bfdbdd207fd76392dd243a7)
3 # DO NOT EDIT (digest: dc86c2ad450f91ca10c931b6045d0499)
44 set -e
55
66 FST=true
7 for i in "$@"; do
7 for i in "$@"; do
88 if $FST; then
99 set --
1010 FST=false
00 # OASIS_START
1 # DO NOT EDIT (digest: ac3a9ed2ffccd5dac2907536b9ec9c12)
2 version = "2.0.4"
1 # DO NOT EDIT (digest: c31bdca2e2a0e283c7e021158379d1c2)
2 version = "2.0.5"
33 description = "postgresql-ocaml - bindings to the PostgreSQL library"
44 requires = "threads bigarray"
55 archive(byte) = "postgresql.cma"
00 (* OASIS_START *)
1 (* DO NOT EDIT (digest: c415f64fb402f4be093b032cd45ada65) *)
1 (* DO NOT EDIT (digest: d18e8cffec6dee519b54b3f70fc65adf) *)
22 module OASISGettext = struct
3 (* # 21 "src/oasis/OASISGettext.ml" *)
3 (* # 22 "src/oasis/OASISGettext.ml" *)
4
45
56 let ns_ str =
67 str
78
9
810 let s_ str =
911 str
1012
11 let f_ (str : ('a, 'b, 'c, 'd) format4) =
13
14 let f_ (str: ('a, 'b, 'c, 'd) format4) =
1215 str
16
1317
1418 let fn_ fmt1 fmt2 n =
1519 if n = 1 then
1721 else
1822 fmt2^^""
1923
24
2025 let init =
2126 []
2227
28
2329 end
2430
2531 module OASISExpr = struct
26 (* # 21 "src/oasis/OASISExpr.ml" *)
32 (* # 22 "src/oasis/OASISExpr.ml" *)
33
34
2735
2836
2937
3038 open OASISGettext
3139
40
3241 type test = string
3342
43
3444 type flag = string
45
3546
3647 type t =
3748 | EBool of bool
4253 | ETest of test * string
4354
4455
56
4557 type 'a choices = (t * 'a) list
58
4659
4760 let eval var_get t =
4861 let rec eval' =
7386 (v = vl)
7487 in
7588 eval' t
89
7690
7791 let choose ?printer ?name var_get lst =
7892 let rec choose_aux =
110124 in
111125 choose_aux (List.rev lst)
112126
127
113128 end
114129
115130
116 # 117 "myocamlbuild.ml"
131 # 132 "myocamlbuild.ml"
117132 module BaseEnvLight = struct
118 (* # 21 "src/base/BaseEnvLight.ml" *)
133 (* # 22 "src/base/BaseEnvLight.ml" *)
134
119135
120136 module MapString = Map.Make(String)
121137
138
122139 type t = string MapString.t
140
123141
124142 let default_filename =
125143 Filename.concat
126144 (Sys.getcwd ())
127145 "setup.data"
146
128147
129148 let load ?(allow_empty=false) ?(filename=default_filename) () =
130149 if Sys.file_exists filename then
182201 "Unable to load environment, the file '%s' doesn't exist."
183202 filename)
184203 end
204
185205
186206 let var_get name env =
187207 let rec var_expand str =
204224 in
205225 var_expand (MapString.find name env)
206226
227
207228 let var_choose lst env =
208229 OASISExpr.choose
209230 (fun nm -> var_get nm env)
211232 end
212233
213234
214 # 215 "myocamlbuild.ml"
235 # 236 "myocamlbuild.ml"
215236 module MyOCamlbuildFindlib = struct
216 (* # 21 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *)
217
218 (** OCamlbuild extension, copied from
237 (* # 22 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *)
238
239
240 (** OCamlbuild extension, copied from
219241 * http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild
220242 * by N. Pouillard and others
221243 *
222244 * Updated on 2009/02/28
223245 *
224 * Modified by Sylvain Le Gall
246 * Modified by Sylvain Le Gall
225247 *)
226248 open Ocamlbuild_plugin
227249
250
228251 (* these functions are not really officially exported *)
229 let run_and_read =
252 let run_and_read =
230253 Ocamlbuild_pack.My_unix.run_and_read
231254
232 let blank_sep_strings =
255
256 let blank_sep_strings =
233257 Ocamlbuild_pack.Lexers.blank_sep_strings
234258
259
235260 let split s ch =
236 let x =
237 ref []
261 let buf = Buffer.create 13 in
262 let x = ref [] in
263 let flush () =
264 x := (Buffer.contents buf) :: !x;
265 Buffer.clear buf
238266 in
239 let rec go s =
240 let pos =
241 String.index s ch
242 in
243 x := (String.before s pos)::!x;
244 go (String.after s (pos + 1))
245 in
246 try
247 go s
248 with Not_found -> !x
267 String.iter
268 (fun c ->
269 if c = ch then
270 flush ()
271 else
272 Buffer.add_char buf c)
273 s;
274 flush ();
275 List.rev !x
276
249277
250278 let split_nl s = split s '\n'
279
251280
252281 let before_space s =
253282 try
254283 String.before s (String.index s ' ')
255284 with Not_found -> s
256285
257 (* this lists all supported packages *)
286 (* ocamlfind command *)
287 let ocamlfind x =
288 let ocamlfind_prog =
289 let env_filename = Pathname.basename BaseEnvLight.default_filename in
290 let env = BaseEnvLight.load ~filename:env_filename ~allow_empty:true () in
291 try
292 BaseEnvLight.var_get "ocamlfind" env
293 with Not_found ->
294 Printf.eprintf "W: Cannot get variable ocamlfind";
295 "ocamlfind"
296 in
297 S[Sh ocamlfind_prog; x]
298
299 (* This lists all supported packages. *)
258300 let find_packages () =
259301 List.map before_space (split_nl & run_and_read "ocamlfind list")
260302
261 (* this is supposed to list available syntaxes, but I don't know how to do it. *)
303
304 (* Mock to list available syntaxes. *)
262305 let find_syntaxes () = ["camlp4o"; "camlp4r"]
263306
264 (* ocamlfind command *)
265 let ocamlfind x = S[A"ocamlfind"; x]
266307
267308 let dispatch =
268309 function
269310 | Before_options ->
270 (* by using Before_options one let command line options have an higher priority *)
271 (* on the contrary using After_options will guarantee to have the higher priority *)
272 (* override default commands by ocamlfind ones *)
311 (* By using Before_options one let command line options have an higher
312 * priority on the contrary using After_options will guarantee to have
313 * the higher priority override default commands by ocamlfind ones *)
273314 Options.ocamlc := ocamlfind & A"ocamlc";
274315 Options.ocamlopt := ocamlfind & A"ocamlopt";
275316 Options.ocamldep := ocamlfind & A"ocamldep";
276317 Options.ocamldoc := ocamlfind & A"ocamldoc";
277 Options.ocamlmktop := ocamlfind & A"ocamlmktop"
278
318 Options.ocamlmktop := ocamlfind & A"ocamlmktop";
319 Options.ocamlmklib := ocamlfind & A"ocamlmklib"
320
279321 | After_rules ->
280
281 (* When one link an OCaml library/binary/package, one should use -linkpkg *)
322
323 (* When one link an OCaml library/binary/package, one should use
324 * -linkpkg *)
282325 flag ["ocaml"; "link"; "program"] & A"-linkpkg";
283
326
284327 (* For each ocamlfind package one inject the -package option when
285328 * compiling, computing dependencies, generating documentation and
286329 * linking. *)
287 List.iter
330 List.iter
288331 begin fun pkg ->
289 flag ["ocaml"; "compile"; "pkg_"^pkg] & S[A"-package"; A pkg];
290 flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S[A"-package"; A pkg];
291 flag ["ocaml"; "doc"; "pkg_"^pkg] & S[A"-package"; A pkg];
292 flag ["ocaml"; "link"; "pkg_"^pkg] & S[A"-package"; A pkg];
293 flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S[A"-package"; A pkg];
294 end
332 let base_args = [A"-package"; A pkg] in
333 let syn_args = [A"-syntax"; A "camlp4o"] in
334 let args =
335 (* Heuristic to identify syntax extensions: whether they end in
336 * ".syntax"; some might not *)
337 if Filename.check_suffix pkg "syntax"
338 then syn_args @ base_args
339 else base_args
340 in
341 flag ["ocaml"; "compile"; "pkg_"^pkg] & S args;
342 flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args;
343 flag ["ocaml"; "doc"; "pkg_"^pkg] & S args;
344 flag ["ocaml"; "link"; "pkg_"^pkg] & S base_args;
345 flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S args;
346 end
295347 (find_packages ());
296348
297349 (* Like -package but for extensions syntax. Morover -syntax is useless
300352 flag ["ocaml"; "compile"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
301353 flag ["ocaml"; "ocamldep"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
302354 flag ["ocaml"; "doc"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
303 flag ["ocaml"; "infer_interface"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
355 flag ["ocaml"; "infer_interface"; "syntax_"^syntax] &
356 S[A"-syntax"; A syntax];
304357 end (find_syntaxes ());
305358
306359 (* The default "thread" tag is not compatible with ocamlfind.
307360 * Indeed, the default rules add the "threads.cma" or "threads.cmxa"
308361 * options when using this tag. When using the "-linkpkg" option with
309362 * ocamlfind, this module will then be added twice on the command line.
310 *
363 *
311364 * To solve this, one approach is to add the "-thread" option when using
312365 * the "threads" package using the previous plugin.
313366 *)
316369 flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]);
317370 flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"])
318371
319 | _ ->
372 | _ ->
320373 ()
321
322374 end
323375
324376 module MyOCamlbuildBase = struct
325 (* # 21 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
377 (* # 22 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
378
326379
327380 (** Base functions for writing myocamlbuild.ml
328381 @author Sylvain Le Gall
330383
331384
332385
386
387
333388 open Ocamlbuild_plugin
334389 module OC = Ocamlbuild_pack.Ocaml_compiler
390
335391
336392 type dir = string
337393 type file = string
338394 type name = string
339395 type tag = string
340396
341 (* # 56 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
397
398 (* # 62 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
399
342400
343401 type t =
344402 {
345 lib_ocaml: (name * dir list) list;
346 lib_c: (name * dir * file list) list;
403 lib_ocaml: (name * dir list * string list) list;
404 lib_c: (name * dir * file list) list;
347405 flags: (tag list * (spec OASISExpr.choices)) list;
348406 (* Replace the 'dir: include' from _tags by a precise interdepends in
349407 * directory.
350408 *)
351 includes: (dir * dir list) list;
409 includes: (dir * dir list) list;
352410 }
353411
412
354413 let env_filename =
355 Pathname.basename
414 Pathname.basename
356415 BaseEnvLight.default_filename
416
357417
358418 let dispatch_combine lst =
359419 fun e ->
360 List.iter
420 List.iter
361421 (fun dispatch -> dispatch e)
362 lst
422 lst
423
363424
364425 let tag_libstubs nm =
365426 "use_lib"^nm^"_stubs"
366427
428
367429 let nm_libstubs nm =
368430 nm^"_stubs"
369431
370 let dispatch t e =
371 let env =
372 BaseEnvLight.load
373 ~filename:env_filename
432
433 let dispatch t e =
434 let env =
435 BaseEnvLight.load
436 ~filename:env_filename
374437 ~allow_empty:true
375438 ()
376439 in
377 match e with
440 match e with
378441 | Before_options ->
379442 let no_trailing_dot s =
380443 if String.length s >= 1 && s.[0] = '.' then
384447 in
385448 List.iter
386449 (fun (opt, var) ->
387 try
450 try
388451 opt := no_trailing_dot (BaseEnvLight.var_get var env)
389452 with Not_found ->
390453 Printf.eprintf "W: Cannot get variable %s" var)
394457 Options.ext_dll, "ext_dll";
395458 ]
396459
397 | After_rules ->
460 | After_rules ->
398461 (* Declare OCaml libraries *)
399 List.iter
462 List.iter
400463 (function
401 | nm, [] ->
402 ocaml_lib nm
403 | nm, dir :: tl ->
464 | nm, [], intf_modules ->
465 ocaml_lib nm;
466 let cmis =
467 List.map (fun m -> (String.uncapitalize m) ^ ".cmi")
468 intf_modules in
469 dep ["ocaml"; "link"; "library"; "file:"^nm^".cma"] cmis
470 | nm, dir :: tl, intf_modules ->
404471 ocaml_lib ~dir:dir (dir^"/"^nm);
405 List.iter
406 (fun dir ->
472 List.iter
473 (fun dir ->
407474 List.iter
408475 (fun str ->
409476 flag ["ocaml"; "use_"^nm; str] (S[A"-I"; P dir]))
410477 ["compile"; "infer_interface"; "doc"])
411 tl)
478 tl;
479 let cmis =
480 List.map (fun m -> dir^"/"^(String.uncapitalize m)^".cmi")
481 intf_modules in
482 dep ["ocaml"; "link"; "library"; "file:"^dir^"/"^nm^".cma"]
483 cmis)
412484 t.lib_ocaml;
413485
414486 (* Declare directories dependencies, replace "include" in _tags. *)
415 List.iter
487 List.iter
416488 (fun (dir, include_dirs) ->
417489 Pathname.define_context dir include_dirs)
418490 t.includes;
427499
428500 flag ["link"; "library"; "ocaml"; "native"; tag_libstubs lib]
429501 (S[A"-cclib"; A("-l"^(nm_libstubs lib))]);
430
502
431503 flag ["link"; "program"; "ocaml"; "byte"; tag_libstubs lib]
432504 (S[A"-dllib"; A("dll"^(nm_libstubs lib))]);
433505
442514
443515 (* TODO: be more specific about what depends on headers *)
444516 (* Depends on .h files *)
445 dep ["compile"; "c"]
517 dep ["compile"; "c"]
446518 headers;
447519
448520 (* Setup search path for lib *)
449 flag ["link"; "ocaml"; "use_"^lib]
521 flag ["link"; "ocaml"; "use_"^lib]
450522 (S[A"-I"; P(dir)]);
451523 )
452524 t.lib_c;
454526 (* Add flags *)
455527 List.iter
456528 (fun (tags, cond_specs) ->
457 let spec =
529 let spec =
458530 BaseEnvLight.var_choose cond_specs env
459531 in
460532 flag tags & spec)
461533 t.flags
462 | _ ->
534 | _ ->
463535 ()
464536
537
465538 let dispatch_default t =
466 dispatch_combine
539 dispatch_combine
467540 [
468541 dispatch t;
469542 MyOCamlbuildFindlib.dispatch;
470543 ]
471544
545
472546 end
473547
474548
475 # 476 "myocamlbuild.ml"
549 # 550 "myocamlbuild.ml"
476550 open Ocamlbuild_plugin;;
477551 let package_default =
478552 {
479 MyOCamlbuildBase.lib_ocaml = [("postgresql", ["lib"])];
553 MyOCamlbuildBase.lib_ocaml = [("postgresql", ["lib"], [])];
480554 lib_c = [("postgresql", "lib", [])];
481555 flags =
482556 [
524598 (["oasis_library_postgresql_cclib"; "ocamlmklib"; "c"],
525599 [(OASISExpr.EBool true, S [A "-lpq"])])
526600 ];
527 includes = [("examples", ["lib"])];
528 }
601 includes = [("examples", ["lib"])]
602 }
529603 ;;
530604
531605 let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;;
532606
533 # 535 "myocamlbuild.ml"
607 # 609 "myocamlbuild.ml"
534608 (* OASIS_STOP *)
535609
536610 let () =
537611 let additional_rules = function
538612 | After_rules ->
539 flag ["compile"; "ocaml"] (S [A "-strict-sequence"]);
540
541613 (* Add correct PostgreSQL compilation and link flags *)
542614 let pgsql_clibs, opgsql_cflags, opgsql_clibs =
543615 let cmd = "pg_config --includedir --libdir --version" in
547619 let pgsql_libdir = A ("-L" ^ input_line ic) in
548620 let major, minor =
549621 let line = input_line ic in
550 let search_version s =
551 let version = ref "" in
552 let stop = ref false in
553 let check_car c =
554 let ascii = Char.code c in
555 if (ascii >= 48 && ascii <= 57 && not !stop) then
556 version := !version ^ (String.make 1 c)
557 else
558 stop := true
559 in
560 let () = String.iter check_car s in
561 !version
562 in
563 try
564 let first_space = String.index line ' ' in
565 let first_dot = String.index line '.' in
566 let first_part = String.sub line (first_space + 1) (first_dot - first_space - 1) in
567 let second_part = String.sub line (first_dot + 1) (String.length line - first_dot - 1) in
568 let major = search_version first_part in
569 let minor = search_version second_part in
570 if (major <> "" && minor <> "") then (
571 A ("-DPG_OCAML_MAJOR_VERSION=" ^ major),
572 A ("-DPG_OCAML_MINOR_VERSION=" ^ minor)
573 ) else (
574 failwith ("Unable to find versions from line '" ^ line ^ "' (cmd: '" ^ cmd ^ "'")
575 )
576 with
577 _ -> failwith ("Unable to find versions from line '" ^ line ^ "' (cmd: '" ^ cmd ^ "'")
622 let search_version s =
623 let version = ref "" in
624 let stop = ref false in
625 let check_car c =
626 let ascii = Char.code c in
627 if (ascii >= 48 && ascii <= 57 && not !stop) then
628 version := !version ^ (String.make 1 c)
629 else
630 stop := true
631 in
632 let () = String.iter check_car s in
633 !version
634 in
635 try
636 let first_space = String.index line ' ' in
637 let first_dot = String.index line '.' in
638 let first_part = String.sub line (first_space + 1) (first_dot - first_space - 1) in
639 let second_part = String.sub line (first_dot + 1) (String.length line - first_dot - 1) in
640 let major = search_version first_part in
641 let minor = search_version second_part in
642 if (major <> "" && minor <> "") then (
643 A ("-DPG_OCAML_MAJOR_VERSION=" ^ major),
644 A ("-DPG_OCAML_MINOR_VERSION=" ^ minor)
645 ) else (
646 failwith ("Unable to find versions from line '" ^ line ^ "' (cmd: '" ^ cmd ^ "'")
647 )
648 with
649 _ -> failwith ("Unable to find versions from line '" ^ line ^ "' (cmd: '" ^ cmd ^ "'")
578650 in
579651 close_in ic;
580652 let pgsql_lib = A "-lpq" in
+1277
-309
setup.ml less more
00 (* setup.ml generated for the first time by OASIS v0.3.0 *)
11
22 (* OASIS_START *)
3 (* DO NOT EDIT (digest: 2458cae84f1526b9c4473257507b4b85) *)
3 (* DO NOT EDIT (digest: 21bca576d00ecf73bc0f2b8434ab927e) *)
44 (*
5 Regenerated by OASIS v0.3.0
5 Regenerated by OASIS v0.4.0
66 Visit http://oasis.forge.ocamlcore.org for more information and
77 documentation about functions used in this file.
88 *)
99 module OASISGettext = struct
10 (* # 21 "src/oasis/OASISGettext.ml" *)
10 (* # 22 "src/oasis/OASISGettext.ml" *)
11
1112
1213 let ns_ str =
1314 str
1415
16
1517 let s_ str =
1618 str
1719
18 let f_ (str : ('a, 'b, 'c, 'd) format4) =
20
21 let f_ (str: ('a, 'b, 'c, 'd) format4) =
1922 str
23
2024
2125 let fn_ fmt1 fmt2 n =
2226 if n = 1 then
2428 else
2529 fmt2^^""
2630
31
2732 let init =
2833 []
2934
35
3036 end
3137
3238 module OASISContext = struct
33 (* # 21 "src/oasis/OASISContext.ml" *)
39 (* # 22 "src/oasis/OASISContext.ml" *)
40
3441
3542 open OASISGettext
43
3644
3745 type level =
3846 [ `Debug
3947 | `Info
4048 | `Warning
4149 | `Error]
50
4251
4352 type t =
4453 {
5059 printf: level -> string -> unit;
5160 }
5261
62
5363 let printf lvl str =
5464 let beg =
5565 match lvl with
5969 | `Debug -> s_ "D: "
6070 in
6171 prerr_endline (beg^str)
72
6273
6374 let default =
6475 ref
7182 printf = printf;
7283 }
7384
85
7486 let quiet =
7587 {!default with quiet = true}
7688
91103 end
92104
93105 module OASISString = struct
94 (* # 1 "src/oasis/OASISString.ml" *)
95
106 (* # 22 "src/oasis/OASISString.ml" *)
96107
97108
98109 (** Various string utilities.
99
110
100111 Mostly inspired by extlib and batteries ExtString and BatString libraries.
101112
102113 @author Sylvain Le Gall
103114 *)
115
104116
105117 let nsplitf str f =
106118 if str = "" then
122134 push ();
123135 List.rev !lst
124136
137
125138 (** [nsplit c s] Split the string [s] at char [c]. It doesn't include the
126139 separator.
127140 *)
128141 let nsplit str c =
129142 nsplitf str ((=) c)
130143
144
131145 let find ~what ?(offset=0) str =
132146 let what_idx = ref 0 in
133 let str_idx = ref offset in
134 while !str_idx < String.length str &&
147 let str_idx = ref offset in
148 while !str_idx < String.length str &&
135149 !what_idx < String.length what do
136150 if str.[!str_idx] = what.[!what_idx] then
137151 incr what_idx
141155 done;
142156 if !what_idx <> String.length what then
143157 raise Not_found
144 else
158 else
145159 !str_idx - !what_idx
146160
147 let sub_start str len =
161
162 let sub_start str len =
148163 let str_len = String.length str in
149164 if len >= str_len then
150165 ""
151166 else
152167 String.sub str len (str_len - len)
168
153169
154170 let sub_end ?(offset=0) str len =
155171 let str_len = String.length str in
158174 else
159175 String.sub str 0 (str_len - len)
160176
177
161178 let starts_with ~what ?(offset=0) str =
162179 let what_idx = ref 0 in
163180 let str_idx = ref offset in
164181 let ok = ref true in
165182 while !ok &&
166 !str_idx < String.length str &&
183 !str_idx < String.length str &&
167184 !what_idx < String.length what do
168185 if str.[!str_idx] = what.[!what_idx] then
169186 incr what_idx
173190 done;
174191 if !what_idx = String.length what then
175192 true
176 else
193 else
177194 false
195
178196
179197 let strip_starts_with ~what str =
180198 if starts_with ~what str then
182200 else
183201 raise Not_found
184202
203
185204 let ends_with ~what ?(offset=0) str =
186205 let what_idx = ref ((String.length what) - 1) in
187206 let str_idx = ref ((String.length str) - 1) in
188207 let ok = ref true in
189208 while !ok &&
190 offset <= !str_idx &&
209 offset <= !str_idx &&
191210 0 <= !what_idx do
192211 if str.[!str_idx] = what.[!what_idx] then
193212 decr what_idx
197216 done;
198217 if !what_idx = -1 then
199218 true
200 else
219 else
201220 false
221
202222
203223 let strip_ends_with ~what str =
204224 if ends_with ~what str then
205225 sub_end str (String.length what)
206226 else
207227 raise Not_found
228
208229
209230 let replace_chars f s =
210231 let buf = String.make (String.length s) 'X' in
213234 done;
214235 buf
215236
237
216238 end
217239
218240 module OASISUtils = struct
219 (* # 21 "src/oasis/OASISUtils.ml" *)
241 (* # 22 "src/oasis/OASISUtils.ml" *)
242
220243
221244 open OASISGettext
222245
246
223247 module MapString = Map.Make(String)
248
224249
225250 let map_string_of_assoc assoc =
226251 List.fold_left
228253 MapString.empty
229254 assoc
230255
256
231257 module SetString = Set.Make(String)
258
232259
233260 let set_string_add_list st lst =
234261 List.fold_left
236263 st
237264 lst
238265
266
239267 let set_string_of_list =
240268 set_string_add_list
241269 SetString.empty
243271
244272 let compare_csl s1 s2 =
245273 String.compare (String.lowercase s1) (String.lowercase s2)
274
246275
247276 module HashStringCsl =
248277 Hashtbl.Make
255284 let hash s =
256285 Hashtbl.hash (String.lowercase s)
257286 end)
287
258288
259289 let varname_of_string ?(hyphen='_') s =
260290 if String.length s = 0 then
286316 String.lowercase buf
287317 end
288318
319
289320 let varname_concat ?(hyphen='_') p s =
290321 let what = String.make 1 hyphen in
291322 let p =
306337 let is_varname str =
307338 str = varname_of_string str
308339
340
309341 let failwithf fmt = Printf.ksprintf failwith fmt
310342
343
311344 end
312345
313346 module PropList = struct
314 (* # 21 "src/oasis/PropList.ml" *)
347 (* # 22 "src/oasis/PropList.ml" *)
348
315349
316350 open OASISGettext
317351
352
318353 type name = string
354
319355
320356 exception Not_set of name * string option
321357 exception No_printer of name
322358 exception Unknown_field of name * name
359
323360
324361 let () =
325362 Printexc.register_printer
326363 (function
327364 | Not_set (nm, Some rsn) ->
328 Some
365 Some
329366 (Printf.sprintf (f_ "Field '%s' is not set: %s") nm rsn)
330367 | Not_set (nm, None) ->
331 Some
368 Some
332369 (Printf.sprintf (f_ "Field '%s' is not set") nm)
333370 | No_printer nm ->
334371 Some
335372 (Printf.sprintf (f_ "No default printer for value %s") nm)
336373 | Unknown_field (nm, schm) ->
337 Some
338 (Printf.sprintf (f_ "Field %s is not defined in schema %s") nm schm)
374 Some
375 (Printf.sprintf
376 (f_ "Field %s is not defined in schema %s") nm schm)
339377 | _ ->
340378 None)
341379
380
342381 module Data =
343382 struct
344
345383 type t =
346384 (name, unit -> unit) Hashtbl.t
347385
351389 let clear t =
352390 Hashtbl.clear t
353391
354 (* # 71 "src/oasis/PropList.ml" *)
392
393 (* # 78 "src/oasis/PropList.ml" *)
355394 end
395
356396
357397 module Schema =
358398 struct
359
360399 type ('ctxt, 'extra) value =
361400 {
362401 get: Data.t -> string;
444483 t.name
445484 end
446485
486
447487 module Field =
448488 struct
449
450489 type ('ctxt, 'value, 'extra) t =
451490 {
452491 set: Data.t -> ?context:'ctxt -> 'value -> unit;
576615
577616 let fgets data t =
578617 t.gets data
579
580618 end
619
581620
582621 module FieldRO =
583622 struct
584
585623 let create ?schema ?name ?parse ?print ?default ?update ?help extra =
586624 let fld =
587625 Field.create ?schema ?name ?parse ?print ?default ?update ?help extra
588626 in
589627 fun data -> Field.fget data fld
590
591628 end
592629 end
593630
594631 module OASISMessage = struct
595 (* # 21 "src/oasis/OASISMessage.ml" *)
632 (* # 22 "src/oasis/OASISMessage.ml" *)
596633
597634
598635 open OASISGettext
599636 open OASISContext
637
600638
601639 let generic_message ~ctxt lvl fmt =
602640 let cond =
616654 end)
617655 fmt
618656
657
619658 let debug ~ctxt fmt =
620659 generic_message ~ctxt `Debug fmt
621660
661
622662 let info ~ctxt fmt =
623663 generic_message ~ctxt `Info fmt
624664
665
625666 let warning ~ctxt fmt =
626667 generic_message ~ctxt `Warning fmt
627668
669
628670 let error ~ctxt fmt =
629671 generic_message ~ctxt `Error fmt
630672
631673 end
632674
633675 module OASISVersion = struct
634 (* # 21 "src/oasis/OASISVersion.ml" *)
676 (* # 22 "src/oasis/OASISVersion.ml" *)
677
635678
636679 open OASISGettext
637680
638681
639682
683
684
640685 type s = string
641686
687
642688 type t = string
689
643690
644691 type comparator =
645692 | VGreater of t
651698 | VAnd of comparator * comparator
652699
653700
701
654702 (* Range of allowed characters *)
655703 let is_digit c =
656704 '0' <= c && c <= '9'
657705
706
658707 let is_alpha c =
659708 ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')
709
660710
661711 let is_special =
662712 function
663713 | '.' | '+' | '-' | '~' -> true
664714 | _ -> false
715
665716
666717 let rec version_compare v1 v2 =
667718 if v1 <> "" || v2 <> "" then
706757 while !p < String.length v && is_digit v.[!p] do
707758 incr p
708759 done;
709 let substr =
760 let substr =
710761 String.sub v !p ((String.length v) - !p)
711 in
712 let res =
713 match String.sub v start_p (!p - start_p) with
762 in
763 let res =
764 match String.sub v start_p (!p - start_p) with
714765 | "" -> 0
715766 | s -> int_of_string s
716767 in
746797
747798 let version_of_string str = str
748799
800
749801 let string_of_version t = t
802
803
804 let version_compare_string s1 s2 =
805 version_compare (version_of_string s1) (version_of_string s2)
806
750807
751808 let chop t =
752809 try
756813 String.sub t 0 pos
757814 with Not_found ->
758815 t
816
759817
760818 let rec comparator_apply v op =
761819 match op with
774832 | VAnd (op1, op2) ->
775833 (comparator_apply v op1) && (comparator_apply v op2)
776834
835
777836 let rec string_of_comparator =
778837 function
779838 | VGreater v -> "> "^(string_of_version v)
786845 | VAnd (c1, c2) ->
787846 (string_of_comparator c1)^" && "^(string_of_comparator c2)
788847
848
789849 let rec varname_of_comparator =
790850 let concat p v =
791851 OASISUtils.varname_concat
804864 | VAnd (c1, c2) ->
805865 (varname_of_comparator c1)^"_and_"^(varname_of_comparator c2)
806866
807 let version_0_3_or_after t =
808 comparator_apply t (VGreaterEqual (string_of_version "0.3"))
867
868 let rec comparator_ge v' =
869 let cmp v = version_compare v v' >= 0 in
870 function
871 | VEqual v
872 | VGreaterEqual v
873 | VGreater v -> cmp v
874 | VLesserEqual _
875 | VLesser _ -> false
876 | VOr (c1, c2) -> comparator_ge v' c1 || comparator_ge v' c2
877 | VAnd (c1, c2) -> comparator_ge v' c1 && comparator_ge v' c2
878
809879
810880 end
811881
812882 module OASISLicense = struct
813 (* # 21 "src/oasis/OASISLicense.ml" *)
883 (* # 22 "src/oasis/OASISLicense.ml" *)
884
814885
815886 (** License for _oasis fields
816887 @author Sylvain Le Gall
818889
819890
820891
892
893
821894 type license = string
822895
896
823897 type license_exception = string
898
824899
825900 type license_version =
826901 | Version of OASISVersion.t
827902 | VersionOrLater of OASISVersion.t
828903 | NoVersion
829904
905
830906
831907 type license_dep_5_unit =
832908 {
836912 }
837913
838914
915
839916 type license_dep_5 =
840917 | DEP5Unit of license_dep_5_unit
841918 | DEP5Or of license_dep_5 list
842919 | DEP5And of license_dep_5 list
843920
844921
922
845923 type t =
846924 | DEP5License of license_dep_5
847925 | OtherLicense of string (* URL *)
848926
849927
928
850929 end
851930
852931 module OASISExpr = struct
853 (* # 21 "src/oasis/OASISExpr.ml" *)
932 (* # 22 "src/oasis/OASISExpr.ml" *)
933
934
854935
855936
856937
857938 open OASISGettext
858939
940
859941 type test = string
860942
943
861944 type flag = string
945
862946
863947 type t =
864948 | EBool of bool
869953 | ETest of test * string
870954
871955
956
872957 type 'a choices = (t * 'a) list
958
873959
874960 let eval var_get t =
875961 let rec eval' =
900986 (v = vl)
901987 in
902988 eval' t
989
903990
904991 let choose ?printer ?name var_get lst =
905992 let rec choose_aux =
9371024 in
9381025 choose_aux (List.rev lst)
9391026
1027
9401028 end
9411029
9421030 module OASISTypes = struct
943 (* # 21 "src/oasis/OASISTypes.ml" *)
1031 (* # 22 "src/oasis/OASISTypes.ml" *)
1032
9441033
9451034
9461035
9571046 type args = string list
9581047 type command_line = (prog * arg list)
9591048
1049
9601050 type findlib_name = string
9611051 type findlib_full = string
1052
9621053
9631054 type compiled_object =
9641055 | Byte
9661057 | Best
9671058
9681059
1060
9691061 type dependency =
9701062 | FindlibPackage of findlib_full * OASISVersion.comparator option
9711063 | InternalLibrary of name
9721064
9731065
1066
9741067 type tool =
9751068 | ExternalTool of name
9761069 | InternalExecutable of name
9771070
1071
9781072
9791073 type vcs =
9801074 | Darcs
9881082 | OtherVCS of url
9891083
9901084
1085
9911086 type plugin_kind =
9921087 [ `Configure
9931088 | `Build
9961091 | `Install
9971092 | `Extra
9981093 ]
1094
9991095
10001096 type plugin_data_purpose =
10011097 [ `Configure
10111107 | `Other of string
10121108 ]
10131109
1110
10141111 type 'a plugin = 'a * name * OASISVersion.t option
10151112
1113
10161114 type all_plugin = plugin_kind plugin
10171115
1116
10181117 type plugin_data = (all_plugin * plugin_data_purpose * (unit -> unit)) list
10191118
1020 (* # 102 "src/oasis/OASISTypes.ml" *)
1119
1120 (* # 115 "src/oasis/OASISTypes.ml" *)
1121
10211122
10221123 type 'a conditional = 'a OASISExpr.choices
1124
10231125
10241126 type custom =
10251127 {
10271129 post_command: (command_line option) conditional;
10281130 }
10291131
1132
10301133
10311134 type common_section =
10321135 {
10351138 cs_plugin_data: plugin_data;
10361139 }
10371140
1141
10381142
10391143 type build_section =
10401144 {
10551159 }
10561160
10571161
1162
10581163 type library =
10591164 {
10601165 lib_modules: string list;
10651170 lib_findlib_containers: findlib_name list;
10661171 }
10671172
1173
1174 type object_ =
1175 {
1176 obj_modules: string list;
1177 obj_findlib_fullname: findlib_name list option;
1178 }
1179
1180
10681181 type executable =
10691182 {
10701183 exec_custom: bool;
10711184 exec_main_is: unix_filename;
10721185 }
10731186
1187
10741188 type flag =
10751189 {
10761190 flag_description: string option;
10771191 flag_default: bool conditional;
10781192 }
1193
10791194
10801195 type source_repository =
10811196 {
10881203 src_repo_subdir: unix_filename option;
10891204 }
10901205
1206
10911207 type test =
10921208 {
10931209 test_type: [`Test] plugin;
10981214 test_tools: tool list;
10991215 }
11001216
1217
11011218 type doc_format =
11021219 | HTML of unix_filename
11031220 | DocText
11071224 | DVI
11081225 | OtherDoc
11091226
1227
11101228
11111229 type doc =
11121230 {
11231241 doc_build_tools: tool list;
11241242 }
11251243
1244
11261245 type section =
11271246 | Library of common_section * build_section * library
1247 | Object of common_section * build_section * object_
11281248 | Executable of common_section * build_section * executable
11291249 | Flag of common_section * flag
11301250 | SrcRepo of common_section * source_repository
11321252 | Doc of common_section * doc
11331253
11341254
1255
11351256 type section_kind =
1136 [ `Library | `Executable | `Flag | `SrcRepo | `Test | `Doc ]
1137
1138 type package =
1257 [ `Library | `Object | `Executable | `Flag | `SrcRepo | `Test | `Doc ]
1258
1259
1260 type package =
11391261 {
11401262 oasis_version: OASISVersion.t;
11411263 ocaml_version: OASISVersion.comparator option;
11421264 findlib_version: OASISVersion.comparator option;
1265 alpha_features: string list;
1266 beta_features: string list;
11431267 name: package_name;
11441268 version: OASISVersion.t;
11451269 license: OASISLicense.t;
11721296 plugin_data: plugin_data;
11731297 }
11741298
1299
11751300 end
11761301
1302 module OASISFeatures = struct
1303 (* # 22 "src/oasis/OASISFeatures.ml" *)
1304
1305 open OASISTypes
1306 open OASISUtils
1307 open OASISGettext
1308 open OASISVersion
1309
1310 module MapPlugin =
1311 Map.Make
1312 (struct
1313 type t = plugin_kind * name
1314 let compare = Pervasives.compare
1315 end)
1316
1317 module Data =
1318 struct
1319 type t =
1320 {
1321 oasis_version: OASISVersion.t;
1322 plugin_versions: OASISVersion.t option MapPlugin.t;
1323 alpha_features: string list;
1324 beta_features: string list;
1325 }
1326
1327 let create oasis_version alpha_features beta_features =
1328 {
1329 oasis_version = oasis_version;
1330 plugin_versions = MapPlugin.empty;
1331 alpha_features = alpha_features;
1332 beta_features = beta_features
1333 }
1334
1335 let of_package pkg =
1336 create
1337 pkg.OASISTypes.oasis_version
1338 pkg.OASISTypes.alpha_features
1339 pkg.OASISTypes.beta_features
1340
1341 let add_plugin (plugin_kind, plugin_name, plugin_version) t =
1342 {t with
1343 plugin_versions = MapPlugin.add
1344 (plugin_kind, plugin_name)
1345 plugin_version
1346 t.plugin_versions}
1347
1348 let plugin_version plugin_kind plugin_name t =
1349 MapPlugin.find (plugin_kind, plugin_name) t.plugin_versions
1350 end
1351
1352 type origin =
1353 | Field of string * string
1354 | Section of string
1355 | NoOrigin
1356
1357 type stage = Alpha | Beta
1358
1359
1360 let string_of_stage =
1361 function
1362 | Alpha -> "alpha"
1363 | Beta -> "beta"
1364
1365
1366 let field_of_stage =
1367 function
1368 | Alpha -> "AlphaFeatures"
1369 | Beta -> "BetaFeatures"
1370
1371 type publication = InDev of stage | SinceVersion of OASISVersion.t
1372
1373 type t =
1374 {
1375 name: string;
1376 plugin: all_plugin option;
1377 publication: publication;
1378 description: unit -> string;
1379 }
1380
1381 (* TODO: mutex protect this. *)
1382 let all_features = Hashtbl.create 13
1383
1384
1385 let since_version ver_str = SinceVersion (version_of_string ver_str)
1386 let alpha = InDev Alpha
1387 let beta = InDev Beta
1388
1389
1390 let data_check t data origin =
1391 let no_message = "no message" in
1392
1393 let check_feature features stage =
1394 let has_feature = List.mem t.name features in
1395 if not has_feature then
1396 match origin with
1397 | Field (fld, where) ->
1398 Some
1399 (Printf.sprintf
1400 (f_ "Field %s in %s is only available when feature %s \
1401 is in field %s.")
1402 fld where t.name (field_of_stage stage))
1403 | Section sct ->
1404 Some
1405 (Printf.sprintf
1406 (f_ "Section %s is only available when features %s \
1407 is in field %s.")
1408 sct t.name (field_of_stage stage))
1409 | NoOrigin ->
1410 Some no_message
1411 else
1412 None
1413 in
1414
1415 let version_is_good ~min_version version fmt =
1416 let version_is_good =
1417 OASISVersion.comparator_apply
1418 version (OASISVersion.VGreaterEqual min_version)
1419 in
1420 Printf.ksprintf
1421 (fun str ->
1422 if version_is_good then
1423 None
1424 else
1425 Some str)
1426 fmt
1427 in
1428
1429 match origin, t.plugin, t.publication with
1430 | _, _, InDev Alpha -> check_feature data.Data.alpha_features Alpha
1431 | _, _, InDev Beta -> check_feature data.Data.beta_features Beta
1432 | Field(fld, where), None, SinceVersion min_version ->
1433 version_is_good ~min_version data.Data.oasis_version
1434 (f_ "Field %s in %s is only valid since OASIS v%s, update \
1435 OASISFormat field from '%s' to '%s' after checking \
1436 OASIS changelog.")
1437 fld where (string_of_version min_version)
1438 (string_of_version data.Data.oasis_version)
1439 (string_of_version min_version)
1440
1441 | Field(fld, where), Some(plugin_knd, plugin_name, _),
1442 SinceVersion min_version ->
1443 begin
1444 try
1445 let plugin_version_current =
1446 try
1447 match Data.plugin_version plugin_knd plugin_name data with
1448 | Some ver -> ver
1449 | None ->
1450 failwithf
1451 (f_ "Field %s in %s is only valid for the OASIS \
1452 plugin %s since v%s, but no plugin version is \
1453 defined in the _oasis file, change '%s' to \
1454 '%s (%s)' in your _oasis file.")
1455 fld where plugin_name (string_of_version min_version)
1456 plugin_name
1457 plugin_name (string_of_version min_version)
1458 with Not_found ->
1459 failwithf
1460 (f_ "Field %s in %s is only valid when the OASIS plugin %s \
1461 is defined.")
1462 fld where plugin_name
1463 in
1464 version_is_good ~min_version plugin_version_current
1465 (f_ "Field %s in %s is only valid for the OASIS plugin %s \
1466 since v%s, update your plugin from '%s (%s)' to \
1467 '%s (%s)' after checking the plugin's changelog.")
1468 fld where plugin_name (string_of_version min_version)
1469 plugin_name (string_of_version plugin_version_current)
1470 plugin_name (string_of_version min_version)
1471 with Failure msg ->
1472 Some msg
1473 end
1474
1475 | Section sct, None, SinceVersion min_version ->
1476 version_is_good ~min_version data.Data.oasis_version
1477 (f_ "Section %s is only valid for since OASIS v%s, update \
1478 OASISFormat field from '%s' to '%s' after checking OASIS \
1479 changelog.")
1480 sct (string_of_version min_version)
1481 (string_of_version data.Data.oasis_version)
1482 (string_of_version min_version)
1483
1484 | Section sct, Some(plugin_knd, plugin_name, _),
1485 SinceVersion min_version ->
1486 begin
1487 try
1488 let plugin_version_current =
1489 try
1490 match Data.plugin_version plugin_knd plugin_name data with
1491 | Some ver -> ver
1492 | None ->
1493 failwithf
1494 (f_ "Section %s is only valid for the OASIS \
1495 plugin %s since v%s, but no plugin version is \
1496 defined in the _oasis file, change '%s' to \
1497 '%s (%s)' in your _oasis file.")
1498 sct plugin_name (string_of_version min_version)
1499 plugin_name
1500 plugin_name (string_of_version min_version)
1501 with Not_found ->
1502 failwithf
1503 (f_ "Section %s is only valid when the OASIS plugin %s \
1504 is defined.")
1505 sct plugin_name
1506 in
1507 version_is_good ~min_version plugin_version_current
1508 (f_ "Section %s is only valid for the OASIS plugin %s \
1509 since v%s, update your plugin from '%s (%s)' to \
1510 '%s (%s)' after checking the plugin's changelog.")
1511 sct plugin_name (string_of_version min_version)
1512 plugin_name (string_of_version plugin_version_current)
1513 plugin_name (string_of_version min_version)
1514 with Failure msg ->
1515 Some msg
1516 end
1517
1518 | NoOrigin, None, SinceVersion min_version ->
1519 version_is_good ~min_version data.Data.oasis_version "%s" no_message
1520
1521 | NoOrigin, Some(plugin_knd, plugin_name, _), SinceVersion min_version ->
1522 begin
1523 try
1524 let plugin_version_current =
1525 match Data.plugin_version plugin_knd plugin_name data with
1526 | Some ver -> ver
1527 | None -> raise Not_found
1528 in
1529 version_is_good ~min_version plugin_version_current
1530 "%s" no_message
1531 with Not_found ->
1532 Some no_message
1533 end
1534
1535
1536 let data_assert t data origin =
1537 match data_check t data origin with
1538 | None -> ()
1539 | Some str -> failwith str
1540
1541
1542 let data_test t data =
1543 match data_check t data NoOrigin with
1544 | None -> true
1545 | Some str -> false
1546
1547
1548 let package_test t pkg =
1549 data_test t (Data.of_package pkg)
1550
1551
1552 let create ?plugin name publication description =
1553 let () =
1554 if Hashtbl.mem all_features name then
1555 failwithf "Feature '%s' is already declared." name
1556 in
1557 let t =
1558 {
1559 name = name;
1560 plugin = plugin;
1561 publication = publication;
1562 description = description;
1563 }
1564 in
1565 Hashtbl.add all_features name t;
1566 t
1567
1568
1569 let get_stage name =
1570 try
1571 (Hashtbl.find all_features name).publication
1572 with Not_found ->
1573 failwithf (f_ "Feature %s doesn't exist.") name
1574
1575
1576 let list () =
1577 Hashtbl.fold (fun _ v acc -> v :: acc) all_features []
1578
1579 (*
1580 * Real flags.
1581 *)
1582
1583
1584 let features =
1585 create "features_fields"
1586 (since_version "0.4")
1587 (fun () ->
1588 s_ "Enable to experiment not yet official features.")
1589
1590
1591 let flag_docs =
1592 create "flag_docs"
1593 (since_version "0.3")
1594 (fun () ->
1595 s_ "Building docs require '-docs' flag at configure.")
1596
1597
1598 let flag_tests =
1599 create "flag_tests"
1600 (since_version "0.3")
1601 (fun () ->
1602 s_ "Running tests require '-tests' flag at configure.")
1603
1604
1605 let pack =
1606 create "pack"
1607 (since_version "0.3")
1608 (fun () ->
1609 s_ "Allow to create packed library.")
1610
1611
1612 let section_object =
1613 create "section_object" beta
1614 (fun () ->
1615 s_ "Implement an object section.")
1616 end
1617
11771618 module OASISUnixPath = struct
1178 (* # 21 "src/oasis/OASISUnixPath.ml" *)
1619 (* # 22 "src/oasis/OASISUnixPath.ml" *)
1620
11791621
11801622 type unix_filename = string
11811623 type unix_dirname = string
11821624
1625
11831626 type host_filename = string
11841627 type host_dirname = string
11851628
1629
11861630 let current_dir_name = "."
11871631
1632
11881633 let parent_dir_name = ".."
1634
11891635
11901636 let is_current_dir fn =
11911637 fn = current_dir_name || fn = ""
1638
11921639
11931640 let concat f1 f2 =
11941641 if is_current_dir f1 then
11981645 try OASISString.strip_ends_with ~what:"/" f1 with Not_found -> f1
11991646 in
12001647 f1'^"/"^f2
1648
12011649
12021650 let make =
12031651 function
12091657 | [] ->
12101658 invalid_arg "OASISUnixPath.make"
12111659
1660
12121661 let dirname f =
12131662 try
12141663 String.sub f 0 (String.rindex f '/')
12151664 with Not_found ->
12161665 current_dir_name
1666
12171667
12181668 let basename f =
12191669 try
12231673 String.sub f pos_start ((String.length f) - pos_start)
12241674 with Not_found ->
12251675 f
1676
12261677
12271678 let chop_extension f =
12281679 try
12461697 with Not_found ->
12471698 f
12481699
1700
12491701 let capitalize_file f =
12501702 let dir = dirname f in
12511703 let base = basename f in
12521704 concat dir (String.capitalize base)
12531705
1706
12541707 let uncapitalize_file f =
12551708 let dir = dirname f in
12561709 let base = basename f in
12571710 concat dir (String.uncapitalize base)
12581711
1712
12591713 end
12601714
12611715 module OASISHostPath = struct
1262 (* # 21 "src/oasis/OASISHostPath.ml" *)
1716 (* # 22 "src/oasis/OASISHostPath.ml" *)
12631717
12641718
12651719 open Filename
12661720
1721
12671722 module Unix = OASISUnixPath
1723
12681724
12691725 let make =
12701726 function
12721728 invalid_arg "OASISHostPath.make"
12731729 | hd :: tl ->
12741730 List.fold_left Filename.concat hd tl
1731
12751732
12761733 let of_unix ufn =
12771734 if Sys.os_type = "Unix" then
12921749 end
12931750
12941751 module OASISSection = struct
1295 (* # 21 "src/oasis/OASISSection.ml" *)
1752 (* # 22 "src/oasis/OASISSection.ml" *)
1753
12961754
12971755 open OASISTypes
12981756
1299 let section_kind_common =
1757
1758 let section_kind_common =
13001759 function
1301 | Library (cs, _, _) ->
1760 | Library (cs, _, _) ->
13021761 `Library, cs
1762 | Object (cs, _, _) ->
1763 `Object, cs
13031764 | Executable (cs, _, _) ->
13041765 `Executable, cs
13051766 | Flag (cs, _) ->
13111772 | Doc (cs, _) ->
13121773 `Doc, cs
13131774
1775
13141776 let section_common sct =
13151777 snd (section_kind_common sct)
1778
13161779
13171780 let section_common_set cs =
13181781 function
13191782 | Library (_, bs, lib) -> Library (cs, bs, lib)
1783 | Object (_, bs, obj) -> Object (cs, bs, obj)
13201784 | Executable (_, bs, exec) -> Executable (cs, bs, exec)
13211785 | Flag (_, flg) -> Flag (cs, flg)
13221786 | SrcRepo (_, src_repo) -> SrcRepo (cs, src_repo)
13231787 | Test (_, tst) -> Test (cs, tst)
13241788 | Doc (_, doc) -> Doc (cs, doc)
13251789
1790
13261791 (** Key used to identify section
13271792 *)
1328 let section_id sct =
1329 let k, cs =
1793 let section_id sct =
1794 let k, cs =
13301795 section_kind_common sct
13311796 in
13321797 k, cs.cs_name
1798
13331799
13341800 let string_of_section sct =
13351801 let k, nm =
13361802 section_id sct
13371803 in
13381804 (match k with
1339 | `Library -> "library"
1805 | `Library -> "library"
1806 | `Object -> "object"
13401807 | `Executable -> "executable"
13411808 | `Flag -> "flag"
13421809 | `SrcRepo -> "src repository"
13441811 | `Doc -> "doc")
13451812 ^" "^nm
13461813
1814
13471815 let section_find id scts =
13481816 List.find
13491817 (fun sct -> id = section_id sct)
13501818 scts
13511819
1820
13521821 module CSection =
13531822 struct
13541823 type t = section
13551824
13561825 let id = section_id
13571826
1358 let compare t1 t2 =
1827 let compare t1 t2 =
13591828 compare (id t1) (id t2)
1360
1829
13611830 let equal t1 t2 =
13621831 (id t1) = (id t2)
13631832
13651834 Hashtbl.hash (id t)
13661835 end
13671836
1837
13681838 module MapSection = Map.Make(CSection)
13691839 module SetSection = Set.Make(CSection)
13701840
1841
13711842 end
13721843
13731844 module OASISBuildSection = struct
1374 (* # 21 "src/oasis/OASISBuildSection.ml" *)
1845 (* # 22 "src/oasis/OASISBuildSection.ml" *)
1846
13751847
13761848 end
13771849
13781850 module OASISExecutable = struct
1379 (* # 21 "src/oasis/OASISExecutable.ml" *)
1851 (* # 22 "src/oasis/OASISExecutable.ml" *)
1852
13801853
13811854 open OASISTypes
13821855
1383 let unix_exec_is (cs, bs, exec) is_native ext_dll suffix_program =
1384 let dir =
1856
1857 let unix_exec_is (cs, bs, exec) is_native ext_dll suffix_program =
1858 let dir =
13851859 OASISUnixPath.concat
13861860 bs.bs_path
13871861 (OASISUnixPath.dirname exec.exec_main_is)
13881862 in
1389 let is_native_exec =
1863 let is_native_exec =
13901864 match bs.bs_compiled_object with
13911865 | Native -> true
13921866 | Best -> is_native ()
13971871 dir
13981872 (cs.cs_name^(suffix_program ())),
13991873
1400 if not is_native_exec &&
1401 not exec.exec_custom &&
1874 if not is_native_exec &&
1875 not exec.exec_custom &&
14021876 bs.bs_c_sources <> [] then
14031877 Some (dir^"/dll"^cs.cs_name^"_stubs"^(ext_dll ()))
14041878 else
14051879 None
14061880
1881
14071882 end
14081883
14091884 module OASISLibrary = struct
1410 (* # 21 "src/oasis/OASISLibrary.ml" *)
1885 (* # 22 "src/oasis/OASISLibrary.ml" *)
1886
14111887
14121888 open OASISTypes
14131889 open OASISUtils
14141890 open OASISGettext
14151891 open OASISSection
14161892
1417 type library_name = name
1418 type findlib_part_name = name
1419 type 'a map_of_findlib_part_name = 'a OASISUtils.MapString.t
1420
1421 exception InternalLibraryNotFound of library_name
1422 exception FindlibPackageNotFound of findlib_name
1423
1424 type group_t =
1425 | Container of findlib_name * group_t list
1426 | Package of (findlib_name *
1427 common_section *
1428 build_section *
1429 library *
1430 group_t list)
14311893
14321894 (* Look for a module file, considering capitalization or not. *)
1433 let find_module source_file_exists (cs, bs, lib) modul =
1895 let find_module source_file_exists bs modul =
14341896 let possible_base_fn =
14351897 List.map
14361898 (OASISUnixPath.concat bs.bs_path)
14681930 (`No_sources possible_base_fn)
14691931 possible_base_fn
14701932
1933
14711934 let source_unix_files ~ctxt (cs, bs, lib) source_file_exists =
14721935 List.fold_left
14731936 (fun acc modul ->
1474 match find_module source_file_exists (cs, bs, lib) modul with
1937 match find_module source_file_exists bs modul with
14751938 | `Sources (base_fn, lst) ->
14761939 (base_fn, lst) :: acc
14771940 | `No_sources _ ->
14841947 []
14851948 (lib.lib_modules @ lib.lib_internal_modules)
14861949
1950
14871951 let generated_unix_files
14881952 ~ctxt
14891953 ~is_native
14931957 ~source_file_exists
14941958 (cs, bs, lib) =
14951959
1496 let find_modules lst ext =
1960 let find_modules lst ext =
14971961 let find_module modul =
1498 match find_module source_file_exists (cs, bs, lib) modul with
1962 match find_module source_file_exists bs modul with
1963 | `Sources (base_fn, [fn]) when ext <> "cmi"
1964 && Filename.check_suffix fn ".mli" ->
1965 None (* No implementation files for pure interface. *)
14991966 | `Sources (base_fn, _) ->
1500 [base_fn]
1967 Some [base_fn]
15011968 | `No_sources lst ->
15021969 OASISMessage.warning
15031970 ~ctxt
15041971 (f_ "Cannot find source file matching \
15051972 module '%s' in library %s")
15061973 modul cs.cs_name;
1507 lst
1974 Some lst
15081975 in
1509 List.map
1510 (fun nm ->
1511 List.map
1512 (fun base_fn -> base_fn ^"."^ext)
1513 (find_module nm))
1976 List.fold_left
1977 (fun acc nm ->
1978 match find_module nm with
1979 | None -> acc
1980 | Some base_fns ->
1981 List.map (fun base_fn -> base_fn ^"."^ext) base_fns :: acc)
1982 []
15141983 lst
15151984 in
15161985
15271996 (* The .cmx that be compiled along *)
15281997 let cmxs =
15291998 let should_be_built =
1530 (not lib.lib_pack) && (* Do not install .cmx packed submodules *)
15311999 match bs.bs_compiled_object with
15322000 | Native -> true
15332001 | Best -> is_native
15342002 | Byte -> false
15352003 in
15362004 if should_be_built then
1537 find_modules
1538 (lib.lib_modules @ lib.lib_internal_modules)
1539 "cmx"
2005 if lib.lib_pack then
2006 find_modules
2007 [cs.cs_name]
2008 "cmx"
2009 else
2010 find_modules
2011 (lib.lib_modules @ lib.lib_internal_modules)
2012 "cmx"
15402013 else
15412014 []
15422015 in
15582031 add_pack_header ([cs.cs_name^".cma"] :: acc)
15592032 in
15602033 let native acc =
1561 let acc =
2034 let acc =
15622035 add_pack_header
15632036 (if has_native_dynlink then
15642037 [cs.cs_name^".cmxs"] :: acc
15972070 acc_nopath)
15982071 (headers @ cmxs)
15992072
1600 type data = common_section * build_section * library
2073
2074 end
2075
2076 module OASISObject = struct
2077 (* # 22 "src/oasis/OASISObject.ml" *)
2078
2079
2080 open OASISTypes
2081 open OASISGettext
2082
2083
2084 let source_unix_files ~ctxt (cs, bs, obj) source_file_exists =
2085 List.fold_left
2086 (fun acc modul ->
2087 match OASISLibrary.find_module source_file_exists bs modul with
2088 | `Sources (base_fn, lst) ->
2089 (base_fn, lst) :: acc
2090 | `No_sources _ ->
2091 OASISMessage.warning
2092 ~ctxt
2093 (f_ "Cannot find source file matching \
2094 module '%s' in object %s")
2095 modul cs.cs_name;
2096 acc)
2097 []
2098 obj.obj_modules
2099
2100
2101 let generated_unix_files
2102 ~ctxt
2103 ~is_native
2104 ~source_file_exists
2105 (cs, bs, obj) =
2106
2107 let find_module ext modul =
2108 match OASISLibrary.find_module source_file_exists bs modul with
2109 | `Sources (base_fn, _) -> [base_fn ^ ext]
2110 | `No_sources lst ->
2111 OASISMessage.warning
2112 ~ctxt
2113 (f_ "Cannot find source file matching \
2114 module '%s' in object %s")
2115 modul cs.cs_name ;
2116 lst
2117 in
2118
2119 let header, byte, native, c_object, f =
2120 match obj.obj_modules with
2121 | [ m ] -> (find_module ".cmi" m,
2122 find_module ".cmo" m,
2123 find_module ".cmx" m,
2124 find_module ".o" m,
2125 fun x -> x)
2126 | _ -> ([cs.cs_name ^ ".cmi"],
2127 [cs.cs_name ^ ".cmo"],
2128 [cs.cs_name ^ ".cmx"],
2129 [cs.cs_name ^ ".o"],
2130 OASISUnixPath.concat bs.bs_path)
2131 in
2132 List.map (List.map f) (
2133 match bs.bs_compiled_object with
2134 | Native ->
2135 native :: c_object :: byte :: header :: []
2136 | Best when is_native ->
2137 native :: c_object :: byte :: header :: []
2138 | Byte | Best ->
2139 byte :: header :: [])
2140
2141
2142 end
2143
2144 module OASISFindlib = struct
2145 (* # 22 "src/oasis/OASISFindlib.ml" *)
2146
2147
2148 open OASISTypes
2149 open OASISUtils
2150 open OASISGettext
2151 open OASISSection
2152
2153
2154 type library_name = name
2155 type findlib_part_name = name
2156 type 'a map_of_findlib_part_name = 'a OASISUtils.MapString.t
2157
2158
2159 exception InternalLibraryNotFound of library_name
2160 exception FindlibPackageNotFound of findlib_name
2161
2162
2163 type group_t =
2164 | Container of findlib_name * group_t list
2165 | Package of (findlib_name *
2166 common_section *
2167 build_section *
2168 [`Library of library | `Object of object_] *
2169 group_t list)
2170
2171
2172 type data = common_section *
2173 build_section *
2174 [`Library of library | `Object of object_]
16012175 type tree =
16022176 | Node of (data option) * (tree MapString.t)
16032177 | Leaf of data
2178
16042179
16052180 let findlib_mapping pkg =
16062181 (* Map from library name to either full findlib name or parts + parent. *)
16382213 lib_name
16392214 (`Solved fndlb_parts)
16402215 mp
2216 end
2217
2218 | Object (cs, _, obj) ->
2219 begin
2220 let obj_name = cs.cs_name in
2221 if MapString.mem obj_name mp then
2222 failwithf
2223 (f_ "The object name '%s' is used more than once.")
2224 obj_name;
2225 let findlib_full_name = match obj.obj_findlib_fullname with
2226 | Some ns -> String.concat "." ns
2227 | None -> obj_name
2228 in
2229 MapString.add
2230 obj_name
2231 (`Solved findlib_full_name)
2232 mp
16412233 end
16422234
16432235 | Executable _ | Test _ | Flag _ | SrcRepo _ | Doc _ ->
17072299 let lib_name = cs.cs_name in
17082300 findlib_name_of_library_name lib_name
17092301 in
1710 let rec add_children nm_lst (children : tree MapString.t) =
2302 let rec add_children nm_lst (children: tree MapString.t) =
17112303 match nm_lst with
17122304 | (hd :: tl) ->
17132305 begin
17772369 (fun mp ->
17782370 function
17792371 | Library (cs, bs, lib) ->
1780 add (cs, bs, lib) mp
2372 add (cs, bs, `Library lib) mp
2373 | Object (cs, bs, obj) ->
2374 add (cs, bs, `Object obj) mp
17812375 | _ ->
17822376 mp)
17832377 MapString.empty
18082402 findlib_name_of_library_name,
18092403 library_name_of_findlib_name
18102404
2405
18112406 let findlib_of_group =
18122407 function
18132408 | Container (fndlb_nm, _)
18142409 | Package (fndlb_nm, _, _, _, _) -> fndlb_nm
2410
18152411
18162412 let root_of_group grp =
18172413 let rec root_lib_aux =
18372433 (f_ "Unable to determine root library of findlib library '%s'")
18382434 (findlib_of_group grp)
18392435
2436
18402437 end
18412438
18422439 module OASISFlag = struct
1843 (* # 21 "src/oasis/OASISFlag.ml" *)
2440 (* # 22 "src/oasis/OASISFlag.ml" *)
2441
18442442
18452443 end
18462444
18472445 module OASISPackage = struct
1848 (* # 21 "src/oasis/OASISPackage.ml" *)
2446 (* # 22 "src/oasis/OASISPackage.ml" *)
2447
18492448
18502449 end
18512450
18522451 module OASISSourceRepository = struct
1853 (* # 21 "src/oasis/OASISSourceRepository.ml" *)
2452 (* # 22 "src/oasis/OASISSourceRepository.ml" *)
2453
18542454
18552455 end
18562456
18572457 module OASISTest = struct
1858 (* # 21 "src/oasis/OASISTest.ml" *)
2458 (* # 22 "src/oasis/OASISTest.ml" *)
2459
18592460
18602461 end
18612462
18622463 module OASISDocument = struct
1863 (* # 21 "src/oasis/OASISDocument.ml" *)
2464 (* # 22 "src/oasis/OASISDocument.ml" *)
2465
18642466
18652467 end
18662468
18672469 module OASISExec = struct
1868 (* # 21 "src/oasis/OASISExec.ml" *)
2470 (* # 22 "src/oasis/OASISExec.ml" *)
2471
18692472
18702473 open OASISGettext
18712474 open OASISUtils
18722475 open OASISMessage
2476
18732477
18742478 (* TODO: I don't like this quote, it is there because $(rm) foo expands to
18752479 * 'rm -f' foo...
19002504 cmdline i
19012505 | Some f, i ->
19022506 f i
2507
19032508
19042509 let run_read_output ~ctxt ?f_exit_code cmd args =
19052510 let fn =
19322537 (try Sys.remove fn with _ -> ());
19332538 raise e
19342539
2540
19352541 let run_read_one_line ~ctxt ?f_exit_code cmd args =
19362542 match run_read_output ~ctxt ?f_exit_code cmd args with
19372543 | [fst] ->
19432549 end
19442550
19452551 module OASISFileUtil = struct
1946 (* # 21 "src/oasis/OASISFileUtil.ml" *)
2552 (* # 22 "src/oasis/OASISFileUtil.ml" *)
2553
19472554
19482555 open OASISGettext
2556
19492557
19502558 let file_exists_case fn =
19512559 let dirname = Filename.dirname fn in
19602568 else
19612569 false
19622570
2571
19632572 let find_file ?(case_sensitive=true) paths exts =
19642573
19652574 (* Cardinal product of two list *)
19682577 (List.map
19692578 (fun a ->
19702579 List.map
1971 (fun b -> a,b)
2580 (fun b -> a, b)
19722581 lst2)
19732582 lst1)
19742583 in
19782587 | p1 :: p2 :: tl ->
19792588 let acc =
19802589 (List.map
1981 (fun (a,b) -> Filename.concat a b)
2590 (fun (a, b) -> Filename.concat a b)
19822591 (p1 * p2))
19832592 in
19842593 combined_paths (acc :: tl)
19902599
19912600 let alternatives =
19922601 List.map
1993 (fun (p,e) ->
2602 (fun (p, e) ->
19942603 if String.length e > 0 && e.[0] <> '.' then
19952604 p ^ "." ^ e
19962605 else
19972606 p ^ e)
19982607 ((combined_paths paths) * exts)
19992608 in
2000 List.find
2609 List.find (fun file ->
20012610 (if case_sensitive then
2002 file_exists_case
2611 file_exists_case file
20032612 else
2004 Sys.file_exists)
2005 alternatives
2613 Sys.file_exists file)
2614 && not (Sys.is_directory file)
2615 ) alternatives
2616
20062617
20072618 let which ~ctxt prg =
20082619 let path_sep =
20222633 in
20232634 find_file ~case_sensitive:false [path_lst; [prg]] exec_ext
20242635
2636
20252637 (**/**)
20262638 let rec fix_dir dn =
20272639 (* Windows hack because Sys.file_exists "src\\" = false when
20352647 else
20362648 dn
20372649
2650
20382651 let q = Filename.quote
20392652 (**/**)
2653
20402654
20412655 let cp ~ctxt ?(recurse=false) src tgt =
20422656 if recurse then
20542668 | _ -> "cp")
20552669 [q src; q tgt]
20562670
2671
20572672 let mkdir ~ctxt tgt =
20582673 OASISExec.run ~ctxt
20592674 (match Sys.os_type with
20602675 | "Win32" -> "md"
20612676 | _ -> "mkdir")
20622677 [q tgt]
2678
20632679
20642680 let rec mkdir_parent ~ctxt f tgt =
20652681 let tgt =
20832699 end
20842700 end
20852701
2702
20862703 let rmdir ~ctxt tgt =
20872704 if Sys.readdir tgt = [||] then
20882705 begin
20922709 | _ ->
20932710 OASISExec.run ~ctxt "rm" ["-r"; q tgt]
20942711 end
2712
20952713
20962714 let glob ~ctxt fn =
20972715 let basename =
21382756 end
21392757
21402758
2141 # 2142 "setup.ml"
2759 # 2760 "setup.ml"
21422760 module BaseEnvLight = struct
2143 (* # 21 "src/base/BaseEnvLight.ml" *)
2761 (* # 22 "src/base/BaseEnvLight.ml" *)
2762
21442763
21452764 module MapString = Map.Make(String)
21462765
2766
21472767 type t = string MapString.t
2768
21482769
21492770 let default_filename =
21502771 Filename.concat
21512772 (Sys.getcwd ())
21522773 "setup.data"
2774
21532775
21542776 let load ?(allow_empty=false) ?(filename=default_filename) () =
21552777 if Sys.file_exists filename then
22082830 filename)
22092831 end
22102832
2833
22112834 let var_get name env =
22122835 let rec var_expand str =
22132836 let buff =
22292852 in
22302853 var_expand (MapString.find name env)
22312854
2855
22322856 let var_choose lst env =
22332857 OASISExpr.choose
22342858 (fun nm -> var_get nm env)
22362860 end
22372861
22382862
2239 # 2240 "setup.ml"
2863 # 2864 "setup.ml"
22402864 module BaseContext = struct
2241 (* # 21 "src/base/BaseContext.ml" *)
2865 (* # 22 "src/base/BaseContext.ml" *)
2866
22422867
22432868 open OASISContext
22442869
2870
22452871 let args = args
22462872
2873
22472874 let default = default
22482875
22492876 end
22502877
22512878 module BaseMessage = struct
2252 (* # 21 "src/base/BaseMessage.ml" *)
2879 (* # 22 "src/base/BaseMessage.ml" *)
2880
22532881
22542882 (** Message to user, overrid for Base
22552883 @author Sylvain Le Gall
22572885 open OASISMessage
22582886 open BaseContext
22592887
2888
22602889 let debug fmt = debug ~ctxt:!default fmt
22612890
2891
22622892 let info fmt = info ~ctxt:!default fmt
22632893
2894
22642895 let warning fmt = warning ~ctxt:!default fmt
22652896
2897
22662898 let error fmt = error ~ctxt:!default fmt
22672899
22682900 end
22692901
22702902 module BaseEnv = struct
2271 (* # 21 "src/base/BaseEnv.ml" *)
2903 (* # 22 "src/base/BaseEnv.ml" *)
22722904
22732905 open OASISGettext
22742906 open OASISUtils
22752907 open PropList
22762908
2909
22772910 module MapString = BaseEnvLight.MapString
2911
22782912
22792913 type origin_t =
22802914 | ODefault
22812915 | OGetEnv
22822916 | OFileLoad
22832917 | OCommandLine
2918
22842919
22852920 type cli_handle_t =
22862921 | CLINone
22882923 | CLIWith
22892924 | CLIEnable
22902925 | CLIUser of (Arg.key * Arg.spec * Arg.doc) list
2926
22912927
22922928 type definition_t =
22932929 {
22982934 group: string option;
22992935 }
23002936
2937
23012938 let schema =
23022939 Schema.create "environment"
2940
23032941
23042942 (* Environment data *)
23052943 let env =
23062944 Data.create ()
23072945
2946
23082947 (* Environment data from file *)
23092948 let env_from_file =
23102949 ref MapString.empty
23112950
2951
23122952 (* Lexer for var *)
23132953 let var_lxr =
23142954 Genlex.make_lexer []
2955
23152956
23162957 let rec var_expand str =
23172958 let buff =
23633004 str;
23643005 Buffer.contents buff
23653006
3007
23663008 and var_get name =
23673009 let vl =
23683010 try
23773019 in
23783020 var_expand vl
23793021
3022
23803023 let var_choose ?printer ?name lst =
23813024 OASISExpr.choose
23823025 ?printer
23843027 var_get
23853028 lst
23863029
3030
23873031 let var_protect vl =
23883032 let buff =
23893033 Buffer.create (String.length vl)
23943038 | c -> Buffer.add_char buff c)
23953039 vl;
23963040 Buffer.contents buff
3041
23973042
23983043 let var_define
23993044 ?(hide=false)
24803125 fun () ->
24813126 var_expand (var_get_low (var_get_lst env))
24823127
3128
24833129 let var_redefine
24843130 ?hide
24853131 ?dump
25083154 dflt
25093155 end
25103156
2511 let var_ignore (e : unit -> string) =
2512 ()
3157
3158 let var_ignore (e: unit -> string) = ()
3159
25133160
25143161 let print_hidden =
25153162 var_define
25193166 ~arg_help:"Print even non-printable variable. (debug)"
25203167 "print_hidden"
25213168 (fun () -> "false")
3169
25223170
25233171 let var_all () =
25243172 List.rev
25313179 []
25323180 schema)
25333181
3182
25343183 let default_filename =
25353184 BaseEnvLight.default_filename
25363185
3186
25373187 let load ?allow_empty ?filename () =
25383188 env_from_file := BaseEnvLight.load ?allow_empty ?filename ()
3189
25393190
25403191 let unload () =
25413192 env_from_file := MapString.empty;
25423193 Data.clear env
25433194
3195
25443196 let dump ?(filename=default_filename) () =
25453197 let chn =
25463198 open_out_bin filename
25473199 in
2548 let output nm value =
3200 let output nm value =
25493201 Printf.fprintf chn "%s=%S\n" nm value
25503202 in
2551 let mp_todo =
3203 let mp_todo =
25523204 (* Dump data from schema *)
25533205 Schema.fold
25543206 (fun mp_todo nm def _ ->
25743226
25753227 (* End of the dump *)
25763228 close_out chn
3229
25773230
25783231 let print () =
25793232 let printable_vars =
26133266
26143267 Printf.printf "\nConfiguration: \n";
26153268 List.iter
2616 (fun (name,value) ->
3269 (fun (name, value) ->
26173270 Printf.printf "%s: %s %s\n" name (dot_pad name) value)
26183271 (List.rev printable_vars);
26193272 Printf.printf "\n%!"
3273
26203274
26213275 let args () =
26223276 let arg_concat =
27283382 end
27293383
27303384 module BaseArgExt = struct
2731 (* # 21 "src/base/BaseArgExt.ml" *)
3385 (* # 22 "src/base/BaseArgExt.ml" *)
3386
27323387
27333388 open OASISUtils
27343389 open OASISGettext
3390
27353391
27363392 let parse argv args =
27373393 (* Simulate command line for Arg *)
27563412 end
27573413
27583414 module BaseCheck = struct
2759 (* # 21 "src/base/BaseCheck.ml" *)
3415 (* # 22 "src/base/BaseCheck.ml" *)
3416
27603417
27613418 open BaseEnv
27623419 open BaseMessage
27633420 open OASISUtils
27643421 open OASISGettext
3422
27653423
27663424 let prog_best prg prg_lst =
27673425 var_redefine
27853443 | Some prg -> prg
27863444 | None -> raise Not_found)
27873445
3446
27883447 let prog prg =
27893448 prog_best prg [prg]
27903449
3450
27913451 let prog_opt prg =
27923452 prog_best prg [prg^".opt"; prg]
27933453
3454
27943455 let ocamlfind =
27953456 prog "ocamlfind"
3457
27963458
27973459 let version
27983460 var_prefix
28353497 version_str)
28363498 ()
28373499
3500
28383501 let package_version pkg =
28393502 OASISExec.run_read_one_line ~ctxt:!BaseContext.default
28403503 (ocamlfind ())
28413504 ["query"; "-format"; "%v"; pkg]
3505
28423506
28433507 let package ?version_comparator pkg () =
28443508 let var =
28823546 end
28833547
28843548 module BaseOCamlcConfig = struct
2885 (* # 21 "src/base/BaseOCamlcConfig.ml" *)
3549 (* # 22 "src/base/BaseOCamlcConfig.ml" *)
28863550
28873551
28883552 open BaseEnv
28893553 open OASISUtils
28903554 open OASISGettext
28913555
3556
28923557 module SMap = Map.Make(String)
3558
28933559
28943560 let ocamlc =
28953561 BaseCheck.prog_opt "ocamlc"
3562
28963563
28973564 let ocamlc_config_map =
28983565 (* Map name to value for ocamlc -config output
29393606 mp
29403607 in
29413608
2942 let cache =
3609 let cache =
29433610 lazy
29443611 (var_protect
29453612 (Marshal.to_string
29583625 (* TODO: update if ocamlc change !!! *)
29593626 Lazy.force cache)
29603627
3628
29613629 let var_define nm =
29623630 (* Extract data from ocamlc -config *)
29633631 let avlbl_config_get () =
29663634 0
29673635 in
29683636 let chop_version_suffix s =
2969 try
3637 try
29703638 String.sub s 0 (String.index s '+')
2971 with _ ->
3639 with _ ->
29723640 s
29733641 in
29743642
29753643 let nm_config, value_config =
29763644 match nm with
2977 | "ocaml_version" ->
3645 | "ocaml_version" ->
29783646 "version", chop_version_suffix
29793647 | _ -> nm, (fun x -> x)
29803648 in
29983666 end
29993667
30003668 module BaseStandardVar = struct
3001 (* # 21 "src/base/BaseStandardVar.ml" *)
3669 (* # 22 "src/base/BaseStandardVar.ml" *)
30023670
30033671
30043672 open OASISGettext
30073675 open BaseCheck
30083676 open BaseEnv
30093677
3678
30103679 let ocamlfind = BaseCheck.ocamlfind
30113680 let ocamlc = BaseOCamlcConfig.ocamlc
30123681 let ocamlopt = prog_opt "ocamlopt"
30173686 let rpkg =
30183687 ref None
30193688
3689
30203690 let pkg_get () =
30213691 match !rpkg with
30223692 | Some pkg -> pkg
30233693 | None -> failwith (s_ "OASIS Package is not set")
30243694
3695
30253696 let var_cond = ref []
3697
30263698
30273699 let var_define_cond ~since_version f dflt =
30283700 let holder = ref (fun () -> dflt) in
30353707 holder := f ()) :: !var_cond;
30363708 fun () -> !holder ()
30373709
3710
30383711 (**/**)
3712
30393713
30403714 let pkg_name =
30413715 var_define
30423716 ~short_desc:(fun () -> s_ "Package name")
30433717 "pkg_name"
30443718 (fun () -> (pkg_get ()).name)
3719
30453720
30463721 let pkg_version =
30473722 var_define
30503725 (fun () ->
30513726 (OASISVersion.string_of_version (pkg_get ()).version))
30523727
3728
30533729 let c = BaseOCamlcConfig.var_define
3730
30543731
30553732 let os_type = c "os_type"
30563733 let system = c "system"
30583735 let ccomp_type = c "ccomp_type"
30593736 let ocaml_version = c "ocaml_version"
30603737
3738
30613739 (* TODO: Check standard variable presence at runtime *)
3740
30623741
30633742 let standard_library_default = c "standard_library_default"
30643743 let standard_library = c "standard_library"
30733752 let default_executable_name = c "default_executable_name"
30743753 let systhread_supported = c "systhread_supported"
30753754
3076 let flexlink =
3755
3756 let flexlink =
30773757 BaseCheck.prog "flexlink"
3758
30783759
30793760 let flexdll_version =
30803761 var_define
30813762 ~short_desc:(fun () -> "FlexDLL version (Win32)")
30823763 "flexdll_version"
30833764 (fun () ->
3084 let lst =
3765 let lst =
30853766 OASISExec.run_read_output ~ctxt:!BaseContext.default
30863767 (flexlink ()) ["-help"]
30873768 in
3088 match lst with
3769 match lst with
30893770 | line :: _ ->
30903771 Scanf.sscanf line "FlexDLL version %s" (fun ver -> ver)
30913772 | [] ->
30923773 raise Not_found)
3774
30933775
30943776 (**/**)
30953777 let p name hlp dflt =
30993781 ~arg_help:"dir"
31003782 name
31013783 dflt
3784
31023785
31033786 let (/) a b =
31043787 if os_type () = Sys.os_type then
31093792 OASISUtils.failwithf (f_ "Cannot handle os_type %s filename concat")
31103793 (os_type ())
31113794 (**/**)
3795
31123796
31133797 let prefix =
31143798 p "prefix"
31233807 | _ ->
31243808 "/usr/local")
31253809
3810
31263811 let exec_prefix =
31273812 p "exec_prefix"
31283813 (fun () -> s_ "Install architecture-dependent files in dir")
31293814 (fun () -> "$prefix")
31303815
3816
31313817 let bindir =
31323818 p "bindir"
31333819 (fun () -> s_ "User executables")
31343820 (fun () -> "$exec_prefix"/"bin")
31353821
3822
31363823 let sbindir =
31373824 p "sbindir"
31383825 (fun () -> s_ "System admin executables")
31393826 (fun () -> "$exec_prefix"/"sbin")
31403827
3828
31413829 let libexecdir =
31423830 p "libexecdir"
31433831 (fun () -> s_ "Program executables")
31443832 (fun () -> "$exec_prefix"/"libexec")
31453833
3834
31463835 let sysconfdir =
31473836 p "sysconfdir"
31483837 (fun () -> s_ "Read-only single-machine data")
31493838 (fun () -> "$prefix"/"etc")
31503839
3840
31513841 let sharedstatedir =
31523842 p "sharedstatedir"
31533843 (fun () -> s_ "Modifiable architecture-independent data")
31543844 (fun () -> "$prefix"/"com")
31553845
3846
31563847 let localstatedir =
31573848 p "localstatedir"
31583849 (fun () -> s_ "Modifiable single-machine data")
31593850 (fun () -> "$prefix"/"var")
31603851
3852
31613853 let libdir =
31623854 p "libdir"
31633855 (fun () -> s_ "Object code libraries")
31643856 (fun () -> "$exec_prefix"/"lib")
31653857
3858
31663859 let datarootdir =
31673860 p "datarootdir"
31683861 (fun () -> s_ "Read-only arch-independent data root")
31693862 (fun () -> "$prefix"/"share")
31703863
3864
31713865 let datadir =
31723866 p "datadir"
31733867 (fun () -> s_ "Read-only architecture-independent data")
31743868 (fun () -> "$datarootdir")
31753869
3870
31763871 let infodir =
31773872 p "infodir"
31783873 (fun () -> s_ "Info documentation")
31793874 (fun () -> "$datarootdir"/"info")
31803875
3876
31813877 let localedir =
31823878 p "localedir"
31833879 (fun () -> s_ "Locale-dependent data")
31843880 (fun () -> "$datarootdir"/"locale")
31853881
3882
31863883 let mandir =
31873884 p "mandir"
31883885 (fun () -> s_ "Man documentation")
31893886 (fun () -> "$datarootdir"/"man")
31903887
3888
31913889 let docdir =
31923890 p "docdir"
31933891 (fun () -> s_ "Documentation root")
31943892 (fun () -> "$datarootdir"/"doc"/"$pkg_name")
31953893
3894
31963895 let htmldir =
31973896 p "htmldir"
31983897 (fun () -> s_ "HTML documentation")
31993898 (fun () -> "$docdir")
32003899
3900
32013901 let dvidir =
32023902 p "dvidir"
32033903 (fun () -> s_ "DVI documentation")
32043904 (fun () -> "$docdir")
32053905
3906
32063907 let pdfdir =
32073908 p "pdfdir"
32083909 (fun () -> s_ "PDF documentation")
32093910 (fun () -> "$docdir")
32103911
3912
32113913 let psdir =
32123914 p "psdir"
32133915 (fun () -> s_ "PS documentation")
32143916 (fun () -> "$docdir")
3917
32153918
32163919 let destdir =
32173920 p "destdir"
32223925 ("destdir",
32233926 Some (s_ "undefined by construct"))))
32243927
3928
32253929 let findlib_version =
32263930 var_define
32273931 "findlib_version"
32283932 (fun () ->
32293933 BaseCheck.package_version "findlib")
32303934
3935
32313936 let is_native =
32323937 var_define
32333938 "is_native"
32343939 (fun () ->
32353940 try
3236 let _s : string =
3941 let _s: string =
32373942 ocamlopt ()
32383943 in
32393944 "true"
32403945 with PropList.Not_set _ ->
3241 let _s : string =
3946 let _s: string =
32423947 ocamlc ()
32433948 in
32443949 "false")
3950
32453951
32463952 let ext_program =
32473953 var_define
32483954 "suffix_program"
32493955 (fun () ->
32503956 match os_type () with
3251 | "Win32" -> ".exe"
3957 | "Win32" | "Cygwin" -> ".exe"
32523958 | _ -> "")
3959
32533960
32543961 let rm =
32553962 var_define
32603967 | "Win32" -> "del"
32613968 | _ -> "rm -f")
32623969
3970
32633971 let rmdir =
32643972 var_define
32653973 ~short_desc:(fun () -> s_ "Remove a directory.")
32693977 | "Win32" -> "rd"
32703978 | _ -> "rm -rf")
32713979
3980
32723981 let debug =
32733982 var_define
32743983 ~short_desc:(fun () -> s_ "Turn ocaml debug flag on")
32763985 "debug"
32773986 (fun () -> "true")
32783987
3988
32793989 let profile =
32803990 var_define
32813991 ~short_desc:(fun () -> s_ "Turn ocaml profile flag on")
32823992 ~cli:CLIEnable
32833993 "profile"
32843994 (fun () -> "false")
3995
32853996
32863997 let tests =
32873998 var_define_cond ~since_version:"0.3"
32944005 (fun () -> "false"))
32954006 "true"
32964007
4008
32974009 let docs =
32984010 var_define_cond ~since_version:"0.3"
32994011 (fun () ->
33044016 (fun () -> "true"))
33054017 "true"
33064018
4019
33074020 let native_dynlink =
33084021 var_define
33094022 ~short_desc:(fun () -> s_ "Compiler support generation of .cmxs.")
33114024 "native_dynlink"
33124025 (fun () ->
33134026 let res =
3314 let ocaml_lt_312 () =
4027 let ocaml_lt_312 () =
33154028 OASISVersion.comparator_apply
33164029 (OASISVersion.version_of_string (ocaml_version ()))
33174030 (OASISVersion.VLesser
33234036 (OASISVersion.VLesser
33244037 (OASISVersion.version_of_string "0.30"))
33254038 in
3326 let has_native_dynlink =
4039 let has_native_dynlink =
33274040 let ocamlfind = ocamlfind () in
33284041 try
33294042 let fn =
33414054 false
33424055 else if ocaml_lt_312 () then
33434056 false
3344 else if (os_type () = "Win32" || os_type () = "Cygwin")
4057 else if (os_type () = "Win32" || os_type () = "Cygwin")
33454058 && flexdll_lt_030 () then
33464059 begin
3347 BaseMessage.warning
4060 BaseMessage.warning
33484061 (f_ ".cmxs generation disabled because FlexDLL needs to be \
33494062 at least 0.30. Please upgrade FlexDLL from %s to 0.30.")
33504063 (flexdll_version ());
33554068 in
33564069 string_of_bool res)
33574070
4071
33584072 let init pkg =
33594073 rpkg := Some pkg;
33604074 List.iter (fun f -> f pkg.oasis_version) !var_cond
33624076 end
33634077
33644078 module BaseFileAB = struct
3365 (* # 21 "src/base/BaseFileAB.ml" *)
4079 (* # 22 "src/base/BaseFileAB.ml" *)
4080
33664081
33674082 open BaseEnv
33684083 open OASISGettext
33694084 open BaseMessage
4085
33704086
33714087 let to_filename fn =
33724088 let fn =
33774093 (f_ "File '%s' doesn't have '.ab' extension")
33784094 fn;
33794095 Filename.chop_extension fn
4096
33804097
33814098 let replace fn_lst =
33824099 let buff =
34104127 end
34114128
34124129 module BaseLog = struct
3413 (* # 21 "src/base/BaseLog.ml" *)
4130 (* # 22 "src/base/BaseLog.ml" *)
4131
34144132
34154133 open OASISUtils
4134
34164135
34174136 let default_filename =
34184137 Filename.concat
34194138 (Filename.dirname BaseEnv.default_filename)
34204139 "setup.log"
4140
34214141
34224142 module SetTupleString =
34234143 Set.Make
34284148 | 0 -> String.compare s12 s22
34294149 | n -> n
34304150 end)
4151
34314152
34324153 let load () =
34334154 if Sys.file_exists default_filename then
34784199 []
34794200 end
34804201
4202
34814203 let register event data =
34824204 let chn_out =
34834205 open_out_gen [Open_append; Open_creat; Open_text] 0o644 default_filename
34844206 in
34854207 Printf.fprintf chn_out "%S %S\n" event data;
34864208 close_out chn_out
4209
34874210
34884211 let unregister event data =
34894212 if Sys.file_exists default_filename then
35104233 Sys.remove default_filename
35114234 end
35124235
4236
35134237 let filter events =
35144238 let st_events =
35154239 List.fold_left
35224246 (fun (e, _) -> SetString.mem e st_events)
35234247 (load ())
35244248
4249
35254250 let exists event data =
35264251 List.exists
35274252 (fun v -> (event, data) = v)
35294254 end
35304255
35314256 module BaseBuilt = struct
3532 (* # 21 "src/base/BaseBuilt.ml" *)
4257 (* # 22 "src/base/BaseBuilt.ml" *)
4258
35334259
35344260 open OASISTypes
35354261 open OASISGettext
35364262 open BaseStandardVar
35374263 open BaseMessage
35384264
4265
35394266 type t =
35404267 | BExec (* Executable *)
35414268 | BExecLib (* Library coming with executable *)
35424269 | BLib (* Library *)
4270 | BObj (* Library *)
35434271 | BDoc (* Document *)
4272
35444273
35454274 let to_log_event_file t nm =
35464275 "built_"^
35484277 | BExec -> "exec"
35494278 | BExecLib -> "exec_lib"
35504279 | BLib -> "lib"
4280 | BObj -> "obj"
35514281 | BDoc -> "doc")^
35524282 "_"^nm
35534283
4284
35544285 let to_log_event_done t nm =
35554286 "is_"^(to_log_event_file t nm)
4287
35564288
35574289 let register t nm lst =
35584290 BaseLog.register
35844316 (String.concat (s_ ", ") alt))
35854317 lst
35864318
4319
35874320 let unregister t nm =
35884321 List.iter
35894322 (fun (e, d) ->
35914324 (BaseLog.filter
35924325 [to_log_event_file t nm;
35934326 to_log_event_done t nm])
4327
35944328
35954329 let fold t nm f acc =
35964330 List.fold_left
36114345 (f_ "executable %s")
36124346 | BLib ->
36134347 (f_ "library %s")
4348 | BObj ->
4349 (f_ "object %s")
36144350 | BDoc ->
36154351 (f_ "documentation %s"))
36164352 nm);
36194355 acc
36204356 (BaseLog.filter
36214357 [to_log_event_file t nm])
4358
36224359
36234360 let is_built t nm =
36244361 List.fold_left
36314368 (BaseLog.filter
36324369 [to_log_event_done t nm])
36334370
4371
36344372 let of_executable ffn (cs, bs, exec) =
36354373 let unix_exec_is, unix_dll_opt =
36364374 OASISExecutable.unix_exec_is
36534391 evs,
36544392 unix_exec_is,
36554393 unix_dll_opt
4394
36564395
36574396 let of_library ffn (cs, bs, lib) =
36584397 let unix_lst =
36734412 in
36744413 evs, unix_lst
36754414
4415
4416 let of_object ffn (cs, bs, obj) =
4417 let unix_lst =
4418 OASISObject.generated_unix_files
4419 ~ctxt:!BaseContext.default
4420 ~source_file_exists:(fun fn ->
4421 OASISFileUtil.file_exists_case (OASISHostPath.of_unix fn))
4422 ~is_native:(bool_of_string (is_native ()))
4423 (cs, bs, obj)
4424 in
4425 let evs =
4426 [BObj,
4427 cs.cs_name,
4428 List.map (List.map ffn) unix_lst]
4429 in
4430 evs, unix_lst
4431
36764432 end
36774433
36784434 module BaseCustom = struct
3679 (* # 21 "src/base/BaseCustom.ml" *)
4435 (* # 22 "src/base/BaseCustom.ml" *)
4436
36804437
36814438 open BaseEnv
36824439 open BaseMessage
36834440 open OASISTypes
36844441 open OASISGettext
4442
36854443
36864444 let run cmd args extra_args =
36874445 OASISExec.run ~ctxt:!BaseContext.default ~quote:false
36894447 (List.map
36904448 var_expand
36914449 (args @ (Array.to_list extra_args)))
4450
36924451
36934452 let hook ?(failsafe=false) cstm f e =
36944453 let optional_command lst =
37264485 end
37274486
37284487 module BaseDynVar = struct
3729 (* # 21 "src/base/BaseDynVar.ml" *)
4488 (* # 22 "src/base/BaseDynVar.ml" *)
37304489
37314490
37324491 open OASISTypes
37334492 open OASISGettext
37344493 open BaseEnv
37354494 open BaseBuilt
4495
37364496
37374497 let init pkg =
37384498 (* TODO: disambiguate exec vs other variable by adding exec_VARNAME. *)
37674527 (f_ "Executable '%s' not yet built.")
37684528 cs.cs_name)))))
37694529
3770 | Library _ | Flag _ | Test _ | SrcRepo _ | Doc _ ->
4530 | Library _ | Object _ | Flag _ | Test _ | SrcRepo _ | Doc _ ->
37714531 ())
37724532 pkg.sections
37734533 end
37744534
37754535 module BaseTest = struct
3776 (* # 21 "src/base/BaseTest.ml" *)
4536 (* # 22 "src/base/BaseTest.ml" *)
4537
37774538
37784539 open BaseEnv
37794540 open BaseMessage
37804541 open OASISTypes
37814542 open OASISExpr
37824543 open OASISGettext
4544
37834545
37844546 let test lst pkg extra_args =
37854547
38314593 (failure, n)
38324594 end
38334595 in
3834 let (failed, n) =
4596 let failed, n =
38354597 List.fold_left
38364598 one_test
38374599 (0.0, 0)
38544616 info "%s" msg;
38554617
38564618 (* Possible explanation why the tests where not run. *)
3857 if OASISVersion.version_0_3_or_after pkg.oasis_version &&
4619 if OASISFeatures.package_test OASISFeatures.flag_tests pkg &&
38584620 not (bool_of_string (BaseStandardVar.tests ())) &&
38594621 lst <> [] then
38604622 BaseMessage.warning
38634625 end
38644626
38654627 module BaseDoc = struct
3866 (* # 21 "src/base/BaseDoc.ml" *)
4628 (* # 22 "src/base/BaseDoc.ml" *)
4629
38674630
38684631 open BaseEnv
38694632 open BaseMessage
38704633 open OASISTypes
38714634 open OASISGettext
4635
38724636
38734637 let doc lst pkg extra_args =
38744638
38894653 in
38904654 List.iter one_doc lst;
38914655
3892 if OASISVersion.version_0_3_or_after pkg.oasis_version &&
4656 if OASISFeatures.package_test OASISFeatures.flag_docs pkg &&
38934657 not (bool_of_string (BaseStandardVar.docs ())) &&
38944658 lst <> [] then
38954659 BaseMessage.warning
38984662 end
38994663
39004664 module BaseSetup = struct
3901 (* # 21 "src/base/BaseSetup.ml" *)
4665 (* # 22 "src/base/BaseSetup.ml" *)
39024666
39034667 open BaseEnv
39044668 open BaseMessage
39074671 open OASISGettext
39084672 open OASISUtils
39094673
4674
39104675 type std_args_fun =
39114676 package -> string array -> unit
39124677
4678
39134679 type ('a, 'b) section_args_fun =
39144680 name * (package -> (common_section * 'a) -> string array -> 'b)
4681
39154682
39164683 type t =
39174684 {
39364703 setup_update: bool;
39374704 }
39384705
4706
39394707 (* Associate a plugin function with data from package *)
39404708 let join_plugin_sections filter_map lst =
39414709 List.rev
39494717 []
39504718 lst)
39514719
4720
39524721 (* Search for plugin data associated with a section name *)
39534722 let lookup_plugin_section plugin action nm lst =
39544723 try
39604729 nm
39614730 action
39624731
4732
39634733 let configure t args =
39644734 (* Run configure *)
39654735 BaseCustom.hook
39664736 t.package.conf_custom
3967 (fun () ->
4737 (fun () ->
39684738 (* Reload if preconf has changed it *)
39694739 begin
39704740 try
39914761 (* Replace data in file *)
39924762 BaseFileAB.replace t.package.files_ab
39934763
4764
39944765 let build t args =
39954766 BaseCustom.hook
39964767 t.package.build_custom
39974768 (t.build t.package)
39984769 args
4770
39994771
40004772 let doc t args =
40014773 BaseDoc.doc
40164788 t.package
40174789 args
40184790
4791
40194792 let test t args =
40204793 BaseTest.test
40214794 (join_plugin_sections
40354808 t.package
40364809 args
40374810
4811
40384812 let all t args =
40394813 let rno_doc =
40404814 ref false
40414815 in
40424816 let rno_test =
40434817 ref false
4818 in
4819 let arg_rest =
4820 ref []
40444821 in
40454822 Arg.parse_argv
40464823 ~current:(ref 0)
40554832 "-no-test",
40564833 Arg.Set rno_test,
40574834 s_ "Don't run test target";
4835
4836 "--",
4837 Arg.Rest (fun arg -> arg_rest := arg :: !arg_rest),
4838 s_ "All arguments for configure.";
40584839 ]
40594840 (failwithf (f_ "Don't know what to do with '%s'"))
40604841 "";
40614842
40624843 info "Running configure step";
4063 configure t [||];
4844 configure t (Array.of_list (List.rev !arg_rest));
40644845
40654846 info "Running build step";
40664847 build t [||];
40884869 info "Skipping test step"
40894870 end
40904871
4872
40914873 let install t args =
40924874 BaseCustom.hook
40934875 t.package.install_custom
40944876 (t.install t.package)
40954877 args
40964878
4879
40974880 let uninstall t args =
40984881 BaseCustom.hook
40994882 t.package.uninstall_custom
41004883 (t.uninstall t.package)
41014884 args
41024885
4886
41034887 let reinstall t args =
41044888 uninstall t args;
41054889 install t args
4890
41064891
41074892 let clean, distclean =
41084893 let failsafe f a =
41454930 (f t.package (cs, doc))
41464931 args
41474932 | Library _
4933 | Object _
41484934 | Executable _
41494935 | Flag _
41504936 | SrcRepo _ ->
42004986
42014987 clean, distclean
42024988
4989
42034990 let version t _ =
42044991 print_endline t.oasis_version
4992
42054993
42064994 let update_setup_ml, no_update_setup_ml_cli =
42074995 let b = ref true in
42094997 ("-no-update-setup-ml",
42104998 Arg.Clear b,
42114999 s_ " Don't try to update setup.ml, even if _oasis has changed.")
5000
42125001
42135002 let update_setup_ml t =
42145003 let oasis_fn =
43325121 else
43335122 false
43345123
5124
43355125 let setup t =
43365126 let catch_exn =
43375127 ref true
44735263 error "%s" (Printexc.to_string e);
44745264 exit 1
44755265
5266
44765267 end
44775268
44785269
4479 # 4480 "setup.ml"
5270 # 5271 "setup.ml"
44805271 module InternalConfigurePlugin = struct
4481 (* # 21 "src/plugins/internal/InternalConfigurePlugin.ml" *)
5272 (* # 22 "src/plugins/internal/InternalConfigurePlugin.ml" *)
5273
44825274
44835275 (** Configure using internal scheme
44845276 @author Sylvain Le Gall
44855277 *)
5278
44865279
44875280 open BaseEnv
44885281 open OASISTypes
44905283 open OASISGettext
44915284 open BaseMessage
44925285
5286
44935287 (** Configure build using provided series of check to be done
44945288 * and then output corresponding file.
44955289 *)
44965290 let configure pkg argv =
4497 let var_ignore_eval var =
4498 let _s : string =
4499 var ()
4500 in
4501 ()
4502 in
4503
4504 let errors =
4505 ref SetString.empty
4506 in
4507
4508 let buff =
4509 Buffer.create 13
4510 in
5291 let var_ignore_eval var = let _s: string = var () in () in
5292 let errors = ref SetString.empty in
5293 let buff = Buffer.create 13 in
45115294
45125295 let add_errors fmt =
45135296 Printf.kbprintf
46555438 | None ->
46565439 ()
46575440 end;
5441 (* Make sure the findlib version is fine for the OCaml compiler. *)
5442 begin
5443 let ocaml_ge4 =
5444 OASISVersion.version_compare
5445 (OASISVersion.version_of_string (BaseStandardVar.ocaml_version()))
5446 (OASISVersion.version_of_string "4.0.0") >= 0 in
5447 if ocaml_ge4 then
5448 let findlib_lt132 =
5449 OASISVersion.version_compare
5450 (OASISVersion.version_of_string (BaseStandardVar.findlib_version()))
5451 (OASISVersion.version_of_string "1.3.2") < 0 in
5452 if findlib_lt132 then
5453 add_errors "OCaml >= 4.0.0 requires Findlib version >= 1.3.2"
5454 end;
46585455
46595456 (* FlexDLL *)
46605457 if BaseStandardVar.os_type () = "Win32" ||
47175514 (SetString.cardinal !errors)
47185515 end
47195516
5517
47205518 end
47215519
47225520 module InternalInstallPlugin = struct
4723 (* # 21 "src/plugins/internal/InternalInstallPlugin.ml" *)
5521 (* # 22 "src/plugins/internal/InternalInstallPlugin.ml" *)
5522
47245523
47255524 (** Install using internal scheme
47265525 @author Sylvain Le Gall
47275526 *)
5527
47285528
47295529 open BaseEnv
47305530 open BaseStandardVar
47315531 open BaseMessage
47325532 open OASISTypes
4733 open OASISLibrary
5533 open OASISFindlib
47345534 open OASISGettext
47355535 open OASISUtils
47365536
5537
47375538 let exec_hook =
47385539 ref (fun (cs, bs, exec) -> cs, bs, exec)
47395540
5541
47405542 let lib_hook =
47415543 ref (fun (cs, bs, lib) -> cs, bs, lib, [])
47425544
5545
5546 let obj_hook =
5547 ref (fun (cs, bs, obj) -> cs, bs, obj, [])
5548
5549
47435550 let doc_hook =
47445551 ref (fun (cs, doc) -> cs, doc)
47455552
5553
47465554 let install_file_ev =
47475555 "install-file"
47485556
5557
47495558 let install_dir_ev =
47505559 "install-dir"
47515560
5561
47525562 let install_findlib_ev =
47535563 "install-findlib"
47545564
5565
47555566 let win32_max_command_line_length = 8000
5567
47565568
47575569 let split_install_command ocamlfind findlib_name meta files =
47585570 if Sys.os_type = "Win32" then
47935605 | (firsts, others) ->
47945606 let cmd = args @ firsts in
47955607 (* Use -add for remaining commands: *)
4796 let () =
5608 let () =
47975609 let findlib_ge_132 =
47985610 OASISVersion.comparator_apply
4799 (OASISVersion.version_of_string
5611 (OASISVersion.version_of_string
48005612 (BaseStandardVar.findlib_version ()))
4801 (OASISVersion.VGreaterEqual
5613 (OASISVersion.VGreaterEqual
48025614 (OASISVersion.version_of_string "1.3.2"))
48035615 in
48045616 if not findlib_ge_132 then
48055617 failwithf
4806 (f_ "Installing the library %s require to use the flag \
4807 '-add' of ocamlfind because the command line is too \
4808 long. This flag is only available for findlib 1.3.2. \
4809 Please upgrade findlib from %s to 1.3.2")
5618 (f_ "Installing the library %s require to use the \
5619 flag '-add' of ocamlfind because the command \
5620 line is too long. This flag is only available \
5621 for findlib 1.3.2. Please upgrade findlib from \
5622 %s to 1.3.2")
48105623 findlib_name (BaseStandardVar.findlib_version ())
48115624 in
48125625 let cmds = split other_args others in
48165629 split first_args files
48175630 else
48185631 ["install" :: findlib_name :: meta :: files]
5632
48195633
48205634 let install pkg argv =
48215635
49605774 begin
49615775 (f_data, acc)
49625776 end
5777 and files_of_object (f_data, acc) data_obj =
5778 let cs, bs, obj, obj_extra =
5779 !obj_hook data_obj
5780 in
5781 if var_choose bs.bs_install &&
5782 BaseBuilt.is_built BaseBuilt.BObj cs.cs_name then
5783 begin
5784 let acc =
5785 (* Start with acc + obj_extra *)
5786 List.rev_append obj_extra acc
5787 in
5788 let acc =
5789 (* Add uncompiled header from the source tree *)
5790 let path =
5791 OASISHostPath.of_unix bs.bs_path
5792 in
5793 List.fold_left
5794 (fun acc modul ->
5795 try
5796 List.find
5797 OASISFileUtil.file_exists_case
5798 (List.map
5799 (Filename.concat path)
5800 [modul^".mli";
5801 modul^".ml";
5802 String.uncapitalize modul^".mli";
5803 String.capitalize modul^".mli";
5804 String.uncapitalize modul^".ml";
5805 String.capitalize modul^".ml"])
5806 :: acc
5807 with Not_found ->
5808 begin
5809 warning
5810 (f_ "Cannot find source header for module %s \
5811 in object %s")
5812 modul cs.cs_name;
5813 acc
5814 end)
5815 acc
5816 obj.obj_modules
5817 in
5818
5819 let acc =
5820 (* Get generated files *)
5821 BaseBuilt.fold
5822 BaseBuilt.BObj
5823 cs.cs_name
5824 (fun acc fn -> fn :: acc)
5825 acc
5826 in
5827
5828 let f_data () =
5829 (* Install data associated with the object *)
5830 install_data
5831 bs.bs_path
5832 bs.bs_data_files
5833 (Filename.concat
5834 (datarootdir ())
5835 pkg.name);
5836 f_data ()
5837 in
5838
5839 (f_data, acc)
5840 end
5841 else
5842 begin
5843 (f_data, acc)
5844 end
5845
49635846 in
49645847
49655848 (* Install one group of library *)
49705853 match grp with
49715854 | Container (_, children) ->
49725855 data_and_files, children
4973 | Package (_, cs, bs, lib, children) ->
5856 | Package (_, cs, bs, `Library lib, children) ->
49745857 files_of_library data_and_files (cs, bs, lib), children
5858 | Package (_, cs, bs, `Object obj, children) ->
5859 files_of_object data_and_files (cs, bs, obj), children
49755860 in
49765861 List.fold_left
49775862 install_group_lib_aux
50055890 begin
50065891 let meta =
50075892 (* Search META file *)
5008 let (_, bs, _) =
5893 let _, bs, _ =
50095894 root_lib
50105895 in
50115896 let res =
50185903 findlib_name;
50195904 res
50205905 in
5021 let files =
5906 let files =
50225907 (* Make filename shorter to avoid hitting command max line length
50235908 * too early, esp. on Windows.
50245909 *)
50275912 let nlen = String.length n in
50285913 if plen <= nlen && String.sub n 0 plen = p then
50295914 begin
5030 let fn_sep =
5915 let fn_sep =
50315916 if Sys.os_type = "Win32" then
50325917 '\\'
50335918 else
50345919 '/'
50355920 in
50365921 let cutpoint = plen +
5037 (if plen < nlen && n.[plen] = fn_sep then
5922 (if plen < nlen && n.[plen] = fn_sep then
50385923 1
5039 else
5924 else
50405925 0)
50415926 in
50425927 String.sub n cutpoint (nlen - cutpoint)
50435928 end
5044 else
5929 else
50455930 n
50465931 in
5047 List.map (remove_prefix (Sys.getcwd ())) files
5932 List.map (remove_prefix (Sys.getcwd ())) files
50485933 in
50495934 info
50505935 (f_ "Installing findlib library '%s'")
50785963
50795964 let install_execs pkg =
50805965 let install_exec data_exec =
5081 let (cs, bs, exec) =
5966 let cs, bs, exec =
50825967 !exec_hook data_exec
50835968 in
50845969 if var_choose bs.bs_install &&
51256010
51266011 let install_docs pkg =
51276012 let install_doc data =
5128 let (cs, doc) =
6013 let cs, doc =
51296014 !doc_hook data
51306015 in
51316016 if var_choose doc.doc_install &&
51606045 install_libs pkg;
51616046 install_execs pkg;
51626047 install_docs pkg
6048
51636049
51646050 (* Uninstall already installed data *)
51656051 let uninstall _ argv =
52246110 (BaseLog.filter
52256111 [install_file_ev;
52266112 install_dir_ev;
5227 install_findlib_ev;]))
6113 install_findlib_ev]))
6114
52286115
52296116 end
52306117
52316118
5232 # 5233 "setup.ml"
6119 # 6120 "setup.ml"
52336120 module OCamlbuildCommon = struct
5234 (* # 21 "src/plugins/ocamlbuild/OCamlbuildCommon.ml" *)
6121 (* # 22 "src/plugins/ocamlbuild/OCamlbuildCommon.ml" *)
6122
52356123
52366124 (** Functions common to OCamlbuild build and doc plugin
52376125 *)
6126
52386127
52396128 open OASISGettext
52406129 open BaseEnv
52416130 open BaseStandardVar
52426131
6132
52436133 let ocamlbuild_clean_ev =
52446134 "ocamlbuild-clean"
6135
52456136
52466137 let ocamlbuildflags =
52476138 var_define
52486139 ~short_desc:(fun () -> "OCamlbuild additional flags")
52496140 "ocamlbuildflags"
52506141 (fun () -> "")
6142
52516143
52526144 (** Fix special arguments depending on environment *)
52536145 let fix_args args extra_argv =
52876179 Array.to_list extra_argv;
52886180 ]
52896181
6182
52906183 (** Run 'ocamlbuild -clean' if not already done *)
52916184 let run_clean extra_argv =
52926185 let extra_cli =
53066199 ())
53076200 end
53086201
6202
53096203 (** Run ocamlbuild, unregister all clean events *)
53106204 let run_ocamlbuild args extra_argv =
53116205 (* TODO: enforce that target in args must be UNIX encoded i.e. toto/index.html
53176211 (fun (e, d) -> BaseLog.unregister e d)
53186212 (BaseLog.filter [ocamlbuild_clean_ev])
53196213
6214
53206215 (** Determine real build directory *)
53216216 let build_dir extra_argv =
53226217 let rec search_args dir =
53306225 in
53316226 search_args "_build" (fix_args [] extra_argv)
53326227
6228
53336229 end
53346230
53356231 module OCamlbuildPlugin = struct
5336 (* # 21 "src/plugins/ocamlbuild/OCamlbuildPlugin.ml" *)
6232 (* # 22 "src/plugins/ocamlbuild/OCamlbuildPlugin.ml" *)
6233
53376234
53386235 (** Build using ocamlbuild
53396236 @author Sylvain Le Gall
53406237 *)
53416238
6239
53426240 open OASISTypes
53436241 open OASISGettext
53446242 open OASISUtils
6243 open OASISString
53456244 open BaseEnv
53466245 open OCamlbuildCommon
53476246 open BaseStandardVar
53486247 open BaseMessage
53496248
6249
6250
6251
6252
53506253 let cond_targets_hook =
53516254 ref (fun lst -> lst)
53526255
5353 let build pkg argv =
5354
6256
6257 type ocamlbuild_plugin =
6258 {
6259 plugin_tags: string option;
6260 extra_args: string list;
6261 }
6262
6263
6264 let check_ocaml_version version pkg =
6265 match pkg.ocaml_version with
6266 | Some ocaml_version ->
6267 let min_ocaml_version = OASISVersion.version_of_string version in
6268 OASISVersion.comparator_ge min_ocaml_version ocaml_version
6269 | None ->
6270 false
6271
6272
6273 let ocamlbuild_supports_ocamlfind = check_ocaml_version "3.12.1"
6274 let ocamlbuild_supports_plugin_tags = check_ocaml_version "4.01"
6275
6276
6277 let build t pkg argv =
53556278 (* Return the filename in build directory *)
53566279 let in_build_dir fn =
53576280 Filename.concat
53766299 (cs, bs, lib)
53776300 in
53786301
5379 let ends_with nd fn =
5380 let nd_len =
5381 String.length nd
5382 in
5383 (String.length fn >= nd_len)
5384 &&
5385 (String.sub
5386 fn
5387 (String.length fn - nd_len)
5388 nd_len) = nd
5389 in
5390
53916302 let tgts =
53926303 List.flatten
53936304 (List.filter
53956306 (List.map
53966307 (List.filter
53976308 (fun fn ->
5398 ends_with ".cma" fn
5399 || ends_with ".cmxs" fn
5400 || ends_with ".cmxa" fn
5401 || ends_with (ext_lib ()) fn
5402 || ends_with (ext_dll ()) fn))
6309 ends_with ~what:".cma" fn
6310 || ends_with ~what:".cmxs" fn
6311 || ends_with ~what:".cmxa" fn
6312 || ends_with ~what:(ext_lib ()) fn
6313 || ends_with ~what:(ext_dll ()) fn))
54036314 unix_files))
54046315 in
54056316
54126323 cs.cs_name
54136324 end
54146325
6326 | Object (cs, bs, obj) when var_choose bs.bs_build ->
6327 begin
6328 let evs, unix_files =
6329 BaseBuilt.of_object
6330 in_build_dir_of_unix
6331 (cs, bs, obj)
6332 in
6333
6334 let tgts =
6335 List.flatten
6336 (List.filter
6337 (fun l -> l <> [])
6338 (List.map
6339 (List.filter
6340 (fun fn ->
6341 ends_with ".cmo" fn
6342 || ends_with ".cmx" fn))
6343 unix_files))
6344 in
6345
6346 match tgts with
6347 | _ :: _ ->
6348 (evs, tgts) :: acc
6349 | [] ->
6350 failwithf
6351 (f_ "No possible ocamlbuild targets for object %s")
6352 cs.cs_name
6353 end
6354
54156355 | Executable (cs, bs, exec) when var_choose bs.bs_build ->
54166356 begin
54176357 let evs, unix_exec_is, unix_dll_opt =
54276367 (OASISUnixPath.chop_extension
54286368 exec.exec_main_is))^ext
54296369 in
5430 let evs =
6370 let evs =
54316371 (* Fix evs, we want to use the unix_tgt, without copying *)
54326372 List.map
54336373 (function
54346374 | BaseBuilt.BExec, nm, lst when nm = cs.cs_name ->
5435 BaseBuilt.BExec, nm, [[in_build_dir_of_unix unix_tgt]]
6375 BaseBuilt.BExec, nm,
6376 [[in_build_dir_of_unix unix_tgt]]
54366377 | ev ->
54376378 ev)
54386379 evs
54546395 acc
54556396 end
54566397
5457 | Library _ | Executable _ | Test _
6398 | Library _ | Object _ | Executable _ | Test _
54586399 | SrcRepo _ | Flag _ | Doc _ ->
54596400 acc)
54606401 []
54686409 (fun fns ->
54696410 if not (List.exists OASISFileUtil.file_exists_case fns) then
54706411 failwithf
5471 (f_ "No one of expected built files %s exists")
5472 (String.concat (s_ ", ") (List.map (Printf.sprintf "'%s'") fns)))
6412 (fn_
6413 "Expected built file %s doesn't exist."
6414 "None of expected built files %s exists."
6415 (List.length fns))
6416 (String.concat (s_ " or ") (List.map (Printf.sprintf "'%s'") fns)))
54736417 lst;
54746418 (BaseBuilt.register bt bnm lst)
54756419 in
54796423 !cond_targets_hook cond_targets
54806424 in
54816425
6426 let extra_args =
6427 match t.plugin_tags with
6428 | Some tags -> "-plugin-tags" :: ("'" ^ tags ^ "'") :: t.extra_args
6429 | None -> t.extra_args
6430 in
6431 let extra_args =
6432 if ocamlbuild_supports_ocamlfind pkg then
6433 "-use-ocamlfind" :: extra_args
6434 else
6435 extra_args
6436 in
6437
54826438 (* Run a list of target... *)
5483 run_ocamlbuild
5484 (List.flatten
5485 (List.map snd cond_targets))
6439 run_ocamlbuild
6440 (List.flatten
6441 (List.map snd cond_targets)
6442 @ extra_args)
54866443 argv;
54876444 (* ... and register events *)
54886445 List.iter
55036460 ())
55046461 pkg.sections
55056462
6463
55066464 end
55076465
55086466 module OCamlbuildDocPlugin = struct
5509 (* # 21 "src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml" *)
6467 (* # 22 "src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml" *)
6468
55106469
55116470 (* Create documentation using ocamlbuild .odocl files
55126471 @author Sylvain Le Gall
55136472 *)
6473
55146474
55156475 open OASISTypes
55166476 open OASISGettext
55176477 open OASISMessage
55186478 open OCamlbuildCommon
55196479 open BaseStandardVar
6480
6481
55206482
55216483
55226484
55476509 (Filename.concat tgt_dir glb)])
55486510 ["*.html"; "*.css"]
55496511
6512
55506513 let doc_clean t pkg (cs, doc) argv =
55516514 run_clean argv;
55526515 BaseBuilt.unregister BaseBuilt.BDoc cs.cs_name
55536516
6517
55546518 end
55556519
55566520
5557 # 5558 "setup.ml"
6521 # 6522 "setup.ml"
55586522 open OASISTypes;;
55596523
55606524 let setup_t =
55616525 {
55626526 BaseSetup.configure = InternalConfigurePlugin.configure;
5563 build = OCamlbuildPlugin.build;
6527 build =
6528 OCamlbuildPlugin.build
6529 {OCamlbuildPlugin.plugin_tags = None; extra_args = []};
55646530 test = [];
55656531 doc = [("API", OCamlbuildDocPlugin.doc_build ".")];
55666532 install = InternalInstallPlugin.install;
55736539 distclean_doc = [];
55746540 package =
55756541 {
5576 oasis_version = "0.3";
6542 oasis_version = "0.4";
55776543 ocaml_version = Some (OASISVersion.VGreaterEqual "3.12");
55786544 findlib_version = Some (OASISVersion.VGreaterEqual "1.3.1");
6545 alpha_features = [];
6546 beta_features = [];
55796547 name = "postgresql-ocaml";
5580 version = "2.0.4";
6548 version = "2.0.5";
55816549 license =
55826550 OASISLicense.DEP5License
55836551 (OASISLicense.DEP5Unit
55846552 {
55856553 OASISLicense.license = "LGPL";
55866554 excption = Some "OCaml linking";
5587 version = OASISLicense.VersionOrLater "2.1";
5588 });
6555 version = OASISLicense.VersionOrLater "2.1"
6556 });
55896557 license_file = Some "COPYING.txt";
55906558 copyrights =
55916559 [
56086576 Some
56096577 "postgresql-ocaml offers library functions for accessing PostgreSQL databases";
56106578 categories = [];
5611 conf_type = (`Configure, "internal", Some "0.3");
6579 conf_type = (`Configure, "internal", Some "0.4");
56126580 conf_custom =
56136581 {
56146582 pre_command = [(OASISExpr.EBool true, None)];
5615 post_command = [(OASISExpr.EBool true, None)];
5616 };
5617 build_type = (`Build, "ocamlbuild", Some "0.3");
6583 post_command = [(OASISExpr.EBool true, None)]
6584 };
6585 build_type = (`Build, "ocamlbuild", Some "0.4");
56186586 build_custom =
56196587 {
56206588 pre_command = [(OASISExpr.EBool true, None)];
5621 post_command = [(OASISExpr.EBool true, None)];
5622 };
5623 install_type = (`Install, "internal", Some "0.3");
6589 post_command = [(OASISExpr.EBool true, None)]
6590 };
6591 install_type = (`Install, "internal", Some "0.4");
56246592 install_custom =
56256593 {
56266594 pre_command = [(OASISExpr.EBool true, None)];
5627 post_command = [(OASISExpr.EBool true, None)];
5628 };
6595 post_command = [(OASISExpr.EBool true, None)]
6596 };
56296597 uninstall_custom =
56306598 {
56316599 pre_command = [(OASISExpr.EBool true, None)];
5632 post_command = [(OASISExpr.EBool true, None)];
5633 };
6600 post_command = [(OASISExpr.EBool true, None)]
6601 };
56346602 clean_custom =
56356603 {
56366604 pre_command = [(OASISExpr.EBool true, None)];
5637 post_command = [(OASISExpr.EBool true, None)];
5638 };
6605 post_command = [(OASISExpr.EBool true, None)]
6606 };
56396607 distclean_custom =
56406608 {
56416609 pre_command = [(OASISExpr.EBool true, None)];
5642 post_command = [(OASISExpr.EBool true, None)];
5643 };
6610 post_command = [(OASISExpr.EBool true, None)]
6611 };
56446612 files_ab = [];
56456613 sections =
56466614 [
56486616 ({
56496617 cs_name = "strict";
56506618 cs_data = PropList.Data.create ();
5651 cs_plugin_data = [];
5652 },
6619 cs_plugin_data = []
6620 },
56536621 {
56546622 flag_description = Some "Strict compile-time checks";
5655 flag_default = [(OASISExpr.EBool true, true)];
5656 });
6623 flag_default = [(OASISExpr.EBool true, true)]
6624 });
56576625 Library
56586626 ({
56596627 cs_name = "postgresql";
56606628 cs_data = PropList.Data.create ();
5661 cs_plugin_data = [];
5662 },
6629 cs_plugin_data = []
6630 },
56636631 {
56646632 bs_build = [(OASISExpr.EBool true, true)];
56656633 bs_install = [(OASISExpr.EBool true, true)];
56976665 bs_dlllib = [(OASISExpr.EBool true, [])];
56986666 bs_dllpath = [(OASISExpr.EBool true, [])];
56996667 bs_byteopt = [(OASISExpr.EBool true, [])];
5700 bs_nativeopt = [(OASISExpr.EBool true, [])];
5701 },
6668 bs_nativeopt = [(OASISExpr.EBool true, [])]
6669 },
57026670 {
57036671 lib_modules = ["Postgresql"];
57046672 lib_pack = false;
57056673 lib_internal_modules = [];
57066674 lib_findlib_parent = None;
57076675 lib_findlib_name = Some "postgresql";
5708 lib_findlib_containers = [];
5709 });
6676 lib_findlib_containers = []
6677 });
57106678 Flag
57116679 ({
57126680 cs_name = "examples";
57136681 cs_data = PropList.Data.create ();
5714 cs_plugin_data = [];
5715 },
6682 cs_plugin_data = []
6683 },
57166684 {
57176685 flag_description = Some "Build examples";
5718 flag_default = [(OASISExpr.EBool true, true)];
5719 });
6686 flag_default = [(OASISExpr.EBool true, true)]
6687 });
57206688 Executable
57216689 ({
57226690 cs_name = "cursor";
57236691 cs_data = PropList.Data.create ();
5724 cs_plugin_data = [];
5725 },
6692 cs_plugin_data = []
6693 },
57266694 {
57276695 bs_build =
57286696 [
57426710 bs_dlllib = [(OASISExpr.EBool true, [])];
57436711 bs_dllpath = [(OASISExpr.EBool true, [])];
57446712 bs_byteopt = [(OASISExpr.EBool true, [])];
5745 bs_nativeopt = [(OASISExpr.EBool true, [])];
5746 },
5747 {exec_custom = false; exec_main_is = "cursor.ml"; });
6713 bs_nativeopt = [(OASISExpr.EBool true, [])]
6714 },
6715 {exec_custom = false; exec_main_is = "cursor.ml"});
57486716 Executable
57496717 ({
57506718 cs_name = "dump";
57516719 cs_data = PropList.Data.create ();
5752 cs_plugin_data = [];
5753 },
6720 cs_plugin_data = []
6721 },
57546722 {
57556723 bs_build =
57566724 [
57706738 bs_dlllib = [(OASISExpr.EBool true, [])];
57716739 bs_dllpath = [(OASISExpr.EBool true, [])];
57726740 bs_byteopt = [(OASISExpr.EBool true, [])];
5773 bs_nativeopt = [(OASISExpr.EBool true, [])];
5774 },
5775 {exec_custom = false; exec_main_is = "dump.ml"; });
6741 bs_nativeopt = [(OASISExpr.EBool true, [])]
6742 },
6743 {exec_custom = false; exec_main_is = "dump.ml"});
57766744 Executable
57776745 ({
57786746 cs_name = "populate";
57796747 cs_data = PropList.Data.create ();
5780 cs_plugin_data = [];
5781 },
6748 cs_plugin_data = []
6749 },
57826750 {
57836751 bs_build =
57846752 [
57986766 bs_dlllib = [(OASISExpr.EBool true, [])];
57996767 bs_dllpath = [(OASISExpr.EBool true, [])];
58006768 bs_byteopt = [(OASISExpr.EBool true, [])];
5801 bs_nativeopt = [(OASISExpr.EBool true, [])];
5802 },
5803 {exec_custom = false; exec_main_is = "populate.ml"; });
6769 bs_nativeopt = [(OASISExpr.EBool true, [])]
6770 },
6771 {exec_custom = false; exec_main_is = "populate.ml"});
58046772 Executable
58056773 ({
58066774 cs_name = "prompt";
58076775 cs_data = PropList.Data.create ();
5808 cs_plugin_data = [];
5809 },
6776 cs_plugin_data = []
6777 },
58106778 {
58116779 bs_build =
58126780 [
58266794 bs_dlllib = [(OASISExpr.EBool true, [])];
58276795 bs_dllpath = [(OASISExpr.EBool true, [])];
58286796 bs_byteopt = [(OASISExpr.EBool true, [])];
5829 bs_nativeopt = [(OASISExpr.EBool true, [])];
5830 },
5831 {exec_custom = false; exec_main_is = "prompt.ml"; });
6797 bs_nativeopt = [(OASISExpr.EBool true, [])]
6798 },
6799 {exec_custom = false; exec_main_is = "prompt.ml"});
58326800 Flag
58336801 ({
58346802 cs_name = "lablgtk2";
58356803 cs_data = PropList.Data.create ();
5836 cs_plugin_data = [];
5837 },
6804 cs_plugin_data = []
6805 },
58386806 {
58396807 flag_description =
58406808 Some "Build applications depending on lablgtk2";
5841 flag_default = [(OASISExpr.EBool true, false)];
5842 });
6809 flag_default = [(OASISExpr.EBool true, false)]
6810 });
58436811 Executable
58446812 ({
58456813 cs_name = "prompt_gtk";
58466814 cs_data = PropList.Data.create ();
5847 cs_plugin_data = [];
5848 },
6815 cs_plugin_data = []
6816 },
58496817 {
58506818 bs_build =
58516819 [
58726840 bs_dlllib = [(OASISExpr.EBool true, [])];
58736841 bs_dllpath = [(OASISExpr.EBool true, [])];
58746842 bs_byteopt = [(OASISExpr.EBool true, [])];
5875 bs_nativeopt = [(OASISExpr.EBool true, [])];
5876 },
5877 {exec_custom = false; exec_main_is = "prompt_gtk.ml"; });
6843 bs_nativeopt = [(OASISExpr.EBool true, [])]
6844 },
6845 {exec_custom = false; exec_main_is = "prompt_gtk.ml"});
58786846 Executable
58796847 ({
58806848 cs_name = "test_lo";
58816849 cs_data = PropList.Data.create ();
5882 cs_plugin_data = [];
5883 },
6850 cs_plugin_data = []
6851 },
58846852 {
58856853 bs_build =
58866854 [
59006868 bs_dlllib = [(OASISExpr.EBool true, [])];
59016869 bs_dllpath = [(OASISExpr.EBool true, [])];
59026870 bs_byteopt = [(OASISExpr.EBool true, [])];
5903 bs_nativeopt = [(OASISExpr.EBool true, [])];
5904 },
5905 {exec_custom = false; exec_main_is = "test_lo.ml"; });
6871 bs_nativeopt = [(OASISExpr.EBool true, [])]
6872 },
6873 {exec_custom = false; exec_main_is = "test_lo.ml"});
59066874 Doc
59076875 ({
59086876 cs_name = "API";
59096877 cs_data = PropList.Data.create ();
5910 cs_plugin_data = [];
5911 },
6878 cs_plugin_data = []
6879 },
59126880 {
5913 doc_type = (`Doc, "OCamlbuild", Some "0.3");
6881 doc_type = (`Doc, "OCamlbuild", Some "0.4");
59146882 doc_custom =
59156883 {
59166884 pre_command = [(OASISExpr.EBool true, None)];
5917 post_command = [(OASISExpr.EBool true, None)];
5918 };
6885 post_command = [(OASISExpr.EBool true, None)]
6886 };
59196887 doc_build =
59206888 [
59216889 (OASISExpr.ENot (OASISExpr.EFlag "docs"), false);
59296897 doc_format = OtherDoc;
59306898 doc_data_files = [];
59316899 doc_build_tools =
5932 [ExternalTool "ocamldoc"; ExternalTool "ocamlbuild"];
5933 });
6900 [ExternalTool "ocamldoc"; ExternalTool "ocamlbuild"]
6901 });
59346902 SrcRepo
59356903 ({
59366904 cs_name = "trunk";
59376905 cs_data = PropList.Data.create ();
5938 cs_plugin_data = [];
5939 },
6906 cs_plugin_data = []
6907 },
59406908 {
59416909 src_repo_type = Hg;
59426910 src_repo_location =
59466914 src_repo_module = None;
59476915 src_repo_branch = None;
59486916 src_repo_tag = Some "release-$(pkg_version)";
5949 src_repo_subdir = None;
5950 })
6917 src_repo_subdir = None
6918 })
59516919 ];
59526920 plugins =
59536921 [
5954 (`Extra, "META", Some "0.3");
5955 (`Extra, "StdFiles", Some "0.3");
5956 (`Extra, "DevFiles", Some "0.3")
6922 (`Extra, "META", Some "0.4");
6923 (`Extra, "StdFiles", Some "0.4");
6924 (`Extra, "DevFiles", Some "0.4")
59576925 ];
59586926 schema_data = PropList.Data.create ();
5959 plugin_data = [];
5960 };
6927 plugin_data = []
6928 };
59616929 oasis_fn = Some "_oasis";
5962 oasis_version = "0.3.0";
5963 oasis_digest = Some "\007Cμμϊ6J₯Θ!\140'\159\132ΓN";
6930 oasis_version = "0.4.0";
6931 oasis_digest = Some "Õ<\015Äjþ!u>*\025b¤|\012\003";
59646932 oasis_exec = None;
59656933 oasis_setup_args = [];
5966 setup_update = false;
5967 };;
6934 setup_update = false
6935 };;
59686936
59696937 let setup () = BaseSetup.setup setup_t;;
59706938
5971 # 5973 "setup.ml"
6939 # 6941 "setup.ml"
59726940 (* OASIS_STOP *)
59736941 let () = setup ();;