git.iko.soy/typeable/nixpkgs
on master help sign in
ocamlPackages.cstruct: 2.3.2 -> 3.0.2
commitbfc0959511519af01c9f04ff171fd188f81d731d authorVincent Laporte <Vincent.Laporte@gmail.com> dateMon 27 Nov 2017, 19:08 (9 years ago) parente7f4979
10 files changed+115−45
pkgs/development/ocaml-modules/cstruct/1.9.0.nix+36 pkgs/development/ocaml-modules/cstruct/default.nix+20−32 pkgs/development/ocaml-modules/cstruct/lwt.nix+12 pkgs/development/ocaml-modules/cstruct/ppx.nix+13 pkgs/development/ocaml-modules/cstruct/unix.nix+12 pkgs/development/ocaml-modules/nocrypto/default.nix+3−3 pkgs/development/ocaml-modules/otr/default.nix+2−2 pkgs/development/ocaml-modules/tls/default.nix+2−2 pkgs/development/ocaml-modules/x509/default.nix+4−2 pkgs/top-level/ocaml-packages.nix+11−4
pkgs/development/ocaml-modules/cstruct/1.9.0.nixnew file+36
@@ -0,0 +1,36 @@
1+{ stdenv, writeText, fetchFromGitHub, ocaml, ocamlbuild, ocplib-endian, sexplib, findlib, ppx_tools
2+, async ? null, lwt ? null
3+}:
4+
5+assert stdenv.lib.versionAtLeast ocaml.version "4.01";
6+
7+let version = "1.9.0"; in
8+
9+let opt = b: "--${if b != null then "en" else "dis"}able"; in
10+
11+stdenv.mkDerivation {
12+ name = "ocaml${ocaml.version}-cstruct-${version}";
13+
14+ src = fetchFromGitHub {
15+ owner = "mirage";
16+ repo = "ocaml-cstruct";
17+ rev = "v${version}";
18+ sha256 = "1c1j21zgmxi9spq23imy7byn50qr7hlds1cfpzxlsx9dp309jngy";
19+ };
20+
21+ configureFlags = [ "${opt lwt}-lwt" "${opt async}-async" "${opt ppx_tools}-ppx" ];
22+
23+ buildInputs = [ ocaml findlib ocamlbuild ppx_tools lwt async ];
24+ propagatedBuildInputs = [ ocplib-endian sexplib ];
25+
26+ createFindlibDestdir = true;
27+ dontStrip = true;
28+
29+ meta = with stdenv.lib; {
30+ homepage = https://github.com/mirage/ocaml-cstruct;
31+ description = "Map OCaml arrays onto C-like structs";
32+ license = stdenv.lib.licenses.isc;
33+ maintainers = [ maintainers.vbgl maintainers.ericbmerritt ];
34+ platforms = ocaml.meta.platforms or [];
35+ };
36+}
pkgs/development/ocaml-modules/cstruct/default.nix+20−32
@@ -1,40 +1,28 @@
1−{ stdenv, writeText, fetchFromGitHub, ocaml, ocamlbuild, ocplib-endian, sexplib, findlib, ppx_tools
2−, async ? null, lwt ? null
3−}:
1+{ stdenv, fetchurl, ocaml, jbuilder, findlib, sexplib, ocplib-endian }:
42
5−assert stdenv.lib.versionAtLeast ocaml.version "4.01";
3+stdenv.mkDerivation rec {
4+ name = "ocaml${ocaml.version}-cstruct-${version}";
5+ version = "3.0.2";
6+ src = fetchurl {
7+ url = "https://github.com/mirage/ocaml-cstruct/releases/download/v${version}/cstruct-${version}.tbz";
8+ sha256 = "03caxcyzfjmbnnwa15zy9s1ckkl4sc834d1qkgi4jcs3zqchvd8z";
9+ };
610
7−let param =
8− if stdenv.lib.versionAtLeast ocaml.version "4.02"
9− then { version = "2.3.2"; sha256 = "1fykack86hvvqhwngddyxxqlwm3xjljfaszsjbdrvjlrd1nlg079"; }
10− else { version = "1.9.0"; sha256 = "1c1j21zgmxi9spq23imy7byn50qr7hlds1cfpzxlsx9dp309jngy"; };
11−in
11+ unpackCmd = "tar -xjf $curSrc";
1212
13−let opt = b: "--${if b != null then "en" else "dis"}able"; in
13+ buildInputs = [ ocaml jbuilder findlib ];
1414
15−stdenv.mkDerivation {
16− name = "ocaml${ocaml.version}-cstruct-${param.version}";
15+ propagatedBuildInputs = [ sexplib ocplib-endian ];
1716
18− src = fetchFromGitHub {
19− owner = "mirage";
20− repo = "ocaml-cstruct";
21− rev = "v${param.version}";
22− inherit (param) sha256;
23− };
17+ buildPhase = "jbuilder build -p cstruct";
2418
25− configureFlags = [ "${opt lwt}-lwt" "${opt async}-async" "${opt ppx_tools}-ppx" ];
19+ inherit (jbuilder) installPhase;
2620
27− buildInputs = [ ocaml findlib ocamlbuild ppx_tools lwt async ];
28− propagatedBuildInputs = [ ocplib-endian sexplib ];
29−
30− createFindlibDestdir = true;
31− dontStrip = true;
32−
33− meta = with stdenv.lib; {
34− homepage = https://github.com/mirage/ocaml-cstruct;
35− description = "Map OCaml arrays onto C-like structs";
36− license = stdenv.lib.licenses.isc;
37− maintainers = [ maintainers.vbgl maintainers.ericbmerritt ];
38− platforms = ocaml.meta.platforms or [];
39− };
21+ meta = {
22+ description = "Access C-like structures directly from OCaml";
23+ license = stdenv.lib.licenses.isc;
24+ maintainers = [ stdenv.lib.maintainers.vbgl ];
25+ inherit (src.meta) homepage;
26+ inherit (ocaml.meta) platforms;
27+ };
4028}
pkgs/development/ocaml-modules/cstruct/lwt.nixnew file+12
@@ -0,0 +1,12 @@
1+{ stdenv, ocaml, cstruct, lwt }:
2+
3+assert stdenv.lib.versionAtLeast ocaml.version "4.02";
4+
5+stdenv.mkDerivation rec {
6+ name = "ocaml${ocaml.version}-cstruct-lwt-${version}";
7+ inherit (cstruct) version src unpackCmd buildInputs installPhase meta;
8+
9+ propagatedBuildInputs = [ cstruct lwt ];
10+
11+ buildPhase = "${cstruct.buildPhase}-lwt";
12+}
pkgs/development/ocaml-modules/cstruct/ppx.nixnew file+13
@@ -0,0 +1,13 @@
1+{ stdenv, ocaml, cstruct, ppx_tools_versioned }:
2+
3+assert stdenv.lib.versionAtLeast ocaml.version "4.02";
4+
5+stdenv.mkDerivation rec {
6+ name = "ocaml${ocaml.version}-ppx_cstruct-${version}";
7+ inherit (cstruct) version src unpackCmd installPhase meta;
8+
9+ buildInputs = cstruct.buildInputs ++ [ ppx_tools_versioned ];
10+ propagatedBuildInputs = [ cstruct ];
11+
12+ buildPhase = "jbuilder build -p ppx_cstruct";
13+}
pkgs/development/ocaml-modules/cstruct/unix.nixnew file+12
@@ -0,0 +1,12 @@
1+{ stdenv, ocaml, cstruct }:
2+
3+assert stdenv.lib.versionAtLeast ocaml.version "4.02";
4+
5+stdenv.mkDerivation rec {
6+ name = "ocaml${ocaml.version}-cstruct-unix-${version}";
7+ inherit (cstruct) version src unpackCmd buildInputs installPhase meta;
8+
9+ propagatedBuildInputs = [ cstruct ];
10+
11+ buildPhase = "${cstruct.buildPhase}-unix";
12+}
pkgs/development/ocaml-modules/nocrypto/default.nix+3−3
@@ -1,11 +1,11 @@
11{ stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild, opam, topkg
22, cpuid, ocb-stubblr
33, cstruct, zarith, ppx_sexp_conv, sexplib
4−, lwt ? null
4+, cstruct-lwt ? null
55}:
66
77with stdenv.lib;
8−let withLwt = lwt != null; in
8+let withLwt = cstruct-lwt != null; in
99
1010stdenv.mkDerivation rec {
1111 name = "ocaml${ocaml.version}-nocrypto-${version}";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
2020
2121 buildInputs = [ ocaml findlib ocamlbuild topkg opam cpuid ocb-stubblr
2222 ppx_sexp_conv ];
23− propagatedBuildInputs = [ cstruct zarith sexplib ] ++ optional withLwt lwt;
23+ propagatedBuildInputs = [ cstruct zarith sexplib ] ++ optional withLwt cstruct-lwt;
2424
2525 buildPhase = ''
2626 LD_LIBRARY_PATH=${cpuid}/lib/ocaml/${ocaml.version}/site-lib/stubslibs/ \
pkgs/development/ocaml-modules/otr/default.nix+2−2
@@ -1,5 +1,5 @@
11{stdenv, buildOcaml, fetchFromGitHub, ocamlbuild, findlib, topkg, ocaml, opam,
2− ppx_tools, ppx_sexp_conv, cstruct, sexplib, result, nocrypto, astring}:
2+ ppx_tools, ppx_sexp_conv, cstruct, ppx_cstruct, sexplib, result, nocrypto, astring}:
33
44let ocamlFlags = "-I ${findlib}/lib/ocaml/${ocaml.version}/site-lib/"; in
55
@@ -16,7 +16,7 @@ buildOcaml rec {
1616 sha256 = "07zzix5mfsasqpqdx811m0x04gp8mq1ayf4b64998k98027v01rr";
1717 };
1818
19− buildInputs = [ ocamlbuild findlib topkg ppx_tools ppx_sexp_conv opam ];
19+ buildInputs = [ ocamlbuild findlib topkg ppx_tools ppx_sexp_conv opam ppx_cstruct ];
2020 propagatedBuildInputs = [ cstruct sexplib result nocrypto astring ];
2121
2222 buildPhase = ''
pkgs/development/ocaml-modules/tls/default.nix+2−2
@@ -1,5 +1,5 @@
11{ stdenv, buildOcaml, fetchFromGitHub, findlib, ocamlbuild, ocaml_oasis
2−, ppx_tools, ppx_sexp_conv, result, x509, nocrypto, cstruct, ounit
2+, ppx_tools, ppx_sexp_conv, result, x509, nocrypto, cstruct, ppx_cstruct, cstruct-unix, ounit
33, lwt ? null}:
44
55with stdenv.lib;
@@ -19,7 +19,7 @@ buildOcaml rec {
1919 sha256 = "19q2hzxiasz9pzczgb63kikg0mc9mw98dfvch5falf2rincycj24";
2020 };
2121
22− buildInputs = [ ocamlbuild findlib ocaml_oasis ppx_sexp_conv ounit ];
22+ buildInputs = [ ocamlbuild findlib ocaml_oasis ppx_sexp_conv ounit ppx_cstruct cstruct-unix ];
2323 propagatedBuildInputs = [ cstruct nocrypto result x509 ] ++
2424 optional withLwt lwt;
2525
pkgs/development/ocaml-modules/x509/default.nix+4−2
@@ -1,4 +1,6 @@
1−{stdenv, buildOcaml, fetchFromGitHub, ocaml, findlib, asn1-combinators, nocrypto, ounit, ocaml_oasis, ppx_sexp_conv}:
1+{ stdenv, buildOcaml, fetchFromGitHub, ocaml, findlib, asn1-combinators, nocrypto
2+, ounit, ocaml_oasis, ppx_sexp_conv, cstruct-unix
3+}:
24
35buildOcaml rec {
46 name = "x509";
@@ -13,7 +15,7 @@ buildOcaml rec {
1315 sha256 = "07cc3z6h87460z3f4vz8nlczw5jkc4vjhix413z9x6nral876rn7";
1416 };
1517
16− buildInputs = [ ocaml ocaml_oasis findlib ounit ppx_sexp_conv ];
18+ buildInputs = [ ocaml ocaml_oasis findlib ounit ppx_sexp_conv cstruct-unix ];
1719 propagatedBuildInputs = [ asn1-combinators nocrypto ];
1820
1921 configureFlags = "--enable-tests";
pkgs/top-level/ocaml-packages.nix+11−4
@@ -176,10 +176,17 @@ let
176176
177177 cryptokit = callPackage ../development/ocaml-modules/cryptokit { };
178178
179− cstruct = callPackage ../development/ocaml-modules/cstruct {
179+ cstruct =
180+ if lib.versionAtLeast ocaml.version "4.2"
181+ then callPackage ../development/ocaml-modules/cstruct {}
182+ else callPackage ../development/ocaml-modules/cstruct/1.9.0.nix { lwt = ocaml_lwt; };
183+
184+ cstruct-lwt = callPackage ../development/ocaml-modules/cstruct/lwt.nix {
180185 lwt = ocaml_lwt;
181186 };
182187
188+ cstruct-unix = callPackage ../development/ocaml-modules/cstruct/unix.nix {};
189+
183190 csv =
184191 if lib.versionAtLeast ocaml.version "4.2"
185192 then callPackage ../development/ocaml-modules/csv { }
@@ -380,9 +387,7 @@ let
380387
381388 mtime = callPackage ../development/ocaml-modules/mtime { };
382389
383− nocrypto = callPackage ../development/ocaml-modules/nocrypto {
384− lwt = ocaml_lwt;
385− };
390+ nocrypto = callPackage ../development/ocaml-modules/nocrypto { };
386391
387392 notty = callPackage ../development/ocaml-modules/notty {
388393 lwt = ocaml_lwt;
@@ -570,6 +575,8 @@ let
570575 then callPackage ../development/ocaml-modules/ppx_blob {}
571576 else null;
572577
578+ ppx_cstruct = callPackage ../development/ocaml-modules/cstruct/ppx.nix {};
579+
573580 ppx_derivers = callPackage ../development/ocaml-modules/ppx_derivers {};
574581
575582 ppx_deriving =