nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, fetchFromGitHub, ocaml, findlib, libGLU, libGL, freeglut, darwin } :
2
3if lib.versionOlder ocaml.version "4.03"
4then throw "lablgl is not available for OCaml ${ocaml.version}"
5else
6
7stdenv.mkDerivation rec {
8 pname = "ocaml${ocaml.version}-lablgl";
9 version = "1.06";
10
11 src = fetchFromGitHub {
12 owner = "garrigue";
13 repo = "lablgl";
14 rev = "v${version}";
15 sha256 = "sha256:141kc816iv59z96738i3vn9m9iw9g2zhi45hk4cchpwd99ar5l6k";
16 };
17
18 strictDeps = true;
19
20 nativeBuildInputs = [ ocaml findlib ];
21 buildInputs = [ freeglut ];
22 propagatedBuildInputs = [
23 libGLU
24 libGL
25 ] ++ lib.optionals stdenv.isDarwin [
26 darwin.apple_sdk.frameworks.GLUT
27 darwin.apple_sdk.libs.Xplugin
28 ];
29
30 patches = [ ./Makefile.config.patch ./META.patch ];
31
32 preConfigure = ''
33 mkdir -p $out/bin
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 ""
41 '';
42
43 buildFlags = [ "lib" "libopt" "glut" "glutopt" ];
44
45 postInstall = ''
46 cp ./META $out/lib/ocaml/${ocaml.version}/site-lib/lablgl
47 '';
48
49 meta = with lib; {
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";
55 };
56}