summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules
diff options
context:
space:
mode:
authorvbgl <vbgl@users.noreply.github.com>2017-01-21 20:23:28 +0100
committerGitHub <noreply@github.com>2017-01-21 20:23:28 +0100
commit664d1d6dc9c03bfff91b0d08ebf8127d95866530 (patch)
treee9907512a0ecf167302c438baafd8b127017bd00 /pkgs/development/ocaml-modules
parentf0314dea93cfae2ecaa19e8d6b13c111f152852c (diff)
parent720c8e457c82e082a49013fd06dcd7c5033e7db6 (diff)
downloadnixlib-664d1d6dc9c03bfff91b0d08ebf8127d95866530.tar
nixlib-664d1d6dc9c03bfff91b0d08ebf8127d95866530.tar.gz
nixlib-664d1d6dc9c03bfff91b0d08ebf8127d95866530.tar.bz2
nixlib-664d1d6dc9c03bfff91b0d08ebf8127d95866530.tar.lz
nixlib-664d1d6dc9c03bfff91b0d08ebf8127d95866530.tar.xz
nixlib-664d1d6dc9c03bfff91b0d08ebf8127d95866530.tar.zst
nixlib-664d1d6dc9c03bfff91b0d08ebf8127d95866530.zip
Merge pull request #21261 from vbgl/uutf-1.0.0
Eliom 6 and various OCaml package updates
Diffstat (limited to 'pkgs/development/ocaml-modules')
-rw-r--r--pkgs/development/ocaml-modules/eliom/default.nix26
-rw-r--r--pkgs/development/ocaml-modules/jsonm/default.nix15
-rw-r--r--pkgs/development/ocaml-modules/markup/default.nix12
-rw-r--r--pkgs/development/ocaml-modules/notty/default.nix23
-rw-r--r--pkgs/development/ocaml-modules/ocb-stubblr/default.nix26
-rw-r--r--pkgs/development/ocaml-modules/ocb-stubblr/pkg-config.patch25
-rw-r--r--pkgs/development/ocaml-modules/ocsigen-server/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/otfm/default.nix21
-rw-r--r--pkgs/development/ocaml-modules/reactivedata/default.nix22
-rw-r--r--pkgs/development/ocaml-modules/topkg/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/tyxml/default.nix20
-rw-r--r--pkgs/development/ocaml-modules/uucp/default.nix23
-rw-r--r--pkgs/development/ocaml-modules/uunf/default.nix20
-rw-r--r--pkgs/development/ocaml-modules/uuseg/default.nix27
-rw-r--r--pkgs/development/ocaml-modules/uutf/default.nix27
-rw-r--r--pkgs/development/ocaml-modules/vg/default.nix30
16 files changed, 168 insertions, 159 deletions
diff --git a/pkgs/development/ocaml-modules/eliom/default.nix b/pkgs/development/ocaml-modules/eliom/default.nix
index 293faad2301d..f3c9f4cecefe 100644
--- a/pkgs/development/ocaml-modules/eliom/default.nix
+++ b/pkgs/development/ocaml-modules/eliom/default.nix
@@ -1,37 +1,31 @@
-{ buildOcaml, stdenv, fetchurl, which, ocsigen_server, ocsigen_deriving, ocaml,
+{ stdenv, fetchurl, which, ocsigen_server, ocsigen_deriving, ocaml,
   js_of_ocaml, ocaml_react, ocaml_lwt, calendar, cryptokit, tyxml,
   ipaddr, ocamlnet, ocaml_ssl, ocaml_pcre, ocaml_optcomp,
-  reactivedata, opam, ppx_tools, ppx_deriving, camlp4}:
+  reactivedata, opam, ppx_tools, ppx_deriving, findlib
+}:
 
-let ocamlVersion = (stdenv.lib.getVersion ocaml); in
-buildOcaml rec
+assert stdenv.lib.versionAtLeast ocaml.version "4.02";
+
+stdenv.mkDerivation rec
 {
   pname = "eliom";
-  version = "5.0.0";
+  version = "6.0.0";
   name = "${pname}-${version}";
 
   src = fetchurl {
     url = "https://github.com/ocsigen/eliom/archive/${version}.tar.gz";
-    sha256 = "1g9wq2qpn0sgzyb6iq0h9afq5p68il4h8pc7jppqsislk87m09k7";
+    sha256 = "1yaqi5fdzvi2ga412chw5rk3533a3xamwfmias1crk793d43cmpc";
   };
 
   patches = [ ./camlp4.patch ];
 
-  buildInputs = [ which ocaml_optcomp opam ppx_tools camlp4 ];
+  buildInputs = [ ocaml which findlib ocaml_optcomp opam ppx_tools ];
 
   propagatedBuildInputs = [ ocaml_lwt reactivedata tyxml ipaddr ocsigen_server ppx_deriving
                             ocsigen_deriving js_of_ocaml
                             calendar cryptokit ocamlnet ocaml_react ocaml_ssl ocaml_pcre ];
 
-  preConfigure = stdenv.lib.optionalString (!stdenv.lib.versionAtLeast ocamlVersion "4.02") ''
-      export PPX=false
-    '';
-
-  installPhase =
-  ''opam-installer --script --prefix=$out ${pname}.install > install.sh
-    sh install.sh
-    ln -s $out/lib/${pname} $out/lib/ocaml/${ocamlVersion}/site-lib/
-  '';
+  installPhase = "opam-installer -i --prefix=$out --libdir=$OCAMLFIND_DESTDIR";
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/jsonm/default.nix b/pkgs/development/ocaml-modules/jsonm/default.nix
index f473527c15c8..fb73df808fe7 100644
--- a/pkgs/development/ocaml-modules/jsonm/default.nix
+++ b/pkgs/development/ocaml-modules/jsonm/default.nix
@@ -1,24 +1,23 @@
-{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, uutf }:
+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg, opam, uutf }:
 
-let version = "0.9.1"; in
+let version = "1.0.0"; in
 
 stdenv.mkDerivation {
-  name = "ocaml-jsonm-${version}";
+  name = "ocaml${ocaml.version}-jsonm-${version}";
 
   src = fetchurl {
     url = "http://erratique.ch/software/jsonm/releases/jsonm-${version}.tbz";
-    sha256 = "0wszqrmx8iqlwzvs76fjf4sqh15mv20yjrbyhkd348yq8nhdrm1z";
+    sha256 = "1v3ln6d965lplj28snjdqdqablpp1kx8bw2cfx0m6i157mqyln62";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild ];
+  buildInputs = [ ocaml findlib ocamlbuild topkg opam ];
   propagatedBuildInputs = [ uutf ];
 
   unpackCmd = "tar xjf $src";
 
-  configurePhase = "ocaml setup.ml -configure --prefix $prefix";
-  buildPhase = "ocaml setup.ml -build";
   createFindlibDestdir = true;
-  installPhase = "ocaml setup.ml -install";
+
+  inherit (topkg) buildPhase installPhase;
 
   meta = {
     description = "An OCaml non-blocking streaming codec to decode and encode the JSON data format";
diff --git a/pkgs/development/ocaml-modules/markup/default.nix b/pkgs/development/ocaml-modules/markup/default.nix
index a177ae240d14..3ee84d0d1b1c 100644
--- a/pkgs/development/ocaml-modules/markup/default.nix
+++ b/pkgs/development/ocaml-modules/markup/default.nix
@@ -1,13 +1,13 @@
-{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, uutf, lwt }:
+{ stdenv, fetchzip, ocaml, findlib, ocamlbuild, uutf, lwt }:
 
 stdenv.mkDerivation rec {
-  pname = "ocaml-markup";
-  version = "0.7.2";
-  name = "${pname}-${version}";
+  pname = "markup";
+  version = "0.7.4";
+  name = "ocaml${ocaml.version}-${pname}-${version}";
 
-  src = fetchurl {
+  src = fetchzip {
     url = "http://github.com/aantron/markup.ml/archive/${version}.tar.gz";
-    sha256 = "0d3wi22v7h0iqzq8dgl0g4fj2wb67gvmbzdckacifghinrx762k3";
+    sha256 = "1hchlqzsy9pax91gcdmxzakfm22fbvhxzwyzpvz8fqkx4372zs37";
     };
 
   buildInputs = [ ocaml findlib ocamlbuild ];
diff --git a/pkgs/development/ocaml-modules/notty/default.nix b/pkgs/development/ocaml-modules/notty/default.nix
index 3178789c3993..b967728d048c 100644
--- a/pkgs/development/ocaml-modules/notty/default.nix
+++ b/pkgs/development/ocaml-modules/notty/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildOcaml, fetchFromGitHub, findlib
+{ stdenv, buildOcaml, fetchpatch, fetchFromGitHub, findlib, topkg, opam, ocb-stubblr
 , result, uucp, uuseg, uutf
 , lwt     ? null }:
 
@@ -7,7 +7,7 @@ with stdenv.lib;
 let withLwt = lwt != null; in
 
 buildOcaml rec {
-  version = "0.1.1";
+  version = "0.1.1a";
   name = "notty";
 
   minimumSupportedOcamlVersion = "4.02";
@@ -15,18 +15,23 @@ buildOcaml rec {
   src = fetchFromGitHub {
     owner  = "pqwy";
     repo   = "notty";
-    rev    = "v${version}";
-    sha256 = "0bw3bq8z2y1rhc20zn13s78sazywyzpg8nmyjch33p7ypxfglf01";
+    rev    = "53f5946653490fce980dc5d8cadf8b122cff4f19";
+    sha256 = "0qmwb1hrp04py2i5spy0yd6c5jqxyss3wzvlkgxyl9r07kvsx6xf";
   };
 
-  buildInputs = [ findlib ];
+  patches = [ (fetchpatch {
+    url = https://github.com/dbuenzli/notty/commit/b0e12930acc26d030a74d6d63d622ae220b12c92.patch;
+    sha256 = "0pklplbnjbsjriqj73pc8fsadg404px534w7zknz2617zb44m6x6";
+  })];
+
+  buildInputs = [ findlib opam topkg ocb-stubblr ];
   propagatedBuildInputs = [ result uucp uuseg uutf ] ++
-                          optional withLwt [ lwt ];
+                          optional withLwt lwt;
 
-  configureFlags = [ "--enable-unix" ] ++
-                   (if withLwt then ["--enable-lwt"] else ["--disable-lwt"]);
+  buildPhase = topkg.buildPhase
+  + " --with-lwt ${if withLwt then "true" else "false"}";
 
-  configurePhase = "./configure --prefix $out $configureFlags";
+  inherit (topkg) installPhase;
 
   meta = {
     inherit (src.meta) homepage;
diff --git a/pkgs/development/ocaml-modules/ocb-stubblr/default.nix b/pkgs/development/ocaml-modules/ocb-stubblr/default.nix
new file mode 100644
index 000000000000..bb4b24cec67d
--- /dev/null
+++ b/pkgs/development/ocaml-modules/ocb-stubblr/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchzip, ocaml, findlib, ocamlbuild, opam, topkg, astring }:
+
+stdenv.mkDerivation {
+  name = "ocaml${ocaml.version}-ocb-stubblr-0.1.0";
+  src = fetchzip {
+    url = http://github.com/pqwy/ocb-stubblr/releases/download/v0.1.0/ocb-stubblr-0.1.0.tbz;
+    name = "src.tar.bz";
+    sha256 = "0hpds1lkq4j8wgslv7hnirgfrjmqi36h5rarpw9mwf24gfp5ays2";
+  };
+
+  patches = [ ./pkg-config.patch ];
+
+  buildInputs = [ ocaml findlib ocamlbuild opam topkg ];
+
+  propagatedBuildInputs = [ astring ];
+
+  inherit (topkg) buildPhase installPhase;
+
+  meta = {
+    description = "OCamlbuild plugin for C stubs";
+    homepage = https://github.com/pqwy/ocb-stubblr;
+    license = stdenv.lib.licenses.isc;
+    inherit (ocaml.meta) platforms;
+    maintainers = [ stdenv.lib.maintainers.vbgl ];
+  };
+}
diff --git a/pkgs/development/ocaml-modules/ocb-stubblr/pkg-config.patch b/pkgs/development/ocaml-modules/ocb-stubblr/pkg-config.patch
new file mode 100644
index 000000000000..d86b3f8da9f1
--- /dev/null
+++ b/pkgs/development/ocaml-modules/ocb-stubblr/pkg-config.patch
@@ -0,0 +1,25 @@
+--- a/src/ocb_stubblr.ml	1970-01-01 00:00:01.000000000 +0000
++++ b/src/ocb_stubblr.ml	2016-12-04 11:10:10.000000000 +0000
+@@ -31,20 +31,9 @@
+ 
+   (* XXX Would be nice to move pkg-config results to a build artefact. *)
+ 
+-  let opam_prefix =
+-    let cmd = "opam config var prefix" in
+-    lazy ( try run_and_read cmd with Failure _ ->
+-            error_msgf "error running opam")
+-
+-  let var = "PKG_CONFIG_PATH"
+-
+-  let path () =
+-    Lazy.force opam_prefix / "lib" / "pkgconfig" ::
+-      (try [Sys.getenv var] with Not_found -> []) |> String.concat ~sep:":"
+-
+   let run ~flags package =
+-    let cmd = strf "%s=%s pkg-config %s %s 2>/dev/null"
+-              var (path ()) package (String.concat ~sep:" " flags) in
++    let cmd = strf "pkg-config %s %s 2>/dev/null"
++              package (String.concat ~sep:" " flags) in
+     try `Res (run_and_read cmd) with Failure _ -> `Nonexistent
+ end
+ 
diff --git a/pkgs/development/ocaml-modules/ocsigen-server/default.nix b/pkgs/development/ocaml-modules/ocsigen-server/default.nix
index e5c5439fda33..5c424cfe0599 100644
--- a/pkgs/development/ocaml-modules/ocsigen-server/default.nix
+++ b/pkgs/development/ocaml-modules/ocsigen-server/default.nix
@@ -9,11 +9,11 @@ let mkpath = p: n:
 in
 
 stdenv.mkDerivation {
-  name = "ocsigenserver-2.7";
+  name = "ocsigenserver-2.8";
 
   src = fetchurl {
-    url = https://github.com/ocsigen/ocsigenserver/archive/2.7.tar.gz;
-    sha256 = "0gv9nchsx9z74hh46gn7bd0053j4694fhxriannf13sqh2qpg901";
+    url = https://github.com/ocsigen/ocsigenserver/archive/2.8.tar.gz;
+    sha256 = "1v44qv2ixd7i1qinyhlzzqiffawsdl7xhhh6ysd7lf93kh46d5sy";
   };
 
   buildInputs = [ocaml which findlib ocaml_react ocaml_ssl ocaml_lwt
diff --git a/pkgs/development/ocaml-modules/otfm/default.nix b/pkgs/development/ocaml-modules/otfm/default.nix
index 30946da1c0b2..5deef60520bd 100644
--- a/pkgs/development/ocaml-modules/otfm/default.nix
+++ b/pkgs/development/ocaml-modules/otfm/default.nix
@@ -1,14 +1,12 @@
-{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, uutf }:
+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg, uutf, result }:
 
 let
-  inherit (stdenv.lib) getVersion versionAtLeast;
-
   pname = "otfm";
-  version = "0.2.0";
+  version = "0.3.0";
   webpage = "http://erratique.ch/software/${pname}";
 in
 
-assert versionAtLeast (getVersion ocaml) "4.01.0";
+assert stdenv.lib.versionAtLeast ocaml.version "4.01.0";
 
 stdenv.mkDerivation rec {
 
@@ -16,23 +14,18 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "${webpage}/releases/${pname}-${version}.tbz";
-    sha256 = "1wgi9plf98gd7x3b7fzjxds089sivsap97bl1bw2lj73nxwnyb9c";
+    sha256 = "054s82539k3kc9na6s47g3scsl04icjahpas7pv5351jmsgqcq3k";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild opam ];
+  buildInputs = [ ocaml findlib ocamlbuild opam topkg ];
 
-  propagatedBuildInputs = [ uutf ];
+  propagatedBuildInputs = [ uutf result ];
 
   createFindlibDestdir = true;
 
   unpackCmd = "tar xjf $src";
 
-  buildPhase = "ocaml pkg/build.ml native=true native-dynlink=true";
-
-  installPhase = ''
-    opam-installer --script --prefix=$out ${pname}.install | sh
-    ln -s $out/lib/${pname} $out/lib/ocaml/${getVersion ocaml}/site-lib/${pname}
-  '';
+  inherit (topkg) buildPhase installPhase;
 
   meta = with stdenv.lib; {
     description = "OpenType font decoder for OCaml";
diff --git a/pkgs/development/ocaml-modules/reactivedata/default.nix b/pkgs/development/ocaml-modules/reactivedata/default.nix
index cd64e6578c16..828a3fb60683 100644
--- a/pkgs/development/ocaml-modules/reactivedata/default.nix
+++ b/pkgs/development/ocaml-modules/reactivedata/default.nix
@@ -1,28 +1,20 @@
-{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, ocaml_react, camlp4, opam }:
+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, ocaml_react, opam }:
 
-let
-  ocamlVersion = stdenv.lib.getVersion ocaml;
-in
-
-assert stdenv.lib.versionAtLeast ocamlVersion "3.11";
+assert stdenv.lib.versionAtLeast ocaml.version "3.11";
 
 stdenv.mkDerivation {
-  name = "ocaml-reactiveData-0.2";
+  name = "ocaml${ocaml.version}-reactiveData-0.2.1";
   src = fetchurl {
-    url = https://github.com/ocsigen/reactiveData/archive/0.2.tar.gz;
-    sha256 = "0rskcxnyjn8sxqnncdm6rh9wm99nha5m5sc83fywgzs64xfl43fq";
+    url = https://github.com/ocsigen/reactiveData/archive/0.2.1.tar.gz;
+    sha256 = "0wcs0z50nia1cpk8mh6i5qbc6sff9cc8x7s7q1q89d7m73bnv4vf";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild opam camlp4 ];
+  buildInputs = [ ocaml findlib ocamlbuild opam ];
   propagatedBuildInputs = [ocaml_react];
 
   buildPhase = "ocaml pkg/build.ml native=true native-dynlink=true";
 
-  installPhase = ''
-    opam-installer --script --prefix=$out reactiveData.install > install.sh
-    sed -i s!lib/reactiveData!lib/ocaml/${ocamlVersion}/site-lib/reactiveData! install.sh
-    sh install.sh
-  '';
+  installPhase = "opam-installer -i --prefix=$out --libdir=$OCAMLFIND_DESTDIR";
 
   meta = with stdenv.lib; {
     description = "An OCaml module for functional reactive programming (FRP) based on React";
diff --git a/pkgs/development/ocaml-modules/topkg/default.nix b/pkgs/development/ocaml-modules/topkg/default.nix
index 23bcc2670661..f343eed6b467 100644
--- a/pkgs/development/ocaml-modules/topkg/default.nix
+++ b/pkgs/development/ocaml-modules/topkg/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "ocaml${ocaml.version}-topkg-${version}";
-  version = "0.7.8";
+  version = "0.8.1";
 
   src = fetchurl {
     url = "http://erratique.ch/software/topkg/releases/topkg-${version}.tbz";
-    sha256 = "029lbmabczpmcgkj53mc20vmpcn3f7rf7xms4xf0nywswfzsash6";
+    sha256 = "18rrh6fmf708z7dd30amljmcgaypj3kk49jrmrj68r4wnw8004j8";
   };
 
   nativeBuildInputs = [ opam ];
diff --git a/pkgs/development/ocaml-modules/tyxml/default.nix b/pkgs/development/ocaml-modules/tyxml/default.nix
index b8c415b75669..49cc56a1db6a 100644
--- a/pkgs/development/ocaml-modules/tyxml/default.nix
+++ b/pkgs/development/ocaml-modules/tyxml/default.nix
@@ -1,14 +1,22 @@
-{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, ocaml_oasis, camlp4, uutf, markup, ppx_tools, re }:
+{ stdenv, fetchzip, fetchpatch, ocaml, findlib, ocamlbuild, ocaml_oasis, camlp4, uutf, markup, ppx_tools, re
+}:
+
+assert stdenv.lib.versionAtLeast ocaml.version "4.02";
 
 stdenv.mkDerivation rec {
   pname = "tyxml";
-  version = "3.6.0";
-  name = "${pname}-${version}";
+  version = "4.0.1";
+  name = "ocaml${ocaml.version}-${pname}-${version}";
 
-  src = fetchurl {
+  src = fetchzip {
     url = "http://github.com/ocsigen/tyxml/archive/${version}.tar.gz";
-    sha256 = "1rz0f48x8p1m30723rn5v85pp7rd0spr04sd7gzryy99vn3ianga";
-    };
+    sha256 = "1mwkjvl78gvw7pvql5qp64cfjjca6aqsb04999qkllifyicaaq8y";
+  };
+
+  patches = [ (fetchpatch {
+    url = https://github.com/dbuenzli/tyxml/commit/a2bf5ccc0b6e684e7b81274ff19df8d72e2def8d.diff;
+    sha256 = "11sidgiwz3zqw815vlslbfzb456z0lndkh425mlmvnmck4d2v2i3";
+  })];
 
   buildInputs = [ ocaml findlib ocamlbuild camlp4 ];
 
diff --git a/pkgs/development/ocaml-modules/uucp/default.nix b/pkgs/development/ocaml-modules/uucp/default.nix
index 456fc8a19761..db0b29d94c50 100644
--- a/pkgs/development/ocaml-modules/uucp/default.nix
+++ b/pkgs/development/ocaml-modules/uucp/default.nix
@@ -1,36 +1,31 @@
-{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam }:
+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg, uchar }:
 
 let
-  inherit (stdenv.lib) getVersion versionAtLeast;
-
   pname = "uucp";
-  version = "1.1.0";
+  version = "2.0.0";
   webpage = "http://erratique.ch/software/${pname}";
 in
 
-assert versionAtLeast (getVersion ocaml) "4.00";
+assert stdenv.lib.versionAtLeast ocaml.version "4.01";
 
 stdenv.mkDerivation {
 
-  name = "ocaml-${pname}-${version}";
+  name = "ocaml${ocaml.version}-${pname}-${version}";
 
   src = fetchurl {
     url = "${webpage}/releases/${pname}-${version}.tbz";
-    sha256 = "1vm5f2ppdrnk19j0ppjiqz56qf5bzyk26gs0lz071s7iblk459jz";
+    sha256 = "07m7pfpcf03dqsbvqpq88y9hzic8fighlp4fgbav6n6xla35mk5k";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild opam ];
+  buildInputs = [ ocaml findlib ocamlbuild opam topkg ];
+
+  propagatedBuildInputs = [ uchar ];
 
   createFindlibDestdir = true;
 
   unpackCmd = "tar xjf $src";
 
-  buildPhase = "ocaml pkg/build.ml native=true native-dynlink=true";
-
-  installPhase = ''
-    opam-installer --script --prefix=$out ${pname}.install | sh
-    ln -s $out/lib/${pname} $out/lib/ocaml/${getVersion ocaml}/site-lib/${pname}
-  '';
+  inherit (topkg) buildPhase installPhase;
 
   meta = with stdenv.lib; {
     description = "An OCaml library providing efficient access to a selection of character properties of the Unicode character database";
diff --git a/pkgs/development/ocaml-modules/uunf/default.nix b/pkgs/development/ocaml-modules/uunf/default.nix
index 11ff9a36a41c..a9c7add6129b 100644
--- a/pkgs/development/ocaml-modules/uunf/default.nix
+++ b/pkgs/development/ocaml-modules/uunf/default.nix
@@ -1,33 +1,29 @@
-{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam }:
+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg, uchar, uutf, cmdliner }:
 let
   pname = "uunf";
   webpage = "http://erratique.ch/software/${pname}";
 in
 
-assert stdenv.lib.versionAtLeast ocaml.version "3.12";
+assert stdenv.lib.versionAtLeast ocaml.version "4.01";
 
 stdenv.mkDerivation rec {
   name = "ocaml-${pname}-${version}";
-  version = "0.9.3";
+  version = "2.0.0";
 
   src = fetchurl {
     url = "${webpage}/releases/${pname}-${version}.tbz";
-    sha256 = "16cgjy1m0m61srv1pmlc3gr0y40kd4724clvpagdnz68raz4zmn0";
+    sha256 = "1i132168949vdc8magycgf9mdysf50vvr7zngnjl4vi3zdayq20c";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild opam ];
+  buildInputs = [ ocaml findlib ocamlbuild opam topkg uutf cmdliner ];
+
+  propagatedBuildInputs = [ uchar ];
 
   createFindlibDestdir = true;
 
   unpackCmd = "tar xjf $src";
 
-  buildPhase = "./pkg/build true false";
-
-  installPhase = ''
-    opam-installer --script --prefix=$out ${pname}.install > install.sh
-    sh install.sh
-    ln -s $out/lib/${pname} $out/lib/ocaml/${ocaml.version}/site-lib/
-  '';
+  inherit (topkg) buildPhase installPhase;
 
   meta = with stdenv.lib; {
     description = "An OCaml module for normalizing Unicode text";
diff --git a/pkgs/development/ocaml-modules/uuseg/default.nix b/pkgs/development/ocaml-modules/uuseg/default.nix
index 92777129ca03..d1e958144612 100644
--- a/pkgs/development/ocaml-modules/uuseg/default.nix
+++ b/pkgs/development/ocaml-modules/uuseg/default.nix
@@ -1,39 +1,28 @@
-{ stdenv, buildOcaml, fetchurl, ocaml, findlib, ocamlbuild, opam, uucp, uutf, cmdliner }:
+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg, uchar, uucp, uutf, cmdliner }:
 
 let
   pname = "uuseg";
   webpage = "http://erratique.ch/software/${pname}";
 in
 
-buildOcaml rec {
+stdenv.mkDerivation rec {
 
-  minimumSupportedOcamlVersion = "4.01";
-
-  name = pname;
-  version = "0.9.0";
+  name = "ocaml${ocaml.version}-${pname}-${version}";
+  version = "1.0.0";
 
   src = fetchurl {
     url = "${webpage}/releases/${pname}-${version}.tbz";
-    sha256 = "00n4zi8dyw2yzi4nr2agcrr33b0q4dr9mgnkczipf4c0gm5cm50h";
+    sha256 = "0m5n0kn70w862g5dhfkfvrnmb98z1r02g21ap7l81hy8sn08cbsz";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild opam cmdliner ];
-  propagatedBuildInputs = [ uucp uutf ];
+  buildInputs = [ ocaml findlib ocamlbuild opam cmdliner topkg uutf ];
+  propagatedBuildInputs = [ uucp uchar ];
 
   createFindlibDestdir = true;
 
   unpackCmd = "tar xjf $src";
 
-  buildPhase = ''
-    ocaml pkg/build.ml \
-      native=true native-dynlink=true \
-      uutf=true cmdliner=true
-  '';
-
-  installPhase = ''
-    opam-installer --script --prefix=$out ${pname}.install | sh
-    ln -s $out/lib/${pname} $out/lib/ocaml/${ocaml.version}/site-lib/${pname}
-  '';
+  inherit (topkg) buildPhase installPhase;
 
   meta = with stdenv.lib; {
     description = "An OCaml library for segmenting Unicode text";
diff --git a/pkgs/development/ocaml-modules/uutf/default.nix b/pkgs/development/ocaml-modules/uutf/default.nix
index a08e0ccbf74e..feb197defc32 100644
--- a/pkgs/development/ocaml-modules/uutf/default.nix
+++ b/pkgs/development/ocaml-modules/uutf/default.nix
@@ -1,37 +1,26 @@
-{ stdenv, buildOcaml, fetchurl, ocaml, findlib, ocamlbuild, opam, cmdliner}:
+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, cmdliner , topkg, uchar }:
 let
   pname = "uutf";
   webpage = "http://erratique.ch/software/${pname}";
 in
 
-buildOcaml rec {
-  name = pname;
-  version = "0.9.4";
-
-  minimumSupportedOcamlVersion = "4.00.0";
+stdenv.mkDerivation rec {
+  name = "ocaml${ocaml.version}-${pname}-${version}";
+  version = "1.0.0";
 
   src = fetchurl {
     url = "${webpage}/releases/${pname}-${version}.tbz";
-    sha256 = "1f71fyawxal42x6g82539bv0ava2smlar6rmxxz1cyq3l0i6fw0k";
+    sha256 = "08i0cw02cxw4mi2rs01v9xi307qshs6fnd1dlqyb52kcxzblpp37";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild opam cmdliner ];
+  buildInputs = [ ocaml findlib ocamlbuild topkg opam cmdliner ];
+  propagatedBuildInputs = [ uchar ];
 
   createFindlibDestdir = true;
 
   unpackCmd = "tar xjf $src";
 
-  buildPhase = ''
-    ocaml pkg/build.ml \
-      native=true \
-      native-dynlink=true \
-      cmdliner=true
-  '';
-
-  installPhase = ''
-    opam-installer --prefix=$out --script ${pname}.install | sh
-    ln -s $out/lib/uutf $out/lib/ocaml/${ocaml.version}/site-lib/
-  '';
+  inherit (topkg) buildPhase installPhase;
 
   meta = with stdenv.lib; {
     description = "Non-blocking streaming Unicode codec for OCaml";
diff --git a/pkgs/development/ocaml-modules/vg/default.nix b/pkgs/development/ocaml-modules/vg/default.nix
index 17bb8eeb4645..aa6047c79014 100644
--- a/pkgs/development/ocaml-modules/vg/default.nix
+++ b/pkgs/development/ocaml-modules/vg/default.nix
@@ -1,17 +1,19 @@
-{ stdenv, fetchurl, ocaml, findlib, opam, gg, uutf, otfm, js_of_ocaml,
+{ stdenv, fetchurl, ocaml, findlib, opam, topkg
+, uchar, result, gg, uutf, otfm, js_of_ocaml,
   pdfBackend ? true, # depends on uutf and otfm
   htmlcBackend ? true # depends on js_of_ocaml
 }:
 
 let
-  inherit (stdenv.lib) getVersion optionals versionAtLeast;
+  inherit (stdenv.lib) optionals versionAtLeast;
 
   pname = "vg";
-  version = "0.8.1";
+  version = "0.9.0";
   webpage = "http://erratique.ch/software/${pname}";
+  sob = b: if b then "true" else "false";
 in
 
-assert versionAtLeast (getVersion ocaml) "4.01.0";
+assert versionAtLeast ocaml.version "4.02.0";
 
 stdenv.mkDerivation rec {
 
@@ -19,12 +21,12 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "${webpage}/releases/${pname}-${version}.tbz";
-    sha256 = "1cdcvsr5z8845ndilnrz7p4n6yn4gv2p91z2mgi4vrailcmn5vzd";
+    sha256 = "1czd2fq85hy24w5pllarsq4pvbx9rda5zdikxfxdng8s9kff2h3f";
   };
 
-  buildInputs = [ ocaml findlib opam ];
+  buildInputs = [ ocaml findlib opam topkg ];
 
-  propagatedBuildInputs = [ gg ]
+  propagatedBuildInputs = [ uchar result gg ]
                           ++ optionals pdfBackend [ uutf otfm ]
                           ++ optionals htmlcBackend [ js_of_ocaml ];
 
@@ -32,16 +34,12 @@ stdenv.mkDerivation rec {
 
   unpackCmd = "tar xjf $src";
 
-  buildPhase = "ocaml pkg/build.ml native=true native-dynlink=true"
-               + (if pdfBackend then " uutf=true otfm=true"
-                                else " uutf=false otfm=false")
-               + (if htmlcBackend then " jsoo=true"
-                                  else " jsoo=false");
+  buildPhase = topkg.buildPhase
+  + " --with-uutf ${sob pdfBackend} --with-otfm ${sob pdfBackend}"
+  + " --with-js_of_ocaml ${sob htmlcBackend}"
+  + " --with-cairo2 false";
 
-  installPhase = ''
-    opam-installer --script --prefix=$out ${pname}.install | sh
-    ln -s $out/lib/${pname} $out/lib/ocaml/${getVersion ocaml}/site-lib/${pname}
-  '';
+  inherit (topkg) installPhase;
 
   meta = with stdenv.lib; {
     description = "Declarative 2D vector graphics for OCaml";