1{ stdenv, fetchzip, ocaml, findlib, ocamlbuild, 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.3"; in 7 8stdenv.mkDerivation { 9 name = "ocaml${ocaml.version}-stringext-${version}"; 10 11 src = fetchzip { 12 url = "https://github.com/rgrinberg/stringext/archive/v${version}.tar.gz"; 13 sha256 = "121k79vjazvsd254yg391fp4spsd1p32amccrahd0g6hjhf5w6sl"; 14 }; 15 16 buildInputs = [ ocaml findlib ocamlbuild 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 or []; 30 description = "Extra string functions for OCaml"; 31 license = stdenv.lib.licenses.mit; 32 maintainers = with stdenv.lib.maintainers; [ vbgl ]; 33 }; 34}