1{ stdenv, fetchzip, ocaml, findlib, ounit, qcheck
2# Optionally enable tests; test script use OCaml-4.01+ features
3, doCheck ? stdenv.lib.versionAtLeast (stdenv.lib.getVersion ocaml) "4.01"
4}:
5
6let version = "1.4.0"; in
7
8stdenv.mkDerivation {
9 name = "ocaml-stringext-${version}";
10
11 src = fetchzip {
12 url = "https://github.com/rgrinberg/stringext/archive/v${version}.tar.gz";
13 sha256 = "1jp0x9rkss8a48z9wbnc4v5zvmnysin30345psl3xnxb2aqzwlii";
14 };
15
16 buildInputs = [ ocaml findlib ounit qcheck ];
17
18 configurePhase = "ocaml setup.ml -configure --prefix $out"
19 + stdenv.lib.optionalString doCheck " --enable-tests";
20 buildPhase = "ocaml setup.ml -build";
21 inherit doCheck;
22 checkPhase = "ocaml setup.ml -test";
23 installPhase = "ocaml setup.ml -install";
24
25 createFindlibDestdir = true;
26
27 meta = {
28 homepage = https://github.com/rgrinberg/stringext;
29 platforms = ocaml.meta.platforms;
30 description = "Extra string functions for OCaml";
31 license = stdenv.lib.licenses.mit;
32 maintainers = with stdenv.lib.maintainers; [ vbgl ];
33 };
34}