1{ stdenv, fetchurl, ocaml, findlib, jbuilder }:
2
3assert stdenv.lib.versionAtLeast (stdenv.lib.getVersion ocaml) "4.01";
4
5stdenv.mkDerivation rec {
6 pname = "dtoa";
7 name = "ocaml-${pname}-${version}";
8 version = "0.3.1";
9
10 src = fetchurl {
11 url = "https://github.com/flowtype/ocaml-${pname}/releases/download/v${version}/${pname}-${version}.tbz";
12 sha256 = "0rzysj07z2q6gk0yhjxnjnba01vmdb9x32wwna10qk3rrb8r2pnn";
13 };
14
15 unpackCmd = "tar xjf $src";
16
17 buildInputs = [ ocaml findlib jbuilder ];
18
19 buildPhase = "jbuilder build -p dtoa";
20
21 inherit (jbuilder) installPhase;
22
23 hardeningDisable = stdenv.lib.optional stdenv.isDarwin "strictoverflow";
24
25 meta = with stdenv.lib; {
26 homepage = https://github.com/flowtype/ocaml-dtoa;
27 description = "Converts OCaml floats into strings (doubles to ascii, \"d to a\"), using the efficient Grisu3 algorithm.";
28 license = licenses.mit;
29 platforms = ocaml.meta.platforms or [];
30 maintainers = [ maintainers.eqyiel ];
31 };
32}