2019-11-20 11:32:19 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, fetchpatch, ocaml, findlib, withStatic ? false }:
|
2017-11-03 23:45:18 +00:00
|
|
|
|
2022-08-03 20:24:37 +00:00
|
|
|
stdenv.mkDerivation (rec {
|
2021-01-21 00:24:35 +00:00
|
|
|
version = "1.1";
|
2022-02-06 22:35:27 +00:00
|
|
|
pname = "ocaml${ocaml.version}-num";
|
2021-01-21 00:24:35 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ocaml";
|
|
|
|
repo = "num";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0a4mhxgs5hi81d227aygjx35696314swas0vzy3ig809jb7zq4h0";
|
|
|
|
};
|
2017-11-03 23:45:18 +00:00
|
|
|
|
2021-01-21 00:24:35 +00:00
|
|
|
patches = [ (fetchpatch {
|
|
|
|
url = "https://github.com/ocaml/num/commit/6d4c6d476c061298e6385e8a0864f083194b9307.patch";
|
|
|
|
sha256 = "18zlvb5n327q8y3c52js5dvyy29ssld1l53jqng8m9w1k24ypi0b";
|
|
|
|
})
|
|
|
|
] ++ lib.optional withStatic ./enable-static.patch;
|
2017-11-03 23:45:18 +00:00
|
|
|
|
2021-01-21 00:24:35 +00:00
|
|
|
nativeBuildInputs = [ ocaml findlib ];
|
2017-11-03 23:45:18 +00:00
|
|
|
|
2022-02-22 09:59:04 +00:00
|
|
|
strictDeps = true;
|
2017-11-03 23:45:18 +00:00
|
|
|
|
2022-02-22 09:59:04 +00:00
|
|
|
createFindlibDestdir = true;
|
2019-11-14 20:28:51 +00:00
|
|
|
|
2021-01-21 00:24:35 +00:00
|
|
|
meta = {
|
|
|
|
description = "Legacy Num library for arbitrary-precision integer and rational arithmetic";
|
|
|
|
license = lib.licenses.lgpl21;
|
|
|
|
inherit (ocaml.meta) platforms;
|
|
|
|
inherit (src.meta) homepage;
|
|
|
|
};
|
2023-06-25 10:25:42 +00:00
|
|
|
} // (lib.optionalAttrs (lib.versions.majorMinor ocaml.version == "4.06") {
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-fcommon";
|
2023-06-25 10:25:42 +00:00
|
|
|
})
|
2022-08-03 20:24:37 +00:00
|
|
|
)
|