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