ocaml-cstruct: 1.6.0 -> 2.3.0

This commit also refactors the expression.
This commit is contained in:
sternenseemann 2016-11-03 01:14:44 +01:00
parent d8686b4949
commit 361975cd93

View File

@ -1,20 +1,40 @@
{stdenv, writeText, fetchurl, ocaml, ocplib-endian, sexplib_p4, findlib, {stdenv, buildOcaml, fetchFromGitHub, writeText,
async_p4 ? null, lwt ? null, camlp4}: ocaml, ocplib-endian, sexplib_p4, findlib, ounit, camlp4,
async_p4 ? null, lwt ? null, ppx_tools ? null,
withAsync ? true, withLwt ? true, withPpx ? true}:
assert stdenv.lib.versionAtLeast (stdenv.lib.getVersion ocaml) "4.01"; with stdenv.lib;
assert withAsync -> async_p4 != null;
assert withLwt -> lwt != null;
assert withPpx -> ppx_tools != null;
stdenv.mkDerivation { buildOcaml rec {
name = "ocaml-cstruct-1.6.0"; name = "cstruct";
version = "2.3.0";
src = fetchurl { minimumSupportedOcamlVersion = "4.02";
url = https://github.com/mirage/ocaml-cstruct/archive/v1.6.0.tar.gz;
sha256 = "0f90a1b7a03091cf22a3ccb11a0cce03b6500f064ad3766b5ed81418ac008ece"; src = fetchFromGitHub {
owner = "mirage";
repo = "ocaml-cstruct";
rev = "v${version}";
sha256 = "19spsgkry41dhsbm6ij71kws90bqp7wiggc6lsqdl43xxvbgdmys";
}; };
configureFlags = stdenv.lib.strings.concatStringsSep " " ((if lwt != null then ["--enable-lwt"] else []) ++ configureFlags = [ "--enable-tests" ] ++
(if async_p4 != null then ["--enable-async"] else [])); optional withLwt [ "--enable-lwt" ] ++
buildInputs = [ocaml findlib camlp4]; optional withAsync [ "--enable-async" ] ++
propagatedBuildInputs = [ocplib-endian sexplib_p4 lwt async_p4]; 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";
createFindlibDestdir = true; createFindlibDestdir = true;
dontStrip = true; dontStrip = true;