From d9f5e277a5471f1c03d14dced75738b62d323b56 Mon Sep 17 00:00:00 2001
From: Arie Middelkoop <amiddelk@gmail.com>
Date: Wed, 29 Feb 2012 12:51:06 +0000
Subject: [PATCH] OCamlMakefile update.

svn path=/nixpkgs/trunk/; revision=32687
---
 .../ocaml-modules/ocamlmake/default.nix       | 20 +++++++++++++------
 .../ocaml-modules/ocamlmake/setup-hook.sh     |  5 +++++
 .../ocaml-modules/pycaml/default.nix          |  4 ++--
 3 files changed, 21 insertions(+), 8 deletions(-)
 create mode 100644 pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh

diff --git a/pkgs/development/ocaml-modules/ocamlmake/default.nix b/pkgs/development/ocaml-modules/ocamlmake/default.nix
index 69386bd75787..23858576efd5 100644
--- a/pkgs/development/ocaml-modules/ocamlmake/default.nix
+++ b/pkgs/development/ocaml-modules/ocamlmake/default.nix
@@ -1,16 +1,24 @@
 {stdenv, fetchurl}:
 
-stdenv.mkDerivation {
-  name = "ocaml-make-6.33.0";
+let
+
+  version = "6.36.0";
+  sha256 = "7c9a771d79bf945050dc7530957f4b61669976177818185e64c002cbfd75e3a2";
+
+in stdenv.mkDerivation {
+  name = "ocaml-make-${version}";
 
   src = fetchurl {
-    url = "http://www.ocaml.info/ocaml_sources/ocaml-make-6.33.0.tar.gz";
-    sha256 = "3054303ba04e4bbbe038e08310fabc3e5a0e3899bbba33d9ac5ed7a1b9d1e05a";
+    url = "http://hg.ocaml.info/release/ocaml-make/archive/release-${version}.tar.bz2";
+    inherit sha256;
   };
 
-  phases = [ "unpackPhase" "installPhase" ];
+  installPhase = ''
+    ensureDir "$out/include/"
+    cp OCamlMakefile "$out/include/"
+  '';
 
-  installPhase = "cp OCamlMakefile $out";
+  setupHook = ./setup-hook.sh;
 
   meta = {
     homepage = "http://www.ocaml.info/home/ocaml_sources.html";
diff --git a/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh b/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh
new file mode 100644
index 000000000000..876556a7b922
--- /dev/null
+++ b/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh
@@ -0,0 +1,5 @@
+addOcamlMakefile () {
+    export OCAMLMAKEFILE="@out@/include/OCamlMakefile"
+}
+
+envHooks=(${envHooks[@]} addOcamlMakefile)
diff --git a/pkgs/development/ocaml-modules/pycaml/default.nix b/pkgs/development/ocaml-modules/pycaml/default.nix
index af7207064bae..b6c0df5ac15b 100644
--- a/pkgs/development/ocaml-modules/pycaml/default.nix
+++ b/pkgs/development/ocaml-modules/pycaml/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation {
     sha256 = "ff6d863c42b4ef798f50ff5eff77b47b77b5c0d28b6f65364e8a436a216dc591";
   };
 
-  buildInputs = [ocaml findlib python]; 
+  buildInputs = [ocaml findlib python ocaml_make];
 
   createFindlibDestdir = true;
 
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
 
   # fix some paths to the appropriate store paths.
   patchPhase = ''
-    sed -i "Makefile" -e's|/usr/include/OCamlMakefile|${ocaml_make}|g'
+    sed -i "Makefile" -e's|/usr/include/OCamlMakefile|${ocaml_make}/include/OCamlMakefile|g'
     sed -i "Makefile" -e's|/usr|${python}|g'
     '';