2024-01-13 08:15:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg, uutf, cmdliner
|
2022-09-30 11:47:45 +00:00
|
|
|
, cmdlinerSupport ? lib.versionAtLeast cmdliner.version "1.1"
|
2024-01-13 08:15:51 +00:00
|
|
|
, version ? if lib.versionAtLeast ocaml.version "4.14" then "15.1.0" else "15.0.0"
|
2022-09-30 11:47:45 +00:00
|
|
|
}:
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
let
|
|
|
|
pname = "uunf";
|
|
|
|
webpage = "https://erratique.ch/software/${pname}";
|
2024-01-13 08:15:51 +00:00
|
|
|
hash = {
|
|
|
|
"15.0.0" = "sha256-B/prPAwfqS8ZPS3fyDDIzXWRbKofwOCyCfwvh9veuug=";
|
|
|
|
"15.1.0" = "sha256-D8yvb7hVWaYxMqMZ5089/5tWDfvyGXKUOjhfU/4zSeQ=";
|
|
|
|
}."${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
if lib.versionOlder ocaml.version "4.03"
|
2021-10-14 00:43:12 +00:00
|
|
|
then throw "${pname} is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
stdenv.mkDerivation {
|
2021-10-14 00:43:12 +00:00
|
|
|
name = "ocaml${ocaml.version}-${pname}-${version}";
|
2020-09-25 04:45:31 +00:00
|
|
|
inherit version;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "${webpage}/releases/${pname}-${version}.tbz";
|
2024-01-13 08:15:51 +00:00
|
|
|
inherit hash;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
|
2022-09-30 11:47:45 +00:00
|
|
|
buildInputs = [ topkg uutf ]
|
|
|
|
++ lib.optional cmdlinerSupport cmdliner;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2022-01-07 04:07:37 +00:00
|
|
|
prePatch = lib.optionalString stdenv.isAarch64 "ulimit -s 16384";
|
|
|
|
|
2022-09-30 11:47:45 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
${topkg.run} build \
|
|
|
|
--with-uutf true \
|
|
|
|
--with-cmdliner ${lib.boolToString cmdlinerSupport}
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
inherit (topkg) installPhase;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "An OCaml module for normalizing Unicode text";
|
|
|
|
homepage = webpage;
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = [ maintainers.vbgl ];
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "unftrip";
|
|
|
|
inherit (ocaml.meta) platforms;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|