1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 03:30:45 +00:00

openctm: fix darwin support (#351642)

This commit is contained in:
Aleksana 2024-10-29 11:12:49 +08:00 committed by GitHub
commit d0ba2f90d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -6,6 +6,7 @@
libglut,
gtk2,
libGLU,
darwin,
}:
stdenv.mkDerivation (finalAttrs: {
@ -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/"