Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg, uchar, uutf, cmdliner
2, cmdlinerSupport ? lib.versionAtLeast cmdliner.version "1.1"
3}:
4
5let
6 pname = "uunf";
7 webpage = "https://erratique.ch/software/${pname}";
8 version = "15.0.0";
9in
10
11if lib.versionOlder ocaml.version "4.03"
12then throw "${pname} is not available for OCaml ${ocaml.version}"
13else
14
15stdenv.mkDerivation {
16 name = "ocaml${ocaml.version}-${pname}-${version}";
17 inherit version;
18
19 src = fetchurl {
20 url = "${webpage}/releases/${pname}-${version}.tbz";
21 sha256 = "sha256-B/prPAwfqS8ZPS3fyDDIzXWRbKofwOCyCfwvh9veuug=";
22 };
23
24 nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
25 buildInputs = [ topkg uutf ]
26 ++ lib.optional cmdlinerSupport cmdliner;
27
28 propagatedBuildInputs = [ uchar ];
29
30 strictDeps = true;
31
32 prePatch = lib.optionalString stdenv.isAarch64 "ulimit -s 16384";
33
34 buildPhase = ''
35 runHook preBuild
36 ${topkg.run} build \
37 --with-uutf true \
38 --with-cmdliner ${lib.boolToString cmdlinerSupport}
39 runHook postBuild
40 '';
41
42 inherit (topkg) installPhase;
43
44 meta = with lib; {
45 description = "An OCaml module for normalizing Unicode text";
46 homepage = webpage;
47 license = licenses.bsd3;
48 maintainers = [ maintainers.vbgl ];
49 mainProgram = "unftrip";
50 inherit (ocaml.meta) platforms;
51 };
52}