Skip to content

Commit

Permalink
ocaml: add local copy of the ocamlbuild patch
Browse files Browse the repository at this point in the history
  • Loading branch information
vbgl committed Nov 28, 2015
1 parent 8cd52ce commit a3fa690
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
6 changes: 1 addition & 5 deletions pkgs/development/compilers/ocaml/4.02.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -28,7 +24,7 @@ stdenv.mkDerivation rec {
sha256 = "1qwwvy8nzd87hk8rd9sm667nppakiapnx4ypdwcrlnav2dz6kil3";
};

patches = [ patchOcamlBuild ];
patches = [ ./ocamlbuild.patch ];

prefixKey = "-prefix ";
configureFlags = optionals useX11 [ "-x11lib" x11lib
Expand Down
45 changes: 45 additions & 0 deletions pkgs/development/compilers/ocaml/ocamlbuild.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Author: Vincent Laporte <[email protected]>
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");;

0 comments on commit a3fa690

Please sign in to comment.