mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
46 lines
2.0 KiB
Diff
46 lines
2.0 KiB
Diff
Author: Vincent Laporte <Vincent.Laporte@gmail.com>
|
|
Date: Sun Feb 1 11:19:50 2015 +0100
|
|
|
|
ocamlbuild: use ocamlfind to discover camlp4 path
|
|
|
|
and default to `+camlp4`
|
|
|
|
diff --git a/ocamlbuild/ocaml_specific.ml b/ocamlbuild/ocaml_specific.ml
|
|
index b902810..a73b7a5 100644
|
|
--- a/ocamlbuild/ocaml_specific.ml
|
|
+++ b/ocamlbuild/ocaml_specific.ml
|
|
@@ -698,15 +698,25 @@ ocaml_lib ~extern:true ~tag_name:"use_toplevel" "toplevellib";;
|
|
ocaml_lib ~extern:true ~dir:"+ocamldoc" "ocamldoc";;
|
|
ocaml_lib ~extern:true ~dir:"+ocamlbuild" ~tag_name:"use_ocamlbuild" "ocamlbuildlib";;
|
|
|
|
-ocaml_lib ~extern:true ~dir:"+camlp4" ~tag_name:"use_camlp4" "camlp4lib";;
|
|
-ocaml_lib ~extern:true ~dir:"+camlp4" ~tag_name:"use_old_camlp4" "camlp4";;
|
|
-ocaml_lib ~extern:true ~dir:"+camlp4" ~tag_name:"use_camlp4_full" "camlp4fulllib";;
|
|
+let camlp4dir =
|
|
+ Findlib.(
|
|
+ try
|
|
+ if sys_command "sh -c 'ocamlfind list >/dev/null' 2>/dev/null" != 0
|
|
+ then raise (Findlib_error Cannot_run_ocamlfind);
|
|
+ (query "camlp4").location
|
|
+ with Findlib_error _ ->
|
|
+ "+camlp4"
|
|
+ );;
|
|
+
|
|
+ocaml_lib ~extern:true ~dir:camlp4dir ~tag_name:"use_camlp4" "camlp4lib";;
|
|
+ocaml_lib ~extern:true ~dir:camlp4dir ~tag_name:"use_old_camlp4" "camlp4";;
|
|
+ocaml_lib ~extern:true ~dir:camlp4dir ~tag_name:"use_camlp4_full" "camlp4fulllib";;
|
|
flag ["ocaml"; "compile"; "use_camlp4_full"]
|
|
- (S[A"-I"; A"+camlp4/Camlp4Parsers";
|
|
- A"-I"; A"+camlp4/Camlp4Printers";
|
|
- A"-I"; A"+camlp4/Camlp4Filters"]);;
|
|
-flag ["ocaml"; "use_camlp4_bin"; "link"; "byte"] (A"+camlp4/Camlp4Bin.cmo");;
|
|
-flag ["ocaml"; "use_camlp4_bin"; "link"; "native"] (A"+camlp4/Camlp4Bin.cmx");;
|
|
+ (S[A"-I"; A(camlp4dir^"/Camlp4Parsers");
|
|
+ A"-I"; A(camlp4dir^"/Camlp4Printers");
|
|
+ A"-I"; A(camlp4dir^"/Camlp4Filters")]);;
|
|
+flag ["ocaml"; "use_camlp4_bin"; "link"; "byte"] (A(camlp4dir^"/Camlp4Bin.cmo"));;
|
|
+flag ["ocaml"; "use_camlp4_bin"; "link"; "native"] (A(camlp4dir^"/Camlp4Bin.cmx"));;
|
|
|
|
flag ["ocaml"; "debug"; "compile"; "byte"] (A "-g");;
|
|
flag ["ocaml"; "debug"; "link"; "byte"; "program"] (A "-g");;
|