about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/ocaml-modules/cstruct
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/ocaml-modules/cstruct')
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/cstruct/default.nix10
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/cstruct/lwt.nix2
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/cstruct/ppx.nix24
-rw-r--r--nixpkgs/pkgs/development/ocaml-modules/cstruct/sexp.nix7
4 files changed, 34 insertions, 9 deletions
diff --git a/nixpkgs/pkgs/development/ocaml-modules/cstruct/default.nix b/nixpkgs/pkgs/development/ocaml-modules/cstruct/default.nix
index acd5d83e4f1e..8b0c4ee9ebbc 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/cstruct/default.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/cstruct/default.nix
@@ -1,8 +1,8 @@
-{ lib, fetchurl, buildDunePackage, bigarray-compat }:
+{ lib, fetchurl, buildDunePackage, bigarray-compat, alcotest, ocaml }:
 
 buildDunePackage rec {
   pname = "cstruct";
-  version = "5.0.0";
+  version = "6.0.0";
 
   useDune2 = true;
 
@@ -10,11 +10,15 @@ buildDunePackage rec {
 
   src = fetchurl {
     url = "https://github.com/mirage/ocaml-cstruct/releases/download/v${version}/cstruct-v${version}.tbz";
-    sha256 = "1z403q2nkgz5x07j0ypy6q0mk2yxgqbp1jlqkngbajna7124x2pb";
+    sha256 = "0xi6cj85z033fqrqdkwac6gg07629vzdhx03c3lhiwwc4lpnv8bq";
   };
 
   propagatedBuildInputs = [ bigarray-compat ];
 
+  # alcotest isn't available for OCaml < 4.05 due to fmt
+  doCheck = lib.versionAtLeast ocaml.version "4.05";
+  checkInputs = [ alcotest ];
+
   meta = {
     description = "Access C-like structures directly from OCaml";
     license = lib.licenses.isc;
diff --git a/nixpkgs/pkgs/development/ocaml-modules/cstruct/lwt.nix b/nixpkgs/pkgs/development/ocaml-modules/cstruct/lwt.nix
index 113df1e89b5c..df8941d1260d 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/cstruct/lwt.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/cstruct/lwt.nix
@@ -8,7 +8,7 @@ buildDunePackage {
   pname = "cstruct-lwt";
   inherit (cstruct) version src useDune2 meta;
 
-  minimumOCamlVersion = "4.02";
+  minimumOCamlVersion = "4.03";
 
   propagatedBuildInputs = [ cstruct lwt ];
 }
diff --git a/nixpkgs/pkgs/development/ocaml-modules/cstruct/ppx.nix b/nixpkgs/pkgs/development/ocaml-modules/cstruct/ppx.nix
index 44343812090d..aa003295e908 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/cstruct/ppx.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/cstruct/ppx.nix
@@ -1,4 +1,7 @@
-{ lib, buildDunePackage, cstruct, sexplib, ppx_tools_versioned, ppxlib }:
+{ lib, buildDunePackage, cstruct, sexplib, ppxlib, stdlib-shims
+, ounit, cppo, ppx_sexp_conv, cstruct-unix, cstruct-sexp
+, fetchpatch
+}:
 
 if !lib.versionAtLeast (cstruct.version or "1") "3"
 then cstruct
@@ -8,7 +11,22 @@ buildDunePackage {
   pname = "ppx_cstruct";
   inherit (cstruct) version src useDune2 meta;
 
-  minimumOCamlVersion = "4.03";
+  minimumOCamlVersion = "4.07";
 
-  propagatedBuildInputs = [ cstruct ppx_tools_versioned ppxlib sexplib ];
+  # prevent ANSI escape sequences from messing up the test cases
+  # https://github.com/mirage/ocaml-cstruct/issues/283
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/mirage/ocaml-cstruct/pull/285/commits/60dfed98b4c34455bf339ac60e2ed5ef05feb48f.patch";
+      sha256 = "1x9i62nrlfy9l44vb0a7qjfrg2wyki4c8nmmqnzwpcbkgxi3q6n5";
+    })
+  ];
+
+  propagatedBuildInputs = [ cstruct ppxlib sexplib stdlib-shims ];
+
+  # disable until ppx_sexp_conv uses ppxlib 0.20.0 (or >= 0.16.0)
+  # since the propagation of the older ppxlib breaks the ppx_cstruct
+  # build.
+  doCheck = false;
+  checkInputs = [ ounit cppo ppx_sexp_conv cstruct-sexp cstruct-unix ];
 }
diff --git a/nixpkgs/pkgs/development/ocaml-modules/cstruct/sexp.nix b/nixpkgs/pkgs/development/ocaml-modules/cstruct/sexp.nix
index 742cb6522ebf..b04810e48038 100644
--- a/nixpkgs/pkgs/development/ocaml-modules/cstruct/sexp.nix
+++ b/nixpkgs/pkgs/development/ocaml-modules/cstruct/sexp.nix
@@ -8,8 +8,11 @@ buildDunePackage rec {
   pname = "cstruct-sexp";
   inherit (cstruct) version src useDune2 meta;
 
-  doCheck = lib.versionAtLeast ocaml.version "4.03";
-  checkInputs = lib.optional doCheck alcotest;
+  minimumOCamlVersion = "4.03";
+
+  # alcotest is only available on OCaml >= 4.05 due to fmt
+  doCheck = lib.versionAtLeast ocaml.version "4.05";
+  checkInputs = [ alcotest ];
 
   propagatedBuildInputs = [ cstruct sexplib ];
 }