2017-07-12 20:24:54 +02:00
|
|
|
{ stdenv, fetchzip, ocaml, findlib, ocamlbuild, ocaml_lwt }:
|
|
|
|
|
|
|
|
let param =
|
|
|
|
if stdenv.lib.versionAtLeast ocaml.version "4.2"
|
|
|
|
then {
|
|
|
|
version = "1.7";
|
|
|
|
url = https://math.umons.ac.be/anum/software/csv/csv-1.7.tar.gz;
|
|
|
|
sha256 = "1mmcjiiz0jppgipavpph5kn04xcpalw4scbjrw2z3drghvr3qqwf";
|
|
|
|
lwtSupport = true;
|
|
|
|
} else {
|
|
|
|
version = "1.5";
|
|
|
|
url = https://github.com/Chris00/ocaml-csv/releases/download/1.5/csv-1.5.tar.gz;
|
|
|
|
sha256 = "1ca7jgg58j24pccs5fshis726s06fdcjshnwza5kwxpjgdbvc63g";
|
|
|
|
lwtSupport = false;
|
|
|
|
};
|
|
|
|
in
|
2014-09-21 12:02:55 +02:00
|
|
|
|
2014-08-17 00:31:35 +02:00
|
|
|
stdenv.mkDerivation {
|
|
|
|
|
2017-07-12 20:24:54 +02:00
|
|
|
name = "ocaml${ocaml.version}-csv-${param.version}";
|
2014-08-17 00:31:35 +02:00
|
|
|
|
2015-07-01 20:14:00 +02:00
|
|
|
src = fetchzip {
|
2017-07-12 20:24:54 +02:00
|
|
|
inherit (param) url sha256;
|
2014-08-17 00:31:35 +02:00
|
|
|
};
|
|
|
|
|
2017-07-12 20:24:54 +02:00
|
|
|
buildInputs = [ ocaml findlib ocamlbuild ]
|
|
|
|
++ stdenv.lib.optional param.lwtSupport ocaml_lwt;
|
2014-08-17 00:31:35 +02:00
|
|
|
|
|
|
|
createFindlibDestdir = true;
|
|
|
|
|
2017-07-12 20:24:54 +02:00
|
|
|
configurePhase = "ocaml setup.ml -configure --prefix $out --enable-tests"
|
|
|
|
+ stdenv.lib.optionalString param.lwtSupport " --enable-lwt";
|
2014-08-17 00:31:35 +02:00
|
|
|
|
|
|
|
buildPhase = "ocaml setup.ml -build";
|
|
|
|
|
2015-07-01 20:14:00 +02:00
|
|
|
doCheck = true;
|
|
|
|
checkPhase = "ocaml setup.ml -test";
|
|
|
|
|
2014-08-17 00:31:35 +02:00
|
|
|
installPhase = "ocaml setup.ml -install";
|
|
|
|
|
2014-09-21 12:02:55 +02:00
|
|
|
meta = with stdenv.lib; {
|
2014-08-17 00:31:35 +02:00
|
|
|
description = "A pure OCaml library to read and write CSV files";
|
2015-07-01 20:14:00 +02:00
|
|
|
homepage = https://github.com/Chris00/ocaml-csv;
|
2014-09-21 12:02:55 +02:00
|
|
|
license = licenses.lgpl21;
|
|
|
|
maintainers = [ maintainers.vbgl ];
|
2015-12-24 18:49:07 +01:00
|
|
|
platforms = ocaml.meta.platforms or [];
|
2014-08-17 00:31:35 +02:00
|
|
|
};
|
|
|
|
}
|