2023-11-03 08:50:25 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, ocaml, findlib, libGLU, libGL, freeglut, camlp-streams, darwin } :
|
2013-06-04 20:49:10 +02:00
|
|
|
|
2023-11-03 08:50:25 +01:00
|
|
|
if lib.versionOlder ocaml.version "4.06"
|
2021-11-30 17:46:07 +01:00
|
|
|
then throw "lablgl is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
2013-06-04 20:49:10 +02:00
|
|
|
|
2016-10-05 09:32:30 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2021-11-30 17:46:07 +01:00
|
|
|
pname = "ocaml${ocaml.version}-lablgl";
|
2023-11-03 08:50:25 +01:00
|
|
|
version = "1.07";
|
2021-11-30 17:46:07 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "garrigue";
|
|
|
|
repo = "lablgl";
|
|
|
|
rev = "v${version}";
|
2023-11-03 08:50:25 +01:00
|
|
|
hash = "sha256-GiQKHMn5zHyvDrA2ve12X5YTm3/RZp8tukIqifgVaW4=";
|
2013-06-04 20:49:10 +02:00
|
|
|
};
|
|
|
|
|
2022-03-01 16:42:22 +01:00
|
|
|
strictDeps = true;
|
|
|
|
|
2022-02-22 10:59:04 +01:00
|
|
|
nativeBuildInputs = [ ocaml findlib ];
|
2023-11-03 08:50:25 +01:00
|
|
|
buildInputs = [ freeglut camlp-streams ];
|
2023-04-19 10:55:41 +02:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
libGLU
|
|
|
|
libGL
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
darwin.apple_sdk.frameworks.GLUT
|
|
|
|
darwin.apple_sdk.libs.Xplugin
|
|
|
|
];
|
2013-06-04 20:49:10 +02:00
|
|
|
|
2014-10-04 00:19:32 +02:00
|
|
|
patches = [ ./Makefile.config.patch ./META.patch ];
|
2013-06-04 20:49:10 +02:00
|
|
|
|
|
|
|
preConfigure = ''
|
2021-11-30 17:46:07 +01:00
|
|
|
mkdir -p $out/bin
|
|
|
|
mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs
|
2013-06-04 20:49:10 +02:00
|
|
|
substituteInPlace Makefile.config \
|
2021-11-30 17:46:07 +01:00
|
|
|
--subst-var-by BINDIR $out/bin/ \
|
|
|
|
--subst-var-by INSTALLDIR $out/lib/ocaml/${ocaml.version}/site-lib/lablgl/ \
|
|
|
|
--subst-var-by DLLDIR $out/lib/ocaml/${ocaml.version}/site-lib/stublibs/ \
|
2013-06-04 20:49:10 +02:00
|
|
|
--subst-var-by TKINCLUDES "" \
|
|
|
|
--subst-var-by XINCLUDES ""
|
|
|
|
'';
|
|
|
|
|
2019-10-27 14:03:25 +01:00
|
|
|
buildFlags = [ "lib" "libopt" "glut" "glutopt" ];
|
2013-06-04 20:49:10 +02:00
|
|
|
|
|
|
|
postInstall = ''
|
2016-10-05 09:32:30 +02:00
|
|
|
cp ./META $out/lib/ocaml/${ocaml.version}/site-lib/lablgl
|
2013-06-04 20:49:10 +02:00
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2013-06-04 20:49:10 +02:00
|
|
|
description = "OpenGL bindings for ocaml";
|
2022-05-14 01:48:49 +02:00
|
|
|
homepage = "http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/lablgl.html";
|
2014-10-04 00:19:32 +02:00
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ pSub vbgl ];
|
2022-05-14 01:48:49 +02:00
|
|
|
mainProgram = "lablglut";
|
2013-06-04 20:49:10 +02:00
|
|
|
};
|
|
|
|
}
|