2021-03-04 21:03:28 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
|
|
|
, ocaml, findlib, pkg-config
|
2019-01-15 03:50:15 +00:00
|
|
|
, gmp
|
2024-07-12 04:58:39 +00:00
|
|
|
, version ? if lib.versionAtLeast ocaml.version "4.08" then "1.14" else "1.13"
|
2019-01-15 03:50:15 +00:00
|
|
|
}:
|
2014-05-01 07:26:35 +00:00
|
|
|
|
2022-04-25 20:35:24 +00:00
|
|
|
if lib.versionOlder ocaml.version "4.04"
|
2021-03-04 21:03:28 +00:00
|
|
|
then throw "zarith is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
2016-10-13 19:12:46 +00:00
|
|
|
|
2024-07-12 04:58:39 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2021-03-04 21:03:28 +00:00
|
|
|
pname = "ocaml${ocaml.version}-zarith";
|
2024-07-12 04:58:39 +00:00
|
|
|
inherit version;
|
2021-03-04 21:03:28 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ocaml";
|
|
|
|
repo = "Zarith";
|
|
|
|
rev = "release-${version}";
|
2024-07-12 04:58:39 +00:00
|
|
|
hash = {
|
|
|
|
"1.13" = "sha256-CNVKoJeO3fsmWaV/dwnUA8lgI4ZlxR/LKCXpCXUrpSg=";
|
|
|
|
"1.14" = "sha256-xUrBDr+M8uW2KOy7DZieO/vDgsSOnyBnpOzQDlXJ0oE=";
|
|
|
|
}."${finalAttrs.version}";
|
2021-03-04 21:03:28 +00:00
|
|
|
};
|
2014-05-01 07:26:35 +00:00
|
|
|
|
2021-08-14 12:00:00 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ocaml findlib ];
|
2014-11-07 09:50:39 +00:00
|
|
|
propagatedBuildInputs = [ gmp ];
|
2021-08-14 12:00:00 +00:00
|
|
|
strictDeps = true;
|
2014-05-01 07:26:35 +00:00
|
|
|
|
2019-10-31 10:26:23 +00:00
|
|
|
dontAddPrefix = true;
|
2021-08-14 12:00:00 +00:00
|
|
|
dontAddStaticConfigureFlags = true;
|
|
|
|
configurePlatforms = [];
|
2019-10-31 10:26:23 +00:00
|
|
|
configureFlags = [ "-installdir ${placeholder "out"}/lib/ocaml/${ocaml.version}/site-lib" ];
|
2019-08-08 15:35:52 +00:00
|
|
|
|
|
|
|
preInstall = "mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs";
|
2014-05-01 07:26:35 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2016-06-20 10:53:46 +00:00
|
|
|
description = "Fast, arbitrary precision OCaml integers";
|
2023-07-22 04:20:00 +00:00
|
|
|
homepage = "https://github.com/ocaml/Zarith";
|
2024-07-12 04:58:39 +00:00
|
|
|
changelog = "https://github.com/ocaml/Zarith/raw/${finalAttrs.src.rev}/Changes";
|
2014-10-10 13:43:58 +00:00
|
|
|
license = licenses.lgpl2;
|
2019-08-08 15:35:52 +00:00
|
|
|
inherit (ocaml.meta) platforms;
|
2014-10-10 13:43:58 +00:00
|
|
|
maintainers = with maintainers; [ thoughtpolice vbgl ];
|
2014-05-01 07:26:35 +00:00
|
|
|
};
|
2024-07-12 04:58:39 +00:00
|
|
|
})
|