depot/pkgs/development/ocaml-modules/zarith/default.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

43 lines
1.3 KiB
Nix

{ lib, stdenv, fetchFromGitHub
, ocaml, findlib, pkg-config
, gmp
, version ? if lib.versionAtLeast ocaml.version "4.08" then "1.14" else "1.13"
}:
if lib.versionOlder ocaml.version "4.04"
then throw "zarith is not available for OCaml ${ocaml.version}"
else
stdenv.mkDerivation (finalAttrs: {
pname = "ocaml${ocaml.version}-zarith";
inherit version;
src = fetchFromGitHub {
owner = "ocaml";
repo = "Zarith";
rev = "release-${version}";
hash = {
"1.13" = "sha256-CNVKoJeO3fsmWaV/dwnUA8lgI4ZlxR/LKCXpCXUrpSg=";
"1.14" = "sha256-xUrBDr+M8uW2KOy7DZieO/vDgsSOnyBnpOzQDlXJ0oE=";
}."${finalAttrs.version}";
};
nativeBuildInputs = [ pkg-config ocaml findlib ];
propagatedBuildInputs = [ gmp ];
strictDeps = true;
dontAddPrefix = true;
dontAddStaticConfigureFlags = true;
configurePlatforms = [];
configureFlags = [ "-installdir ${placeholder "out"}/lib/ocaml/${ocaml.version}/site-lib" ];
preInstall = "mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs";
meta = with lib; {
description = "Fast, arbitrary precision OCaml integers";
homepage = "https://github.com/ocaml/Zarith";
changelog = "https://github.com/ocaml/Zarith/raw/${finalAttrs.src.rev}/Changes";
license = licenses.lgpl2;
inherit (ocaml.meta) platforms;
maintainers = with maintainers; [ thoughtpolice vbgl ];
};
})