3
0
Fork 0
forked from mirrors/nixpkgs

ocaml: add local copy of the ocamlbuild patch

This commit is contained in:
Vincent Laporte 2015-11-28 09:48:55 +01:00
parent 8cd52ce5f7
commit a3fa690fa2
2 changed files with 46 additions and 5 deletions

View file

@ -9,10 +9,6 @@ assert useX11 -> !stdenv.isArm && !stdenv.isMips;
let
useNativeCompilers = !stdenv.isMips;
inherit (stdenv.lib) optionals optionalString;
patchOcamlBuild = fetchurl {
url = https://github.com/ocaml/ocaml/pull/117.patch;
sha256 = "0x2cdn2sgzq29qzqg5y2ial0jqy8gjg5a7jf8qqch55dc4vkyjw0";
};
in
stdenv.mkDerivation rec {
@ -28,7 +24,7 @@ stdenv.mkDerivation rec {
sha256 = "1qwwvy8nzd87hk8rd9sm667nppakiapnx4ypdwcrlnav2dz6kil3";
};
patches = [ patchOcamlBuild ];
patches = [ ./ocamlbuild.patch ];
prefixKey = "-prefix ";
configureFlags = optionals useX11 [ "-x11lib" x11lib

View file

@ -0,0 +1,45 @@
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");;