nixpkgs/pkgs/development/ocaml-modules/vg/default.nix

60 lines
1.8 KiB
Nix
Raw Normal View History

2017-12-14 07:36:29 +00:00
{ stdenv, lib, fetchurl, ocaml, findlib, ocamlbuild, topkg
, uchar, result, gg, uutf, otfm
, js_of_ocaml, js_of_ocaml-ocamlbuild, 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
2016-12-04 10:20:46 +00:00
inherit (stdenv.lib) optionals versionAtLeast;
2014-10-29 20:15:50 +00:00
pname = "vg";
2018-10-25 05:35:55 +00:00
version = "0.9.1";
2014-10-29 20:15:50 +00:00
webpage = "http://erratique.ch/software/${pname}";
in
2016-12-04 10:20:46 +00:00
assert versionAtLeast ocaml.version "4.02.0";
2014-10-29 20:15:50 +00:00
stdenv.mkDerivation rec {
name = "ocaml${ocaml.version}-${pname}-${version}";
2014-10-29 20:15:50 +00:00
src = fetchurl {
url = "${webpage}/releases/${pname}-${version}.tbz";
2018-10-25 05:35:55 +00:00
sha256 = "07h9a464v0x066mjg3ldkaq94ah47b7rvh54z4rndrg7v6bk7kyp";
2014-10-29 20:15:50 +00:00
};
2017-12-14 07:36:29 +00:00
buildInputs = [ ocaml findlib ocamlbuild 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 ]
++ optionals htmlcBackend [ js_of_ocaml js_of_ocaml-ocamlbuild js_of_ocaml-ppx ];
2014-10-29 20:15:50 +00:00
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.
'';
homepage = "${webpage}";
2018-10-25 05:35:55 +00:00
inherit (ocaml.meta) platforms;
license = licenses.isc;
2014-10-29 20:15:50 +00:00
maintainers = [ maintainers.jirkamarsik ];
};
}