fork
Configure Feed
Select the types of activity you want to include in your feed.
lol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{ lib, stdenv, fetchurl, ncurses, ocaml, writeText }:
2
3stdenv.mkDerivation rec {
4 pname = "ocaml${ocaml.version}-findlib";
5 version = "1.9.6";
6
7 src = fetchurl {
8 url = "http://download.camlcity.org/download/findlib-${version}.tar.gz";
9 sha256 = "sha256-LfmWJ5rha2Bttf9Yefk9v63giY258aPoL3+EX6opMKI=";
10 };
11
12 nativeBuildInputs = [ ocaml ];
13 buildInputs = lib.optional (lib.versionOlder ocaml.version "4.07") ncurses;
14
15 patches = [ ./ldconf.patch ./install_topfind.patch ];
16
17 dontAddPrefix=true;
18 dontAddStaticConfigureFlags = true;
19 configurePlatforms = [];
20
21 configureFlags = [
22 "-bindir" "${placeholder "out"}/bin"
23 "-mandir" "${placeholder "out"}/share/man"
24 "-sitelib" "${placeholder "out"}/lib/ocaml/${ocaml.version}/site-lib"
25 "-config" "${placeholder "out"}/etc/findlib.conf"
26 ];
27
28 buildFlags = [ "all" "opt" ];
29
30 setupHook = writeText "setupHook.sh" ''
31 addOCamlPath () {
32 if test -d "''$1/lib/ocaml/${ocaml.version}/site-lib"; then
33 export OCAMLPATH="''${OCAMLPATH-}''${OCAMLPATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/"
34 fi
35 if test -d "''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs"; then
36 export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs"
37 fi
38 }
39 exportOcamlDestDir () {
40 export OCAMLFIND_DESTDIR="''$out/lib/ocaml/${ocaml.version}/site-lib/"
41 }
42 createOcamlDestDir () {
43 if test -n "''${createFindlibDestdir-}"; then
44 mkdir -p $OCAMLFIND_DESTDIR
45 fi
46 }
47 detectOcamlConflicts () {
48 local conflict
49 conflict="$(ocamlfind list |& grep "has multiple definitions" || true)"
50 if [[ -n "$conflict" ]]; then
51 echo "Conflicting ocaml packages detected";
52 echo "$conflict"
53 echo "Set dontDetectOcamlConflicts to true to disable this check."
54 exit 1
55 fi
56 }
57
58 # run for every buildInput
59 addEnvHooks "$targetOffset" addOCamlPath
60 # run before installPhase, even without buildInputs, and not in nix-shell
61 preInstallHooks+=(createOcamlDestDir)
62 # run even in nix-shell, and even without buildInputs
63 addEnvHooks "$hostOffset" exportOcamlDestDir
64 # runs after all calls to addOCamlPath
65 if [[ -z "''${dontDetectOcamlConflicts-}" ]]; then
66 postHooks+=("detectOcamlConflicts")
67 fi
68 '';
69
70 meta = {
71 description = "O'Caml library manager";
72 homepage = "http://projects.camlcity.org/projects/findlib.html";
73 license = lib.licenses.mit;
74 maintainers = with lib.maintainers; [ maggesi vbmithr ];
75 mainProgram = "ocamlfind";
76 platforms = ocaml.meta.platforms or [];
77 };
78}
79
80