diff options
author | Vincent Laporte <Vincent.Laporte@gmail.com> | 2016-11-12 10:17:30 +0100 |
---|---|---|
committer | Vincent Laporte <Vincent.Laporte@gmail.com> | 2016-11-12 12:41:27 +0100 |
commit | 2d136204c47985c9518105e1af9e14810c8319ec (patch) | |
tree | 75c813173f2af5baf66bed2227a930d88e7c0ed1 /pkgs/development/ocaml-modules/cstruct | |
parent | 72c1a6f0f46cf4e35986b49f957f690922ba7a02 (diff) | |
download | nixpkgs-2d136204c47985c9518105e1af9e14810c8319ec.tar nixpkgs-2d136204c47985c9518105e1af9e14810c8319ec.tar.gz nixpkgs-2d136204c47985c9518105e1af9e14810c8319ec.tar.bz2 nixpkgs-2d136204c47985c9518105e1af9e14810c8319ec.tar.lz nixpkgs-2d136204c47985c9518105e1af9e14810c8319ec.tar.xz nixpkgs-2d136204c47985c9518105e1af9e14810c8319ec.tar.zst nixpkgs-2d136204c47985c9518105e1af9e14810c8319ec.zip |
ocamlPackages.cstruct: 1.6.0 -> 1.9.0, 2.3.0
Diffstat (limited to 'pkgs/development/ocaml-modules/cstruct')
-rw-r--r-- | pkgs/development/ocaml-modules/cstruct/default.nix | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/pkgs/development/ocaml-modules/cstruct/default.nix b/pkgs/development/ocaml-modules/cstruct/default.nix index c9f04918d17..dd6cffb979c 100644 --- a/pkgs/development/ocaml-modules/cstruct/default.nix +++ b/pkgs/development/ocaml-modules/cstruct/default.nix @@ -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; |