forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / development / ocaml-modules / lablgl / default.nix
blob64ace7c44963738d0c2de287ef129ce8841632b8
1 { lib, stdenv, fetchFromGitHub, ocaml, findlib, libGLU, libglut, camlp-streams } :
3 if lib.versionOlder ocaml.version "4.06"
4 then throw "lablgl is not available for OCaml ${ocaml.version}"
5 else
7 stdenv.mkDerivation rec {
8   pname = "ocaml${ocaml.version}-lablgl";
9   version = "1.07";
11   src = fetchFromGitHub {
12     owner = "garrigue";
13     repo = "lablgl";
14     rev = "v${version}";
15     hash = "sha256-GiQKHMn5zHyvDrA2ve12X5YTm3/RZp8tukIqifgVaW4=";
16   };
18   strictDeps = true;
20   nativeBuildInputs = [ ocaml findlib ];
21   buildInputs = [ libglut camlp-streams ];
22   propagatedBuildInputs = [
23     libGLU
24   ];
26   patches = [ ./META.patch ];
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   '';
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   ];
45   buildFlags = [ "lib" "libopt" "glut" "glutopt" ];
47   postInstall = ''
48     cp ./META $out/lib/ocaml/${ocaml.version}/site-lib/lablgl
49   '';
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   };