summary refs log tree commit diff
path: root/pkgs/development/ocaml-modules/checkseum
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/ocaml-modules/checkseum')
-rw-r--r--pkgs/development/ocaml-modules/checkseum/default.nix41
-rw-r--r--pkgs/development/ocaml-modules/checkseum/makefile-no-opam.patch12
2 files changed, 45 insertions, 8 deletions
diff --git a/pkgs/development/ocaml-modules/checkseum/default.nix b/pkgs/development/ocaml-modules/checkseum/default.nix
index 731dd476c5d..527afec33eb 100644
--- a/pkgs/development/ocaml-modules/checkseum/default.nix
+++ b/pkgs/development/ocaml-modules/checkseum/default.nix
@@ -1,21 +1,46 @@
-{ lib, fetchurl, buildDunePackage
+{ lib, fetchurl, buildDunePackage, dune-configurator, pkg-config
 , bigarray-compat, optint
-, cmdliner, fmt, rresult
-, alcotest
+, fmt, rresult, bos, fpath, astring, alcotest
+, withFreestanding ? false
+, ocaml-freestanding
 }:
 
 buildDunePackage rec {
-  version = "0.1.1";
+  version = "0.3.1";
   pname = "checkseum";
 
+  useDune2 = true;
+
+  minimumOCamlVersion = "4.07";
+
   src = fetchurl {
     url = "https://github.com/mirage/checkseum/releases/download/v${version}/checkseum-v${version}.tbz";
-    sha256 = "0aa2r1l65a5hcgciw6n8r5ij4gpgg0cf9k24isybxiaiz63k94d3";
+    sha256 = "b9e4d054e17618b1faed8c0eb15afe0614b2f093e58b59a180bda4500a5d2da1";
   };
 
-  buildInputs = [ cmdliner fmt rresult ];
-  propagatedBuildInputs = [ bigarray-compat optint ];
-  checkInputs = lib.optionals doCheck [ alcotest ];
+  patches = [
+    ./makefile-no-opam.patch
+  ];
+
+  nativeBuildInputs = [
+    dune-configurator
+    pkg-config
+  ];
+  propagatedBuildInputs = [
+    bigarray-compat
+    optint
+  ] ++ lib.optionals withFreestanding [
+    ocaml-freestanding
+  ];
+
+  checkInputs = [
+    alcotest
+    bos
+    astring
+    fmt
+    fpath
+    rresult
+  ];
 
   doCheck = true;
 
diff --git a/pkgs/development/ocaml-modules/checkseum/makefile-no-opam.patch b/pkgs/development/ocaml-modules/checkseum/makefile-no-opam.patch
new file mode 100644
index 00000000000..49fb41b2e00
--- /dev/null
+++ b/pkgs/development/ocaml-modules/checkseum/makefile-no-opam.patch
@@ -0,0 +1,12 @@
+diff --git a/freestanding/Makefile b/freestanding/Makefile
+index d535050..bb286bd 100644
+--- a/freestanding/Makefile
++++ b/freestanding/Makefile
+@@ -1,4 +1,6 @@
+-PKG_CONFIG_PATH := $(shell opam config var prefix)/lib/pkgconfig
++ifneq (, $(shell command -v opam))
++PKG_CONFIG_PATH ?= $(shell opam var prefix)/lib/pkgconfig
++endif
+ 
+ EXISTS := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --exists ocaml-freestanding; echo $$?)
+