1{
2 stdenv,
3 lib,
4 fetchurl,
5 ocaml,
6 findlib,
7 ocamlbuild,
8 topkg,
9}:
10
11let
12 # Use astring 0.8.3 for OCaml < 4.05
13 param =
14 if lib.versionAtLeast ocaml.version "4.05" then
15 {
16 version = "0.8.5";
17 sha256 = "1ykhg9gd3iy7zsgyiy2p9b1wkpqg9irw5pvcqs3sphq71iir4ml6";
18 }
19 else
20 {
21 version = "0.8.3";
22 sha256 = "0ixjwc3plrljvj24za3l9gy0w30lsbggp8yh02lwrzw61ls4cri0";
23 };
24in
25
26stdenv.mkDerivation {
27 pname = "ocaml${ocaml.version}-astring";
28 inherit (param) version;
29
30 src = fetchurl {
31 url = "https://erratique.ch/software/astring/releases/astring-${param.version}.tbz";
32 inherit (param) sha256;
33 };
34
35 nativeBuildInputs = [
36 ocaml
37 findlib
38 ocamlbuild
39 topkg
40 ];
41 buildInputs = [ topkg ];
42
43 strictDeps = true;
44
45 inherit (topkg) buildPhase installPhase;
46
47 meta = {
48 homepage = "https://erratique.ch/software/astring";
49 description = "Alternative String module for OCaml";
50 longDescription = ''
51 Astring exposes an alternative String module for OCaml. This module tries
52 to balance minimality and expressiveness for basic, index-free, string
53 processing and provides types and functions for substrings, string sets
54 and string maps.
55
56 Remaining compatible with the OCaml String module is a non-goal.
57 The String module exposed by Astring has exception safe functions, removes
58 deprecated and rarely used functions, alters some signatures and names,
59 adds a few missing functions and fully exploits OCaml's newfound string
60 immutability.
61 '';
62 license = lib.licenses.isc;
63 maintainers = with lib.maintainers; [ sternenseemann ];
64 };
65}