1{ lib, stdenv, fetchFromGitHub, ocaml, findlib, libGLU, libglut, camlp-streams } :
2
3if lib.versionOlder ocaml.version "4.06"
4then throw "lablgl is not available for OCaml ${ocaml.version}"
5else
6
7stdenv.mkDerivation rec {
8 pname = "ocaml${ocaml.version}-lablgl";
9 version = "1.07";
10
11 src = fetchFromGitHub {
12 owner = "garrigue";
13 repo = "lablgl";
14 rev = "v${version}";
15 hash = "sha256-GiQKHMn5zHyvDrA2ve12X5YTm3/RZp8tukIqifgVaW4=";
16 };
17
18 strictDeps = true;
19
20 nativeBuildInputs = [ ocaml findlib ];
21 buildInputs = [ libglut camlp-streams ];
22 propagatedBuildInputs = [
23 libGLU
24 ];
25
26 patches = [ ./META.patch ];
27
28 preConfigure = ''
29 mkdir -p $out/bin
30 mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs
31 cp \
32 Makefile.config.${if stdenv.hostPlatform.isDarwin then "osx" else "ex"} \
33 Makefile.config
34 '';
35
36 makeFlags = [
37 "BINDIR=${placeholder "out"}/bin/"
38 "INSTALLDIR=${placeholder "out"}/lib/ocaml/${ocaml.version}/site-lib/lablgl/"
39 "DLLDIR=${placeholder "out"}/lib/ocaml/${ocaml.version}/site-lib/stublibs/"
40 "XINCLUDES="
41 "TKINCLUDES="
42 "TKLIBS="
43 ];
44
45 buildFlags = [ "lib" "libopt" "glut" "glutopt" ];
46
47 postInstall = ''
48 cp ./META $out/lib/ocaml/${ocaml.version}/site-lib/lablgl
49 '';
50
51 meta = with lib; {
52 description = "OpenGL bindings for ocaml";
53 homepage = "http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/lablgl.html";
54 license = licenses.gpl2;
55 maintainers = with maintainers; [ pSub vbgl ];
56 mainProgram = "lablglut";
57 };
58}