2023-04-29 16:46:19 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, ocaml, findlib, libGLU, libGL, freeglut, darwin } :
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
if lib.versionOlder ocaml.version "4.03"
|
2021-12-19 01:06:50 +00:00
|
|
|
then throw "lablgl is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-12-19 01:06:50 +00:00
|
|
|
pname = "ocaml${ocaml.version}-lablgl";
|
|
|
|
version = "1.06";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "garrigue";
|
|
|
|
repo = "lablgl";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "sha256:141kc816iv59z96738i3vn9m9iw9g2zhi45hk4cchpwd99ar5l6k";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
nativeBuildInputs = [ ocaml findlib ];
|
|
|
|
buildInputs = [ freeglut ];
|
2023-04-29 16:46:19 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
libGLU
|
|
|
|
libGL
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
darwin.apple_sdk.frameworks.GLUT
|
|
|
|
darwin.apple_sdk.libs.Xplugin
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
patches = [ ./Makefile.config.patch ./META.patch ];
|
|
|
|
|
|
|
|
preConfigure = ''
|
2021-12-19 01:06:50 +00:00
|
|
|
mkdir -p $out/bin
|
|
|
|
mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs
|
2020-04-24 23:36:52 +00:00
|
|
|
substituteInPlace Makefile.config \
|
2021-12-19 01:06:50 +00: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/ \
|
2020-04-24 23:36:52 +00:00
|
|
|
--subst-var-by TKINCLUDES "" \
|
|
|
|
--subst-var-by XINCLUDES ""
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildFlags = [ "lib" "libopt" "glut" "glutopt" ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
cp ./META $out/lib/ocaml/${ocaml.version}/site-lib/lablgl
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "OpenGL bindings for ocaml";
|
2022-05-18 14:49:53 +00:00
|
|
|
homepage = "http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/lablgl.html";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ pSub vbgl ];
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "lablglut";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|