2017-12-14 07:36:29 +00:00
|
|
|
{ stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, topkg
|
2017-08-27 14:44:39 +00:00
|
|
|
, uchar, result, gg, uutf, otfm
|
2020-06-05 20:51:43 +00:00
|
|
|
, js_of_ocaml, js_of_ocaml-ppx,
|
2014-10-29 20:15:50 +00:00
|
|
|
pdfBackend ? true, # depends on uutf and otfm
|
|
|
|
htmlcBackend ? true # depends on js_of_ocaml
|
|
|
|
}:
|
|
|
|
|
2017-04-11 16:08:51 +00:00
|
|
|
with lib;
|
|
|
|
|
2014-10-29 20:15:50 +00:00
|
|
|
let
|
2022-04-25 20:35:24 +00:00
|
|
|
inherit (lib) optionals versionOlder;
|
2014-10-29 20:15:50 +00:00
|
|
|
|
|
|
|
pname = "vg";
|
2020-06-05 20:51:43 +00:00
|
|
|
version = "0.9.4";
|
2019-04-22 08:14:28 +00:00
|
|
|
webpage = "https://erratique.ch/software/${pname}";
|
2014-10-29 20:15:50 +00:00
|
|
|
in
|
|
|
|
|
2022-04-25 20:35:24 +00:00
|
|
|
if versionOlder ocaml.version "4.03"
|
2019-08-23 05:48:33 +00:00
|
|
|
then throw "vg is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
2014-10-29 20:15:50 +00:00
|
|
|
|
2019-08-13 21:52:01 +00:00
|
|
|
stdenv.mkDerivation {
|
2014-10-29 20:15:50 +00:00
|
|
|
|
2017-02-02 20:15:34 +00:00
|
|
|
name = "ocaml${ocaml.version}-${pname}-${version}";
|
2014-10-29 20:15:50 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "${webpage}/releases/${pname}-${version}.tbz";
|
2020-06-05 20:51:43 +00:00
|
|
|
sha256 = "181sz6l5xrj5jvwg4m2yqsjzwp2s5h8v0mwhjcwbam90kdfx2nak";
|
2014-10-29 20:15:50 +00:00
|
|
|
};
|
|
|
|
|
2022-02-22 09:59:04 +00:00
|
|
|
nativeBuildInputs = [ ocaml findlib ocamlbuild ];
|
|
|
|
buildInputs = [ topkg ];
|
2014-10-29 20:15:50 +00:00
|
|
|
|
2016-12-04 10:20:46 +00:00
|
|
|
propagatedBuildInputs = [ uchar result gg ]
|
2014-10-29 20:15:50 +00:00
|
|
|
++ optionals pdfBackend [ uutf otfm ]
|
2020-06-05 20:51:43 +00:00
|
|
|
++ optionals htmlcBackend [ js_of_ocaml js_of_ocaml-ppx ];
|
2014-10-29 20:15:50 +00:00
|
|
|
|
2022-02-22 09:59:04 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2016-12-04 10:20:46 +00:00
|
|
|
buildPhase = topkg.buildPhase
|
2017-04-11 16:08:51 +00:00
|
|
|
+ " --with-uutf ${boolToString pdfBackend}"
|
|
|
|
+ " --with-otfm ${boolToString pdfBackend}"
|
|
|
|
+ " --with-js_of_ocaml ${boolToString htmlcBackend}"
|
|
|
|
+ " --with-cairo2 false";
|
2014-10-29 20:15:50 +00:00
|
|
|
|
2016-12-04 10:20:46 +00:00
|
|
|
inherit (topkg) installPhase;
|
2014-10-29 20:15:50 +00:00
|
|
|
|
2017-04-11 16:08:51 +00:00
|
|
|
meta = {
|
2014-10-29 20:15:50 +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.
|
|
|
|
'';
|
2019-09-08 23:38:31 +00:00
|
|
|
homepage = webpage;
|
2018-10-25 05:35:55 +00:00
|
|
|
license = licenses.isc;
|
2014-10-29 20:15:50 +00:00
|
|
|
maintainers = [ maintainers.jirkamarsik ];
|
2022-05-13 23:48:49 +00:00
|
|
|
mainProgram = "vecho";
|
|
|
|
inherit (ocaml.meta) platforms;
|
2014-10-29 20:15:50 +00:00
|
|
|
};
|
|
|
|
}
|