1{stdenv, fetchurl, ocaml, lablgtk, findlib, mesa, freeglut, camlp4 } :
2
3let
4 ocaml_version = (builtins.parseDrvName ocaml.name).version;
5 pname = "lablgl";
6 version = "1.05";
7in
8
9stdenv.mkDerivation {
10 name = "${pname}-${version}";
11
12 src = fetchurl {
13 url = "http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/dist/lablgl-${version}.tar.gz";
14 sha256 = "0qabydd219i4ak7hxgc67496qnnscpnydya2m4ijn3cpbgih7zyq";
15 };
16
17 buildInputs = [ocaml findlib lablgtk freeglut camlp4];
18 propagatedBuildInputs = [ mesa ];
19
20 patches = [ ./Makefile.config.patch ./META.patch ];
21
22 preConfigure = ''
23 substituteInPlace Makefile.config \
24 --subst-var-by BINDIR $out/bin \
25 --subst-var-by INSTALLDIR $out/lib/ocaml/${ocaml_version}/site-lib/lablgl \
26 --subst-var-by DLLDIR $out/lib/ocaml/${ocaml_version}/site-lib/lablgl \
27 --subst-var-by TKINCLUDES "" \
28 --subst-var-by XINCLUDES ""
29 '';
30
31 createFindlibDestdir = true;
32
33 buildFlags = "lib libopt glut glutopt";
34
35 postInstall = ''
36 cp ./META $out/lib/ocaml/${ocaml_version}/site-lib/lablgl
37 '';
38
39 meta = with stdenv.lib; {
40 homepage = http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/lablgl.html;
41 description = "OpenGL bindings for ocaml";
42 license = licenses.gpl2;
43 maintainers = with maintainers; [ pSub vbgl ];
44 };
45}