depot/third_party/nixpkgs/pkgs/development/ocaml-modules/uunf/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

54 lines
1.4 KiB
Nix

{ lib, stdenv, fetchurl, ocaml, findlib, ocamlbuild, topkg, uutf, cmdliner
, cmdlinerSupport ? lib.versionAtLeast cmdliner.version "1.1"
, version ? if lib.versionAtLeast ocaml.version "4.14" then "15.1.0" else "15.0.0"
}:
let
pname = "uunf";
webpage = "https://erratique.ch/software/${pname}";
hash = {
"15.0.0" = "sha256-B/prPAwfqS8ZPS3fyDDIzXWRbKofwOCyCfwvh9veuug=";
"15.1.0" = "sha256-D8yvb7hVWaYxMqMZ5089/5tWDfvyGXKUOjhfU/4zSeQ=";
}."${version}";
in
if lib.versionOlder ocaml.version "4.03"
then throw "${pname} is not available for OCaml ${ocaml.version}"
else
stdenv.mkDerivation {
name = "ocaml${ocaml.version}-${pname}-${version}";
inherit version;
src = fetchurl {
url = "${webpage}/releases/${pname}-${version}.tbz";
inherit hash;
};
nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
buildInputs = [ topkg uutf ]
++ lib.optional cmdlinerSupport cmdliner;
strictDeps = true;
prePatch = lib.optionalString stdenv.isAarch64 "ulimit -s 16384";
buildPhase = ''
runHook preBuild
${topkg.run} build \
--with-uutf true \
--with-cmdliner ${lib.boolToString cmdlinerSupport}
runHook postBuild
'';
inherit (topkg) installPhase;
meta = with lib; {
description = "OCaml module for normalizing Unicode text";
homepage = webpage;
license = licenses.bsd3;
maintainers = [ maintainers.vbgl ];
mainProgram = "unftrip";
inherit (ocaml.meta) platforms;
};
}