summaryrefslogtreecommitdiffstats
path: root/pkgs/development/ocaml-modules/uutf/default.nix
blob: 8c3c333c96a65c70fc57b0fd4478566e747fbd65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
  lib,
  stdenv,
  fetchurl,
  ocaml,
  findlib,
  ocamlbuild,
  cmdliner,
  topkg,
  uchar,
  version ?
    if lib.versionAtLeast ocaml.version "4.08" then
      "1.0.4"
    else if lib.versionAtLeast ocaml.version "4.03" then
      "1.0.3"
    else
      throw "uutf is not available with OCaml ${ocaml.version}",
}:

stdenv.mkDerivation (finalAttrs: {
  name = "ocaml${ocaml.version}-${finalAttrs.pname}-${finalAttrs.version}";
  pname = "uutf";
  inherit version;

  src = fetchurl {
    url = "https://erratique.ch/software/uutf/releases/uutf-${version}.tbz";
    hash =
      {
        "1.0.3" = "sha256-h3KlYT0ecCmM4U3zMkGjaF8h5O9r20zwP+mF+x7KBWg=";
        "1.0.4" = "sha256-p6V45q+RSaiJThjjtHWchWWTemnGyaznowu/BIRhnKg=";
      }
      ."${version}";
  };

  nativeBuildInputs = [
    ocaml
    ocamlbuild
    findlib
    topkg
  ];
  buildInputs = [
    topkg
    cmdliner
  ];
  propagatedBuildInputs = [ uchar ];

  strictDeps = true;

  inherit (topkg) buildPhase installPhase;

  meta = {
    description = "Non-blocking streaming Unicode codec for OCaml";
    homepage = "https://erratique.ch/software/uutf";
    changelog = "https://raw.githubusercontent.com/dbuenzli/uutf/refs/tags/v${version}/CHANGES.md";
    license = lib.licenses.isc;
    maintainers = [ lib.maintainers.vbgl ];
    mainProgram = "utftrip";
    inherit (ocaml.meta) platforms;
  };
})