1 { stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, topkg
2 , uchar, result, gg, uutf, otfm
3 , js_of_ocaml, js_of_ocaml-ppx,
4 pdfBackend ? true, # depends on uutf and otfm
5 htmlcBackend ? true # depends on js_of_ocaml
9 inherit (lib) optionals versionOlder;
13 webpage = "https://erratique.ch/software/${pname}";
16 if versionOlder ocaml.version "4.03"
17 then throw "vg is not available for OCaml ${ocaml.version}"
22 name = "ocaml${ocaml.version}-${pname}-${version}";
25 url = "${webpage}/releases/${pname}-${version}.tbz";
26 sha256 = "181sz6l5xrj5jvwg4m2yqsjzwp2s5h8v0mwhjcwbam90kdfx2nak";
29 nativeBuildInputs = [ ocaml findlib ocamlbuild ];
30 buildInputs = [ topkg ];
32 propagatedBuildInputs = [ uchar result gg ]
33 ++ optionals pdfBackend [ uutf otfm ]
34 ++ optionals htmlcBackend [ js_of_ocaml js_of_ocaml-ppx ];
38 buildPhase = topkg.buildPhase
39 + " --with-uutf ${lib.boolToString pdfBackend}"
40 + " --with-otfm ${lib.boolToString pdfBackend}"
41 + " --with-js_of_ocaml ${lib.boolToString htmlcBackend}"
42 + " --with-cairo2 false";
44 inherit (topkg) installPhase;
47 description = "Declarative 2D vector graphics for OCaml";
49 Vg is an OCaml module for declarative 2D vector graphics. In Vg, images
50 are values that denote functions mapping points of the cartesian plane
51 to colors. The module provides combinators to define and compose these
54 Renderers for PDF, SVG and the HTML canvas are distributed with the
55 module. An API allows to implement new renderers.
58 license = licenses.isc;
59 maintainers = [ maintainers.jirkamarsik ];
60 mainProgram = "vecho";
61 inherit (ocaml.meta) platforms;