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

61 lines
1.8 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg
2016-12-04 11:20:46 +01:00
, uchar, result, gg, uutf, otfm, js_of_ocaml,
2014-10-29 21:15:50 +01:00
pdfBackend ? true, # depends on uutf and otfm
htmlcBackend ? true # depends on js_of_ocaml
}:
let
2016-12-04 11:20:46 +01:00
inherit (stdenv.lib) optionals versionAtLeast;
2014-10-29 21:15:50 +01:00
pname = "vg";
2016-12-04 11:20:46 +01:00
version = "0.9.0";
2014-10-29 21:15:50 +01:00
webpage = "http://erratique.ch/software/${pname}";
2016-12-04 11:20:46 +01:00
sob = b: if b then "true" else "false";
2014-10-29 21:15:50 +01:00
in
2016-12-04 11:20:46 +01:00
assert versionAtLeast ocaml.version "4.02.0";
2014-10-29 21:15:50 +01:00
stdenv.mkDerivation rec {
name = "ocaml${ocaml.version}-${pname}-${version}";
2014-10-29 21:15:50 +01:00
src = fetchurl {
url = "${webpage}/releases/${pname}-${version}.tbz";
2016-12-04 11:20:46 +01:00
sha256 = "1czd2fq85hy24w5pllarsq4pvbx9rda5zdikxfxdng8s9kff2h3f";
2014-10-29 21:15:50 +01:00
};
buildInputs = [ ocaml findlib ocamlbuild opam topkg ];
2014-10-29 21:15:50 +01:00
2016-12-04 11:20:46 +01:00
propagatedBuildInputs = [ uchar result gg ]
2014-10-29 21:15:50 +01:00
++ optionals pdfBackend [ uutf otfm ]
++ optionals htmlcBackend [ js_of_ocaml ];
createFindlibDestdir = true;
unpackCmd = "tar xjf $src";
2016-12-04 11:20:46 +01:00
buildPhase = topkg.buildPhase
+ " --with-uutf ${sob pdfBackend} --with-otfm ${sob pdfBackend}"
+ " --with-js_of_ocaml ${sob htmlcBackend}"
+ " --with-cairo2 false";
2014-10-29 21:15:50 +01:00
2016-12-04 11:20:46 +01:00
inherit (topkg) installPhase;
2014-10-29 21:15:50 +01:00
meta = with stdenv.lib; {
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}";
platforms = ocaml.meta.platforms or [];
2014-10-29 21:15:50 +01:00
license = licenses.bsd3;
maintainers = [ maintainers.jirkamarsik ];
};
}