2020-04-24 23:36:52 +00:00
|
|
|
{ stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, topkg
|
|
|
|
, uchar, result, gg, uutf, otfm
|
2020-06-18 07:06:33 +00:00
|
|
|
, js_of_ocaml, js_of_ocaml-ppx,
|
2020-04-24 23:36:52 +00:00
|
|
|
pdfBackend ? true, # depends on uutf and otfm
|
|
|
|
htmlcBackend ? true # depends on js_of_ocaml
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2022-04-27 09:35:20 +00:00
|
|
|
inherit (lib) optionals versionOlder;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
pname = "vg";
|
2020-06-18 07:06:33 +00:00
|
|
|
version = "0.9.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
webpage = "https://erratique.ch/software/${pname}";
|
|
|
|
in
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
if versionOlder ocaml.version "4.03"
|
2020-04-24 23:36:52 +00:00
|
|
|
then throw "vg is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
|
|
|
|
name = "ocaml${ocaml.version}-${pname}-${version}";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "${webpage}/releases/${pname}-${version}.tbz";
|
2020-06-18 07:06:33 +00:00
|
|
|
sha256 = "181sz6l5xrj5jvwg4m2yqsjzwp2s5h8v0mwhjcwbam90kdfx2nak";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
|
|
|
|
buildInputs = [ topkg ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [ uchar result gg ]
|
|
|
|
++ optionals pdfBackend [ uutf otfm ]
|
2020-06-18 07:06:33 +00:00
|
|
|
++ optionals htmlcBackend [ js_of_ocaml js_of_ocaml-ppx ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPhase = topkg.buildPhase
|
2023-02-02 18:25:31 +00:00
|
|
|
+ " --with-uutf ${lib.boolToString pdfBackend}"
|
|
|
|
+ " --with-otfm ${lib.boolToString pdfBackend}"
|
|
|
|
+ " --with-js_of_ocaml ${lib.boolToString htmlcBackend}"
|
2020-04-24 23:36:52 +00:00
|
|
|
+ " --with-cairo2 false";
|
|
|
|
|
|
|
|
inherit (topkg) installPhase;
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Declarative 2D vector graphics for OCaml";
|
|
|
|
longDescription = ''
|
|
|
|
Vg is an OCaml module for declarative 2D vector graphics. In Vg, images
|
|
|
|
are values that denote functions mapping points of the cartesian plane
|
|
|
|
to colors. The module provides combinators to define and compose these
|
|
|
|
values.
|
|
|
|
|
|
|
|
Renderers for PDF, SVG and the HTML canvas are distributed with the
|
|
|
|
module. An API allows to implement new renderers.
|
|
|
|
'';
|
|
|
|
homepage = webpage;
|
|
|
|
license = licenses.isc;
|
|
|
|
maintainers = [ maintainers.jirkamarsik ];
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "vecho";
|
|
|
|
inherit (ocaml.meta) platforms;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|