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