about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/ocaml/findlib
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/tools/ocaml/findlib')
-rw-r--r--nixpkgs/pkgs/development/tools/ocaml/findlib/default.nix61
-rw-r--r--nixpkgs/pkgs/development/tools/ocaml/findlib/install_topfind.patch12
-rw-r--r--nixpkgs/pkgs/development/tools/ocaml/findlib/ldconf.patch8
3 files changed, 81 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/tools/ocaml/findlib/default.nix b/nixpkgs/pkgs/development/tools/ocaml/findlib/default.nix
new file mode 100644
index 000000000000..2286c0945fcf
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/ocaml/findlib/default.nix
@@ -0,0 +1,61 @@
+{ lib, stdenv, fetchurl, fetchpatch, m4, ncurses, ocaml, writeText }:
+
+stdenv.mkDerivation rec {
+  pname = "ocaml-findlib";
+  version = "1.9.1";
+
+  src = fetchurl {
+    url = "http://download.camlcity.org/download/findlib-${version}.tar.gz";
+    sha256 = "sha256-K0K4vVRIjWTEvzy3BUtLN70wwdwSvUMeoeTXrYqYD+I=";
+  };
+
+  buildInputs = [m4 ncurses ocaml];
+
+  patches = [ ./ldconf.patch ./install_topfind.patch ];
+
+  dontAddPrefix=true;
+
+  preConfigure=''
+    configureFlagsArray=(
+      -bindir $out/bin
+      -mandir $out/share/man
+      -sitelib $out/lib/ocaml/${ocaml.version}/site-lib
+      -config $out/etc/findlib.conf
+    )
+  '';
+
+  buildPhase = ''
+    make all
+    make opt
+  '';
+
+  setupHook = writeText "setupHook.sh" ''
+    addOCamlPath () {
+        if test -d "''$1/lib/ocaml/${ocaml.version}/site-lib"; then
+            export OCAMLPATH="''${OCAMLPATH-}''${OCAMLPATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/"
+        fi
+        if test -d "''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs"; then
+            export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/stublibs"
+        fi
+        export OCAMLFIND_DESTDIR="''$out/lib/ocaml/${ocaml.version}/site-lib/"
+        if test -n "''${createFindlibDestdir-}"; then
+          mkdir -p $OCAMLFIND_DESTDIR
+        fi
+    }
+
+    addEnvHooks "$targetOffset" addOCamlPath
+  '';
+
+  meta = {
+    homepage = "http://projects.camlcity.org/projects/findlib.html";
+    description = "O'Caml library manager";
+    license = lib.licenses.mit;
+    platforms = ocaml.meta.platforms or [];
+    maintainers = [
+      lib.maintainers.maggesi
+      lib.maintainers.vbmithr
+    ];
+  };
+}
+
+
diff --git a/nixpkgs/pkgs/development/tools/ocaml/findlib/install_topfind.patch b/nixpkgs/pkgs/development/tools/ocaml/findlib/install_topfind.patch
new file mode 100644
index 000000000000..dbdb0edd6cb1
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/ocaml/findlib/install_topfind.patch
@@ -0,0 +1,12 @@
+--- a/src/findlib/Makefile
++++ b/src/findlib/Makefile
+@@ -123,7 +123,7 @@ clean:
+ install: all
+ 	mkdir -p "$(prefix)$(OCAML_SITELIB)/$(NAME)"
+ 	mkdir -p "$(prefix)$(OCAMLFIND_BIN)"
+-	test $(INSTALL_TOPFIND) -eq 0 || cp topfind "$(prefix)$(OCAML_CORE_STDLIB)"
++	test $(INSTALL_TOPFIND) -eq 0 || cp topfind "$(prefix)$(OCAML_SITELIB)"
+	files=`$(SH) $(TOP)/tools/collect_files $(TOP)/Makefile.config findlib.cmi findlib.mli findlib.cma findlib.cmxa findlib$(LIB_SUFFIX) findlib.cmxs topfind.cmi topfind.mli fl_package_base.mli fl_package_base.cmi fl_metascanner.mli fl_metascanner.cmi fl_metatoken.cmi findlib_top.cma findlib_top.cmxa findlib_top$(LIB_SUFFIX) findlib_top.cmxs findlib_dynload.cma findlib_dynload.cmxa findlib_dynload$(LIB_SUFFIX) findlib_dynload.cmxs fl_dynload.mli fl_dynload.cmi META` && \
+	cp $$files "$(prefix)$(OCAML_SITELIB)/$(NAME)"
+	f="ocamlfind$(EXEC_SUFFIX)"; { test -f ocamlfind_opt$(EXEC_SUFFIX) && f="ocamlfind_opt$(EXEC_SUFFIX)"; }; \
+
diff --git a/nixpkgs/pkgs/development/tools/ocaml/findlib/ldconf.patch b/nixpkgs/pkgs/development/tools/ocaml/findlib/ldconf.patch
new file mode 100644
index 000000000000..7718cb673925
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/ocaml/findlib/ldconf.patch
@@ -0,0 +1,8 @@
+Setting paths to search for dnynmic libraries isn't very useful in Nix.
+
+--- findlib-1.2.6/findlib.conf.in	2010-08-17 14:50:28.000000000 -0400
++++ findlib-1.2.6/findlib.conf.in	2010-11-24 09:46:55.179648354 -0500
+@@ -1,2 +1,3 @@
+ destdir="@SITELIB@"
+ path="@SITELIB@"
++ldconf="ignore"