2016-11-03 00:14:44 +00:00
|
|
|
{stdenv, buildOcaml, fetchFromGitHub, writeText,
|
|
|
|
ocaml, ocplib-endian, sexplib_p4, findlib, ounit, camlp4,
|
|
|
|
async_p4 ? null, lwt ? null, ppx_tools ? null,
|
|
|
|
withAsync ? true, withLwt ? true, withPpx ? true}:
|
2015-02-22 07:17:52 +00:00
|
|
|
|
2016-11-03 00:14:44 +00:00
|
|
|
with stdenv.lib;
|
|
|
|
assert withAsync -> async_p4 != null;
|
|
|
|
assert withLwt -> lwt != null;
|
|
|
|
assert withPpx -> ppx_tools != null;
|
2015-02-22 07:17:52 +00:00
|
|
|
|
2016-11-03 00:14:44 +00:00
|
|
|
buildOcaml rec {
|
|
|
|
name = "cstruct";
|
|
|
|
version = "2.3.0";
|
2015-02-22 07:17:52 +00:00
|
|
|
|
2016-11-03 00:14:44 +00:00
|
|
|
minimumSupportedOcamlVersion = "4.02";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mirage";
|
|
|
|
repo = "ocaml-cstruct";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "19spsgkry41dhsbm6ij71kws90bqp7wiggc6lsqdl43xxvbgdmys";
|
2015-02-22 07:17:52 +00:00
|
|
|
};
|
|
|
|
|
2016-11-03 00:14:44 +00:00
|
|
|
configureFlags = [ "--enable-tests" ] ++
|
|
|
|
optional withLwt [ "--enable-lwt" ] ++
|
|
|
|
optional withAsync [ "--enable-async" ] ++
|
|
|
|
optional withPpx ["--enable-ppx"];
|
|
|
|
configurePhase = "./configure --prefix $out $configureFlags";
|
|
|
|
|
|
|
|
buildInputs = [ ocaml findlib camlp4 ounit ];
|
|
|
|
propagatedBuildInputs = [ocplib-endian sexplib_p4 ] ++
|
|
|
|
optional withPpx ppx_tools ++
|
|
|
|
optional withAsync async_p4 ++
|
|
|
|
optional withLwt lwt;
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
checkTarget = "test";
|
2015-02-22 07:17:52 +00:00
|
|
|
|
|
|
|
createFindlibDestdir = true;
|
2015-05-15 15:32:33 +01:00
|
|
|
dontStrip = true;
|
2015-02-22 07:17:52 +00:00
|
|
|
|
2015-05-15 15:32:33 +01:00
|
|
|
meta = with stdenv.lib; {
|
2015-02-22 07:17:52 +00:00
|
|
|
homepage = https://github.com/mirage/ocaml-cstruct;
|
2015-05-15 15:32:33 +01:00
|
|
|
description = "Map OCaml arrays onto C-like structs";
|
2015-02-22 07:17:52 +00:00
|
|
|
license = stdenv.lib.licenses.isc;
|
2015-05-15 15:32:33 +01:00
|
|
|
maintainers = [ maintainers.vbgl maintainers.ericbmerritt ];
|
2015-12-24 17:49:07 +00:00
|
|
|
platforms = ocaml.meta.platforms or [];
|
2015-02-22 07:17:52 +00:00
|
|
|
};
|
|
|
|
}
|