Skip to content

Commit

Permalink
ocamlPackages.lablgl: simplify build and fix Darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
emilazy committed Jun 22, 2024
1 parent 5cb1bab commit fd276f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 79 deletions.
67 changes: 0 additions & 67 deletions pkgs/development/ocaml-modules/lablgl/Makefile.config.patch

This file was deleted.

26 changes: 14 additions & 12 deletions pkgs/development/ocaml-modules/lablgl/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, ocaml, findlib, libGLU, libGL, libglut, camlp-streams, darwin } :
{ lib, stdenv, fetchFromGitHub, ocaml, findlib, libGLU, libglut, camlp-streams } :

if lib.versionOlder ocaml.version "4.06"
then throw "lablgl is not available for OCaml ${ocaml.version}"
Expand All @@ -21,25 +21,27 @@ stdenv.mkDerivation rec {
buildInputs = [ libglut camlp-streams ];
propagatedBuildInputs = [
libGLU
libGL
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.GLUT
darwin.apple_sdk.libs.Xplugin
];

patches = [ ./Makefile.config.patch ./META.patch ];
patches = [ ./META.patch ];

preConfigure = ''
mkdir -p $out/bin
mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs
substituteInPlace Makefile.config \
--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/ \
--subst-var-by TKINCLUDES "" \
--subst-var-by XINCLUDES ""
cp \
Makefile.config.${if stdenv.hostPlatform.isDarwin then "osx" else "ex"} \
Makefile.config
'';

makeFlags = [
"BINDIR=${placeholder "out"}/bin/"
"INSTALLDIR=${placeholder "out"}/lib/ocaml/${ocaml.version}/site-lib/lablgl/"
"DLLDIR=${placeholder "out"}/lib/ocaml/${ocaml.version}/site-lib/stublibs/"
"XINCLUDES="
"TKINCLUDES="
"TKLIBS="
];

buildFlags = [ "lib" "libopt" "glut" "glutopt" ];

postInstall = ''
Expand Down

0 comments on commit fd276f7

Please sign in to comment.