1 { stdenv, lib, fetchFromGitHub, fetchpatch, ocaml, findlib, withStatic ? false }:
3 stdenv.mkDerivation (rec {
5 pname = "ocaml${ocaml.version}-num";
6 src = fetchFromGitHub {
10 sha256 = "0a4mhxgs5hi81d227aygjx35696314swas0vzy3ig809jb7zq4h0";
13 patches = [ (fetchpatch {
14 url = "https://github.com/ocaml/num/commit/6d4c6d476c061298e6385e8a0864f083194b9307.patch";
15 sha256 = "18zlvb5n327q8y3c52js5dvyy29ssld1l53jqng8m9w1k24ypi0b";
17 ] ++ lib.optional withStatic ./enable-static.patch;
19 nativeBuildInputs = [ ocaml findlib ];
23 createFindlibDestdir = true;
26 description = "Legacy Num library for arbitrary-precision integer and rational arithmetic";
27 license = lib.licenses.lgpl21;
28 inherit (ocaml.meta) platforms;
29 inherit (src.meta) homepage;
31 } // (lib.optionalAttrs (lib.versions.majorMinor ocaml.version == "4.06") {
32 env.NIX_CFLAGS_COMPILE = "-fcommon";