2016-11-17 20:37:56 +00:00
|
|
|
{ stdenv, writeText, fetchFromGitHub, ocaml, ocplib-endian, sexplib, findlib, ppx_tools
|
|
|
|
, async ? null, lwt ? null
|
2016-11-12 09:17:30 +00:00
|
|
|
}:
|
2015-02-22 07:17:52 +00:00
|
|
|
|
2016-11-12 09:17:30 +00:00
|
|
|
assert stdenv.lib.versionAtLeast ocaml.version "4.01";
|
|
|
|
|
|
|
|
let param =
|
|
|
|
if stdenv.lib.versionAtLeast ocaml.version "4.02"
|
|
|
|
then { version = "2.3.0"; sha256 = "19spsgkry41dhsbm6ij71kws90bqp7wiggc6lsqdl43xxvbgdmys"; }
|
|
|
|
else { version = "1.9.0"; sha256 = "1c1j21zgmxi9spq23imy7byn50qr7hlds1cfpzxlsx9dp309jngy"; };
|
|
|
|
in
|
|
|
|
|
|
|
|
let opt = b: "--${if b != null then "en" else "dis"}able"; in
|
2015-02-22 07:17:52 +00:00
|
|
|
|
2016-11-04 11:24:57 +00:00
|
|
|
stdenv.mkDerivation {
|
2016-11-12 09:17:30 +00:00
|
|
|
name = "ocaml${ocaml.version}-cstruct-${param.version}";
|
2015-02-22 07:17:52 +00:00
|
|
|
|
2016-11-12 09:17:30 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mirage";
|
|
|
|
repo = "ocaml-cstruct";
|
|
|
|
rev = "v${param.version}";
|
|
|
|
inherit (param) sha256;
|
2015-02-22 07:17:52 +00:00
|
|
|
};
|
|
|
|
|
2016-11-17 20:37:56 +00:00
|
|
|
configureFlags = [ "${opt lwt}-lwt" "${opt async}-async" "${opt ppx_tools}-ppx" ];
|
2016-11-12 09:17:30 +00:00
|
|
|
|
2016-11-17 20:37:56 +00:00
|
|
|
buildInputs = [ ocaml findlib ppx_tools lwt async ];
|
|
|
|
propagatedBuildInputs = [ ocplib-endian sexplib ];
|
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
|
|
|
};
|
|
|
|
}
|