@@ -0,0 +1,42 @@
1+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg, result }:
2+
3+let
4+ pname = "cmdliner";
5+in
6+
7+assert stdenv.lib.versionAtLeast ocaml.version "4.01.0";
8+
9+stdenv.mkDerivation rec {
10+ name = "ocaml-${pname}-${version}";
11+ version = "1.0.0";
12+
13+ src = fetchurl {
14+ url = "http://erratique.ch/software/${pname}/releases/${pname}-${version}.tbz";
15+ sha256 = "1ryn7qis0izg0wcal8zdlikzzl689l75y6f4zc6blrm93y5agy9x";
16+ };
17+
18+ unpackCmd = "tar xjf $src";
19+
20+ nativeBuildInputs = [ ocamlbuild opam topkg ];
21+ buildInputs = [ ocaml findlib ];
22+ propagatedBuildInputs = [ result ];
23+
24+ createFindlibDestdir = true;
25+
26+ buildPhase = ''
27+ ocaml -I ${findlib}/lib/ocaml/${ocaml.version}/site-lib pkg/pkg.ml build
28+ '';
29+
30+ installPhase = ''
31+ opam-installer --script --prefix=$out | sh
32+ ln -s $out/lib/${pname} $out/lib/ocaml/${ocaml.version}/site-lib/
33+ '';
34+
35+ meta = with stdenv.lib; {
36+ homepage = http://erratique.ch/software/cmdliner;
37+ description = "An OCaml module for the declarative definition of command line interfaces";
38+ license = licenses.bsd3;
39+ platforms = ocaml.meta.platforms or [];
40+ maintainers = [ maintainers.vbgl ];
41+ };
42+}