Skip to content

Commit

Permalink
openctm: fix darwin support (#351642)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksanaa authored Oct 29, 2024
2 parents 023e5c7 + f9081aa commit d0ba2f9
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions pkgs/by-name/op/openctm/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
libglut,
gtk2,
libGLU,
darwin,
}:

stdenv.mkDerivation (finalAttrs: {
Expand All @@ -26,18 +27,30 @@ stdenv.mkDerivation (finalAttrs: {

nativeBuildInputs = [ pkg-config ];

buildInputs = [
libglut
gtk2
libGLU
];
buildInputs =
[
libglut
libGLU
]
++ lib.optionals stdenv.hostPlatform.isLinux [ gtk2 ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ];

postPatch = ''
substituteInPlace tools/tinyxml/Makefile.linux \
--replace-warn "-Wno-format" "-Wno-format -Wno-format-security"
substituteInPlace tools/Makefile.linux \
--replace-warn "-lglut" "-lglut -lGL -lGLU"
'';
postPatch =
lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace "tools/tinyxml/Makefile.linux" \
--replace-warn "-Wno-format" "-Wno-format -Wno-format-security"
substituteInPlace "tools/Makefile.linux" \
--replace-warn "-lglut" "-lglut -lGL -lGLU"
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace "lib/Makefile.macosx" \
"tools/Makefile.macosx" \
"tools/jpeg/makefile.macosx" \
"tools/zlib/Makefile.macosx" \
--replace-warn "gcc" "${stdenv.cc.targetPrefix}cc"
substituteInPlace "lib/Makefile.macosx" "tools/Makefile.macosx" "tools/tinyxml/Makefile.macosx" \
--replace-warn "g++" "${stdenv.cc.targetPrefix}c++"
'';

makeFlags = [
"BINDIR=$(bin)/bin/"
Expand Down

0 comments on commit d0ba2f9

Please sign in to comment.