1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 fetchpatch,
6 ocaml,
7 findlib,
8 withStatic ? false,
9}:
10
11stdenv.mkDerivation (
12 rec {
13 version = "1.1";
14 pname = "ocaml${ocaml.version}-num";
15 src = fetchFromGitHub {
16 owner = "ocaml";
17 repo = "num";
18 rev = "v${version}";
19 sha256 = "0a4mhxgs5hi81d227aygjx35696314swas0vzy3ig809jb7zq4h0";
20 };
21
22 patches = [
23 (fetchpatch {
24 url = "https://github.com/ocaml/num/commit/6d4c6d476c061298e6385e8a0864f083194b9307.patch";
25 sha256 = "18zlvb5n327q8y3c52js5dvyy29ssld1l53jqng8m9w1k24ypi0b";
26 })
27 ]
28 ++ lib.optional withStatic ./enable-static.patch;
29
30 nativeBuildInputs = [
31 ocaml
32 findlib
33 ];
34
35 strictDeps = true;
36
37 createFindlibDestdir = true;
38
39 meta = {
40 description = "Legacy Num library for arbitrary-precision integer and rational arithmetic";
41 license = lib.licenses.lgpl21;
42 inherit (ocaml.meta) platforms;
43 inherit (src.meta) homepage;
44 };
45 }
46 // (lib.optionalAttrs (lib.versions.majorMinor ocaml.version == "4.06") {
47 env.NIX_CFLAGS_COMPILE = "-fcommon";
48 })
49)