about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrik Strid <ulrik.strid@outlook.com>2023-05-31 15:19:04 +0200
committerGitHub <noreply@github.com>2023-05-31 15:19:04 +0200
commitafc48694f2aca366710295f027a4a423f3f339cc (patch)
tree3a59457d4b69bbed485a418a17652499d2380a34
parent7098a461b99238eabc920b7c6df95035aa107696 (diff)
parentdb3bdea8aab01032fc71036d02a8f682e17639e5 (diff)
Merge pull request #235181 from NixOS/backport-235165-to-release-23.05
[Backport release-23.05] ocamlPackages.benchmark: 1.4 → 1.6
-rw-r--r--pkgs/development/ocaml-modules/benchmark/default.nix25
-rw-r--r--pkgs/development/ocaml-modules/rope/default.nix45
2 files changed, 20 insertions, 50 deletions
diff --git a/pkgs/development/ocaml-modules/benchmark/default.nix b/pkgs/development/ocaml-modules/benchmark/default.nix
index 6c579e127184c..b0e17054eb532 100644
--- a/pkgs/development/ocaml-modules/benchmark/default.nix
+++ b/pkgs/development/ocaml-modules/benchmark/default.nix
@@ -1,26 +1,17 @@
-{ stdenv, lib, fetchzip, ocaml, findlib, ocamlbuild, ocaml_pcre }:
+{ lib, fetchurl, buildDunePackage }:
 
-stdenv.mkDerivation rec {
-  pname = "ocaml${ocaml.version}-benchmark";
-  version = "1.4";
+buildDunePackage rec {
+  pname = "benchmark";
+  version = "1.6";
 
-  src = fetchzip {
-    url = "https://github.com/Chris00/ocaml-benchmark/releases/download/${version}/benchmark-${version}.tar.gz";
-    sha256 = "16wi8ld7c3mq77ylpgbnj8qqqqimyzwxs47v06vyrwpma5pab5xa";
+  src = fetchurl {
+    url = "https://github.com/Chris00/ocaml-benchmark/releases/download/${version}/benchmark-${version}.tbz";
+    hash = "sha256-Mw19cYya/MEy52PVRYE/B6TnqCWw5tEz9CUrUfKAnPA=";
   };
 
-  strictDeps = true;
-
-  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
-  buildInputs = [ ocaml_pcre ];
-
-  createFindlibDestdir = true;
-
   meta = {
-    homepage = "http://ocaml-benchmark.forge.ocamlcore.org/";
-    inherit (ocaml.meta) platforms;
+    homepage = "https://github.com/Chris00/ocaml-benchmark";
     description = "Benchmark running times of code";
     license = lib.licenses.lgpl21;
-    maintainers = with lib.maintainers; [ ];
   };
 }
diff --git a/pkgs/development/ocaml-modules/rope/default.nix b/pkgs/development/ocaml-modules/rope/default.nix
index 302237c3fe7fe..ff4f304d68515 100644
--- a/pkgs/development/ocaml-modules/rope/default.nix
+++ b/pkgs/development/ocaml-modules/rope/default.nix
@@ -1,45 +1,24 @@
-{ stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, dune_2, benchmark }:
+{ lib, fetchurl, ocaml, buildDunePackage, benchmark }:
 
-let param =
-  if lib.versionAtLeast ocaml.version "4.03"
-  then rec {
-    version = "0.6.2";
-    url = "https://github.com/Chris00/ocaml-rope/releases/download/${version}/rope-${version}.tbz";
-    sha256 = "15cvfa0s1vjx7gjd07d3fkznilishqf4z4h2q5f20wm9ysjh2h2i";
-    nativeBuildInputs = [ dune_2 ];
-    extra = {
-      buildPhase = "dune build -p rope";
-      installPhase = ''
-        dune install --prefix $out --libdir $OCAMLFIND_DESTDIR rope
-      '';
-    };
-  } else {
-    version = "0.5";
-    url = "https://forge.ocamlcore.org/frs/download.php/1156/rope-0.5.tar.gz";
-    sha256 = "05fr2f5ch2rqhyaj06rv5218sbg99p1m9pq5sklk04hpslxig21f";
-    nativeBuildInputs = [ ocamlbuild ];
-    extra = { createFindlibDestdir = true; };
-  };
-in
+lib.throwIf (lib.versionAtLeast ocaml.version "5.0")
+  "rope is not available for OCaml ${ocaml.version}"
 
-stdenv.mkDerivation ({
-  pname = "ocaml${ocaml.version}-rope";
-  inherit (param) version;
+buildDunePackage rec {
+  pname = "rope";
+  version = "0.6.2";
+  minimalOCamlVersion = "4.03";
 
   src = fetchurl {
-    inherit (param) url sha256;
+    url = "https://github.com/Chris00/ocaml-rope/releases/download/${version}/rope-${version}.tbz";
+    sha256 = "15cvfa0s1vjx7gjd07d3fkznilishqf4z4h2q5f20wm9ysjh2h2i";
   };
 
-  nativeBuildInputs = [ ocaml findlib ] ++ param.nativeBuildInputs;
   buildInputs = [ benchmark ] ;
 
-  strictDeps = true;
-
   meta = {
-    homepage = "http://rope.forge.ocamlcore.org/";
-    inherit (ocaml.meta) platforms;
-    description = ''Ropes ("heavyweight strings") in OCaml'';
+    homepage = "https://github.com/Chris00/ocaml-rope";
+    description = "Ropes (“heavyweight strings”) in OCaml";
     license = lib.licenses.lgpl21;
     maintainers = with lib.maintainers; [ ];
   };
-} // param.extra)
+}