Files
nixpkgs/pkgs/development/ocaml-modules/cstruct/default.nix
T

41 lines
1.3 KiB
Nix
Raw Normal View History

{ stdenv, writeText, fetchFromGitHub, ocaml, ocamlbuild, ocplib-endian, sexplib, findlib, ppx_tools
2016-11-17 21:37:56 +01:00
, async ? null, lwt ? null
}:
2015-02-22 08:17:52 +01:00
assert stdenv.lib.versionAtLeast ocaml.version "4.01";
let param =
if stdenv.lib.versionAtLeast ocaml.version "4.02"
2017-03-28 16:50:44 +00:00
then { version = "2.3.2"; sha256 = "1fykack86hvvqhwngddyxxqlwm3xjljfaszsjbdrvjlrd1nlg079"; }
else { version = "1.9.0"; sha256 = "1c1j21zgmxi9spq23imy7byn50qr7hlds1cfpzxlsx9dp309jngy"; };
in
let opt = b: "--${if b != null then "en" else "dis"}able"; in
2015-02-22 08:17:52 +01:00
stdenv.mkDerivation {
name = "ocaml${ocaml.version}-cstruct-${param.version}";
2015-02-22 08:17:52 +01:00
src = fetchFromGitHub {
owner = "mirage";
repo = "ocaml-cstruct";
rev = "v${param.version}";
inherit (param) sha256;
2015-02-22 08:17:52 +01:00
};
2016-11-17 21:37:56 +01:00
configureFlags = [ "${opt lwt}-lwt" "${opt async}-async" "${opt ppx_tools}-ppx" ];
buildInputs = [ ocaml findlib ocamlbuild ppx_tools lwt async ];
2016-11-17 21:37:56 +01:00
propagatedBuildInputs = [ ocplib-endian sexplib ];
2015-02-22 08:17:52 +01:00
createFindlibDestdir = true;
2015-05-15 09:32:33 -05:00
dontStrip = true;
2015-02-22 08:17:52 +01:00
2015-05-15 09:32:33 -05:00
meta = with stdenv.lib; {
2015-02-22 08:17:52 +01:00
homepage = https://github.com/mirage/ocaml-cstruct;
2015-05-15 09:32:33 -05:00
description = "Map OCaml arrays onto C-like structs";
2015-02-22 08:17:52 +01:00
license = stdenv.lib.licenses.isc;
2015-05-15 09:32:33 -05:00
maintainers = [ maintainers.vbgl maintainers.ericbmerritt ];
platforms = ocaml.meta.platforms or [];
2015-02-22 08:17:52 +01:00
};
}