1 { lib, stdenv, fetchFromGitHub, ocaml, findlib, libGLU, libGL, freeglut, camlp-streams, darwin } :
3 if lib.versionOlder ocaml.version "4.06"
4 then throw "lablgl is not available for OCaml ${ocaml.version}"
7 stdenv.mkDerivation rec {
8 pname = "ocaml${ocaml.version}-lablgl";
11 src = fetchFromGitHub {
15 hash = "sha256-GiQKHMn5zHyvDrA2ve12X5YTm3/RZp8tukIqifgVaW4=";
20 nativeBuildInputs = [ ocaml findlib ];
21 buildInputs = [ freeglut camlp-streams ];
22 propagatedBuildInputs = [
25 ] ++ lib.optionals stdenv.isDarwin [
26 darwin.apple_sdk.frameworks.GLUT
27 darwin.apple_sdk.libs.Xplugin
30 patches = [ ./Makefile.config.patch ./META.patch ];
34 mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs
35 substituteInPlace Makefile.config \
36 --subst-var-by BINDIR $out/bin/ \
37 --subst-var-by INSTALLDIR $out/lib/ocaml/${ocaml.version}/site-lib/lablgl/ \
38 --subst-var-by DLLDIR $out/lib/ocaml/${ocaml.version}/site-lib/stublibs/ \
39 --subst-var-by TKINCLUDES "" \
40 --subst-var-by XINCLUDES ""
43 buildFlags = [ "lib" "libopt" "glut" "glutopt" ];
46 cp ./META $out/lib/ocaml/${ocaml.version}/site-lib/lablgl
50 description = "OpenGL bindings for ocaml";
51 homepage = "http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/lablgl.html";
52 license = licenses.gpl2;
53 maintainers = with maintainers; [ pSub vbgl ];
54 mainProgram = "lablglut";