* Remove the automatic creation of a directory from the setupHook of findlib since...
[nixpkgs-libre.git] / pkgs / development / tools / ocaml / findlib / default.nix
blob9a2a6b0d94ab7d8e3ced1de213c76205fd500055
1 {stdenv, fetchurl, m4, ncurses, ocaml, writeText}:
3 let
4   ocaml_version = (builtins.parseDrvName ocaml.name).version;
5   version = "1.2.6";
6 in
8 stdenv.mkDerivation {
9   name = "ocaml-findlib-${version}";
11   src = fetchurl {
12     url = "http://download.camlcity.org/download/findlib-${version}.tar.gz";
13     sha256 = "1b6z5lylsjxxaifw2yc21cs0dc84zqi4q57sgwg4j8k3m60ivpxs";
14   };
16   buildInputs = [m4 ncurses ocaml];
18   patches = [ ./ldconf.patch ];
20   dontAddPrefix=true;
22   preConfigure=''
23     configureFlagsArray=(
24       -bindir $out/bin
25       -mandir $out/share/man
26       -sitelib $out/lib/ocaml/${ocaml_version}/site-lib
27       -config $out/etc/findlib.conf
28       -no-topfind
29     )
30   '';
32   buildPhase = ''
33     make all
34     make opt
35   '';
37   setupHook = writeText "setupHook.sh" ''
38     addOCamlPath () {
39         if test -d "''$1/lib/ocaml/${ocaml_version}/site-lib"; then
40             export OCAMLPATH="''${OCAMLPATH}''${OCAMLPATH:+:}''$1/lib/ocaml/${ocaml_version}/site-lib/"
41         fi
42         export OCAMLFIND_DESTDIR="''$out/lib/ocaml/${ocaml_version}/site-lib/"
43     }
44     
45     envHooks=(''${envHooks[@]} addOCamlPath)
46   '';
48   meta = {
49     homepage = http://projects.camlcity.org/projects/findlib.html;
50     description = "O'Caml library manager";
51     license = "MIT/X11";
52     platforms = ocaml.meta.platforms;
53     maintainers = [
54       stdenv.lib.maintainers.z77z
55     ];
56   };