2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, ocaml, ocamlbuild, ocplib-endian, sexplib, findlib, ppx_tools
|
2017-11-27 19:08:40 +00:00
|
|
|
, async ? null, lwt ? null
|
|
|
|
}:
|
|
|
|
|
2021-01-11 12:49:15 +00:00
|
|
|
assert lib.versionAtLeast ocaml.version "4.01";
|
2017-11-27 19:08:40 +00:00
|
|
|
|
|
|
|
let version = "1.9.0"; in
|
|
|
|
|
|
|
|
let opt = b: "--${if b != null then "en" else "dis"}able"; in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "ocaml${ocaml.version}-cstruct-${version}";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mirage";
|
|
|
|
repo = "ocaml-cstruct";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "1c1j21zgmxi9spq23imy7byn50qr7hlds1cfpzxlsx9dp309jngy";
|
|
|
|
};
|
|
|
|
|
|
|
|
configureFlags = [ "${opt lwt}-lwt" "${opt async}-async" "${opt ppx_tools}-ppx" ];
|
|
|
|
|
|
|
|
buildInputs = [ ocaml findlib ocamlbuild ppx_tools lwt async ];
|
|
|
|
propagatedBuildInputs = [ ocplib-endian sexplib ];
|
|
|
|
|
|
|
|
createFindlibDestdir = true;
|
|
|
|
dontStrip = true;
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/mirage/ocaml-cstruct";
|
2017-11-27 19:08:40 +00:00
|
|
|
description = "Map OCaml arrays onto C-like structs";
|
2021-01-11 12:49:15 +00:00
|
|
|
license = lib.licenses.isc;
|
2017-11-27 19:08:40 +00:00
|
|
|
maintainers = [ maintainers.vbgl maintainers.ericbmerritt ];
|
|
|
|
platforms = ocaml.meta.platforms or [];
|
|
|
|
};
|
|
|
|
}
|