1{ stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, dune_2, benchmark }:
2
3let param =
4 if lib.versionAtLeast ocaml.version "4.03"
5 then rec {
6 version = "0.6.2";
7 url = "https://github.com/Chris00/ocaml-rope/releases/download/${version}/rope-${version}.tbz";
8 sha256 = "15cvfa0s1vjx7gjd07d3fkznilishqf4z4h2q5f20wm9ysjh2h2i";
9 buildInputs = [ dune_2 ];
10 extra = {
11 buildPhase = "dune build -p rope";
12 installPhase = ''
13 dune install --prefix $out --libdir $OCAMLFIND_DESTDIR rope
14 '';
15 };
16 } else {
17 version = "0.5";
18 url = "https://forge.ocamlcore.org/frs/download.php/1156/rope-0.5.tar.gz";
19 sha256 = "05fr2f5ch2rqhyaj06rv5218sbg99p1m9pq5sklk04hpslxig21f";
20 buildInputs = [ ocamlbuild ];
21 extra = { createFindlibDestdir = true; };
22 };
23in
24
25stdenv.mkDerivation ({
26 name = "ocaml${ocaml.version}-rope-${param.version}";
27
28 src = fetchurl {
29 inherit (param) url sha256;
30 };
31
32 buildInputs = [ ocaml findlib benchmark ] ++ param.buildInputs;
33
34 meta = {
35 homepage = "http://rope.forge.ocamlcore.org/";
36 platforms = ocaml.meta.platforms or [];
37 description = ''Ropes ("heavyweight strings") in OCaml'';
38 license = lib.licenses.lgpl21;
39 maintainers = with lib.maintainers; [ volth ];
40 };
41} // param.extra)