1{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam }:
2
3let
4 inherit (stdenv.lib) getVersion versionAtLeast;
5
6 pname = "gg";
7 version = "0.9.1";
8 webpage = "http://erratique.ch/software/${pname}";
9in
10
11assert versionAtLeast (getVersion ocaml) "4.01.0";
12
13stdenv.mkDerivation rec {
14
15 name = "ocaml-${pname}-${version}";
16
17 src = fetchurl {
18 url = "${webpage}/releases/${pname}-${version}.tbz";
19 sha256 = "0czj41sr8jsivl3z8wyblf9k971j3kx2wc3s0c1nhzcc8allg9i2";
20 };
21
22 buildInputs = [ ocaml findlib ocamlbuild opam ];
23
24 createFindlibDestdir = true;
25
26 unpackCmd = "tar xjf $src";
27
28 buildPhase = "ocaml pkg/build.ml native=true native-dynlink=true";
29
30 installPhase = ''
31 opam-installer --script --prefix=$out ${pname}.install | sh
32 ln -s $out/lib/${pname} $out/lib/ocaml/${getVersion ocaml}/site-lib/${pname}
33 '';
34
35 meta = with stdenv.lib; {
36 description = "Basic types for computer graphics in OCaml";
37 longDescription = ''
38 Gg is an OCaml module providing basic types for computer graphics. It
39 defines types and functions for floats, vectors, points, sizes,
40 matrices, quaternions, axis aligned boxes, colors, color spaces, and
41 raster data.
42 '';
43 homepage = "${webpage}";
44 platforms = ocaml.meta.platforms or [];
45 license = licenses.bsd3;
46 maintainers = [ maintainers.jirkamarsik ];
47 };
48}