1
1
(* OASIS_START *)
2
- (* DO NOT EDIT (digest: 3e1cc8469630fbc253bc2218e937c7f6 ) *)
2
+ (* DO NOT EDIT (digest: 2f6db32590a6b778a4f6a9b9c2878dd1 ) *)
3
3
module OASISGettext = struct
4
4
(* # 22 "src/oasis/OASISGettext.ml" *)
5
5
@@ -249,6 +249,9 @@ module MyOCamlbuildFindlib = struct
249
249
*)
250
250
open Ocamlbuild_plugin
251
251
252
+ type conf =
253
+ { no_automatic_syntax : bool ;
254
+ }
252
255
253
256
(* these functions are not really officially exported *)
254
257
let run_and_read =
@@ -315,7 +318,7 @@ module MyOCamlbuildFindlib = struct
315
318
316
319
(* This lists all supported packages. *)
317
320
let find_packages () =
318
- List. map before_space (split_nl & run_and_read " ocamlfind list" )
321
+ List. map before_space (split_nl & run_and_read (exec_from_conf " ocamlfind" ^ " list" ) )
319
322
320
323
321
324
(* Mock to list available syntaxes. *)
@@ -338,7 +341,7 @@ module MyOCamlbuildFindlib = struct
338
341
]
339
342
340
343
341
- let dispatch =
344
+ let dispatch conf =
342
345
function
343
346
| After_options ->
344
347
(* By using Before_options one let command line options have an higher
@@ -357,31 +360,39 @@ module MyOCamlbuildFindlib = struct
357
360
* -linkpkg *)
358
361
flag [" ocaml" ; " link" ; " program" ] & A " -linkpkg" ;
359
362
360
- (* For each ocamlfind package one inject the -package option when
361
- * compiling, computing dependencies, generating documentation and
362
- * linking. *)
363
- List. iter
364
- begin fun pkg ->
365
- let base_args = [A " -package" ; A pkg] in
366
- (* TODO: consider how to really choose camlp4o or camlp4r. *)
367
- let syn_args = [A " -syntax" ; A " camlp4o" ] in
368
- let args =
369
- (* Heuristic to identify syntax extensions: whether they end in
370
- ".syntax"; some might not.
371
- *)
372
- if Filename. check_suffix pkg " syntax" ||
373
- List. mem pkg well_known_syntax then
374
- syn_args @ base_args
375
- else
376
- base_args
377
- in
378
- flag [" ocaml" ; " compile" ; " pkg_" ^ pkg] & S args;
379
- flag [" ocaml" ; " ocamldep" ; " pkg_" ^ pkg] & S args;
380
- flag [" ocaml" ; " doc" ; " pkg_" ^ pkg] & S args;
381
- flag [" ocaml" ; " link" ; " pkg_" ^ pkg] & S base_args;
382
- flag [" ocaml" ; " infer_interface" ; " pkg_" ^ pkg] & S args;
383
- end
384
- (find_packages () );
363
+ if not (conf.no_automatic_syntax) then begin
364
+ (* For each ocamlfind package one inject the -package option when
365
+ * compiling, computing dependencies, generating documentation and
366
+ * linking. *)
367
+ List. iter
368
+ begin fun pkg ->
369
+ let base_args = [A " -package" ; A pkg] in
370
+ (* TODO: consider how to really choose camlp4o or camlp4r. *)
371
+ let syn_args = [A " -syntax" ; A " camlp4o" ] in
372
+ let (args, pargs) =
373
+ (* Heuristic to identify syntax extensions: whether they end in
374
+ ".syntax"; some might not.
375
+ *)
376
+ if Filename. check_suffix pkg " syntax" ||
377
+ List. mem pkg well_known_syntax then
378
+ (syn_args @ base_args, syn_args)
379
+ else
380
+ (base_args, [] )
381
+ in
382
+ flag [" ocaml" ; " compile" ; " pkg_" ^ pkg] & S args;
383
+ flag [" ocaml" ; " ocamldep" ; " pkg_" ^ pkg] & S args;
384
+ flag [" ocaml" ; " doc" ; " pkg_" ^ pkg] & S args;
385
+ flag [" ocaml" ; " link" ; " pkg_" ^ pkg] & S base_args;
386
+ flag [" ocaml" ; " infer_interface" ; " pkg_" ^ pkg] & S args;
387
+
388
+ (* TODO: Check if this is allowed for OCaml < 3.12.1 *)
389
+ flag [" ocaml" ; " compile" ; " package(" ^ pkg^ " )" ] & S pargs;
390
+ flag [" ocaml" ; " ocamldep" ; " package(" ^ pkg^ " )" ] & S pargs;
391
+ flag [" ocaml" ; " doc" ; " package(" ^ pkg^ " )" ] & S pargs;
392
+ flag [" ocaml" ; " infer_interface" ; " package(" ^ pkg^ " )" ] & S pargs;
393
+ end
394
+ (find_packages () );
395
+ end;
385
396
386
397
(* Like -package but for extensions syntax. Morover -syntax is useless
387
398
* when linking. *)
@@ -546,12 +557,13 @@ module MyOCamlbuildBase = struct
546
557
547
558
(* When ocaml link something that use the C library, then one
548
559
need that file to be up to date.
560
+ This holds both for programs and for libraries.
549
561
*)
550
- dep [" link" ; " ocaml" ; " program " ; tag_libstubs lib]
551
- [dir/ " lib" ^ (nm_libstubs lib)^ " ." ^ (! Options. ext_lib)];
562
+ dep [" link" ; " ocaml" ; tag_libstubs lib]
563
+ [dir/ " lib" ^ (nm_libstubs lib)^ " ." ^ (! Options. ext_lib)];
552
564
553
- dep [" compile" ; " ocaml" ; " program " ; tag_libstubs lib]
554
- [dir/ " lib" ^ (nm_libstubs lib)^ " ." ^ (! Options. ext_lib)];
565
+ dep [" compile" ; " ocaml" ; tag_libstubs lib]
566
+ [dir/ " lib" ^ (nm_libstubs lib)^ " ." ^ (! Options. ext_lib)];
555
567
556
568
(* TODO: be more specific about what depends on headers *)
557
569
(* Depends on .h files *)
@@ -580,18 +592,18 @@ module MyOCamlbuildBase = struct
580
592
()
581
593
582
594
583
- let dispatch_default t =
595
+ let dispatch_default conf t =
584
596
dispatch_combine
585
597
[
586
598
dispatch t;
587
- MyOCamlbuildFindlib. dispatch;
599
+ MyOCamlbuildFindlib. dispatch conf ;
588
600
]
589
601
590
602
591
603
end
592
604
593
605
594
- # 594 " myocamlbuild.ml"
606
+ # 606 " myocamlbuild.ml"
595
607
open Ocamlbuild_plugin ;;
596
608
let package_default =
597
609
{
@@ -647,9 +659,11 @@ let package_default =
647
659
}
648
660
;;
649
661
650
- let dispatch_default = MyOCamlbuildBase. dispatch_default package_default;;
662
+ let conf = {MyOCamlbuildFindlib. no_automatic_syntax = false }
663
+
664
+ let dispatch_default = MyOCamlbuildBase. dispatch_default conf package_default;;
651
665
652
- # 653 " myocamlbuild.ml"
666
+ # 667 " myocamlbuild.ml"
653
667
(* OASIS_STOP *)
654
668
655
669
let () =
@@ -710,6 +724,4 @@ let () =
710
724
flag [" oasis_library_postgresql_cclib" ; " link" ] opgsql_clibs
711
725
| _ -> ()
712
726
in
713
- dispatch (
714
- MyOCamlbuildBase. dispatch_combine
715
- [MyOCamlbuildBase. dispatch_default package_default; additional_rules])
727
+ dispatch (MyOCamlbuildBase. dispatch_combine [dispatch_default; additional_rules])
0 commit comments