ocamlPackages.cstruct: 1.6.0 -> 1.9.0, 2.3.0

This commit is contained in:
Vincent Laporte 2016-11-12 10:17:30 +01:00
parent 72c1a6f0f4
commit 2d136204c4
2 changed files with 24 additions and 13 deletions

View file

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

View file

@ -1,4 +1,4 @@
{ stdenv, fetchzip, ocaml, findlib, cstruct, type_conv, zarith, ounit }:
{ stdenv, fetchzip, ocaml, findlib, cstruct, type_conv, zarith, ocaml_lwt, ounit }:
assert stdenv.lib.versionAtLeast ocaml.version "4.01";
@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
sha256 = "15gffvixk12ghsfra9amfszd473c8h188zfj03ngvblbdm0d80m0";
};
buildInputs = [ ocaml findlib type_conv ounit ];
buildInputs = [ ocaml findlib type_conv ocaml_lwt ounit ];
propagatedBuildInputs = [ cstruct zarith ];
configureFlags = "--enable-tests";