summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Laporte <Vincent.Laporte@gmail.com>2023-05-31 11:45:07 +0200
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2023-05-31 11:15:20 +0000
commit368a6472833faaf61e823332f3a47b593c31dc98 (patch)
treeb5ee182e99af6f84c639a7e90611f30358be5588
parentMerge pull request #235047 from NixOS/backport-235040-to-release-23.05 (diff)
downloadnixpkgs-368a6472833faaf61e823332f3a47b593c31dc98.tar.gz
ocamlPackages.rope: refactor
- remove legacy version 0.5 (broken) - disable for OCaml ≥ 5.0 (cherry picked from commit d74ed5ebb0cbac08774bccfc6f07bdd3f544ac75)
-rw-r--r--pkgs/development/ocaml-modules/rope/default.nix45
1 files changed, 12 insertions, 33 deletions
diff --git a/pkgs/development/ocaml-modules/rope/default.nix b/pkgs/development/ocaml-modules/rope/default.nix
index 302237c3fe7f..ff4f304d6851 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)
+}