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 nativeBuildInputs = [ 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 nativeBuildInputs = [ ocamlbuild ];
21 extra = { createFindlibDestdir = true; };
22 };
23in
24
25stdenv.mkDerivation ({
26 pname = "ocaml${ocaml.version}-rope";
27 inherit (param) version;
28
29 src = fetchurl {
30 inherit (param) url sha256;
31 };
32
33 nativeBuildInputs = [ ocaml findlib ] ++ param.nativeBuildInputs;
34 buildInputs = [ benchmark ] ;
35
36 strictDeps = true;
37
38 meta = {
39 homepage = "http://rope.forge.ocamlcore.org/";
40 inherit (ocaml.meta) platforms;
41 description = ''Ropes ("heavyweight strings") in OCaml'';
42 license = lib.licenses.lgpl21;
43 maintainers = with lib.maintainers; [ ];
44 };
45} // param.extra)