ocamlbuild: use ocamlfind to discover camlp4 path

and default to `+camlp4`
master
Vincent Laporte 2015-02-01 11:19:50 +01:00
parent 5cdb5a7b4e
commit abb35cbdb1
2 changed files with 20 additions and 8 deletions

View File

@ -226,6 +226,8 @@ OCamlbuild:
- Changed OCamlbuild's license to LGPLv2 with static linking exception.
- GPR#219: speedup target-already-built builds
(ygrek)
- PR#6605, GPR#117: use ocamlfind, if available, to discover camlp4 path
(Vincent Laporte)
Bug fixes:
- PR#3612: memory leak in bigarray read from file

View File

@ -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");;