about summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/pycaml/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/ocaml-modules/pycaml/default.nix')
-rw-r--r--pkgs/development/ocaml-modules/pycaml/default.nix68
1 files changed, 34 insertions, 34 deletions
diff --git a/pkgs/development/ocaml-modules/pycaml/default.nix b/pkgs/development/ocaml-modules/pycaml/default.nix
index b6c0df5ac15b..070bd270b11a 100644
--- a/pkgs/development/ocaml-modules/pycaml/default.nix
+++ b/pkgs/development/ocaml-modules/pycaml/default.nix
@@ -1,46 +1,46 @@
-{stdenv, fetchurl, ocaml, findlib, python, ocaml_make}:
-
-# The actual version of pycaml is unclear, as it is the original
-# 0.82 version with some patches applied in order to use it for
-# the kompostilo type setter (see README). Apparently, some of
-# the patches provide Python 3.1 support.
-# This version also differs from the Debian version, which
-# is also a heavily patched 0.82.
-# Therefore, we may at some point try to find out what is
-# actually the "real" version (if the library is still alive).
-
-stdenv.mkDerivation {
-  name = "pycaml-0.82";
-
-  src = fetchurl {
-    name = "pycaml.tar.gz";
-    url = "http://github.com/chemoelectric/pycaml/tarball/master";
-    sha256 = "ff6d863c42b4ef798f50ff5eff77b47b77b5c0d28b6f65364e8a436a216dc591";
-  };
+{stdenv, fetchurl, ocaml, findlib, ncurses, python, ocaml_make}:
 
-  buildInputs = [ocaml findlib python ocaml_make];
+# This is the original pycaml version with patches from debian.
 
-  createFindlibDestdir = true;
+let debian = fetchurl {
+      url = "mirror://debian/pool/main/p/pycaml/pycaml_0.82-14.debian.tar.gz";
+      sha256 = "a763088ec1fa76c769bf586ed6692e7ac035b0a2bfd48a90a8e7a9539ec0c2f1";
+    };
+
+in stdenv.mkDerivation {
+  name = "pycaml-0.82-14";
 
-  phases = [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" ];
+  srcs = [
+    (fetchurl {
+      url = "mirror://debian/pool/main/p/pycaml/pycaml_0.82.orig.tar.gz";
+      sha256 = "d57be559c8d586c575717d47817986bbdbcebe2ffd16ad6b291525c62868babe";
+    })
 
-  # fix some paths to the appropriate store paths.
-  patchPhase = ''
-    sed -i "Makefile" -e's|/usr/include/OCamlMakefile|${ocaml_make}/include/OCamlMakefile|g'
-    sed -i "Makefile" -e's|/usr|${python}|g'
-    '';
+    (fetchurl {
+      url = "mirror://debian/pool/main/p/pycaml/pycaml_0.82-14.debian.tar.gz";
+      sha256 = "a763088ec1fa76c769bf586ed6692e7ac035b0a2bfd48a90a8e7a9539ec0c2f1";
+    })
+  ];
 
-  buildPhase = ''
-    make -f Makefile -j1 PYVER=`python -c 'import sys; print("{0}.{1}".format(sys.version_info.major, sys.version_info.minor));'`
-    '';
+  postPatch = ''
+    rm -f Makefile* configure*
+    cp ../debian/META ../debian/Makefile .
+    sed -i "Makefile" -e's|/usr/share/ocamlmakefile/OCamlMakefile|${ocaml_make}/include/OCamlMakefile|g'
+  '';
+
+  sourceRoot = "pycaml";
+  patches = [ "../debian/patches/*.patch" ];
+
+  buildInputs = [ ncurses ocaml findlib python ocaml_make ];
+  createFindlibDestdir = true;
 
   # the Makefile is not shipped with an install target, hence we do it ourselves.
   installPhase = ''
     ocamlfind install pycaml \
-      dllpycaml_stubs.so* libpycaml_stubs.a pycaml.a pycaml.cma \
-      pycaml.cmi pycaml.cmo pycaml.cmx pycaml.cmxa pycaml.ml pycaml.mli \
-      pycaml.o pycaml_stubs.c pycaml_stubs.h pycaml_stubs.o META
-    '';
+     dllpycaml_stubs.so libpycaml_stubs.a pycaml.a pycaml.cma \
+     pycaml.cmi pycaml.cmo pycaml.cmx pycaml.cmxa \
+     META
+  '';
 
   meta = {
     homepage = "http://github.com/chemoelectric/pycaml";