{libGL,libGLU,libglut}: don’t use deprecated stubs on Darwin (#400427)

This commit is contained in:
Emily 2025-04-23 17:03:57 +01:00 committed by GitHub
commit 882f8af3ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 31 additions and 45 deletions

View File

@ -38,11 +38,9 @@ stdenv.mkDerivation (finalAttrs: {
];
cmakeFlags = lib.optionals stdenv.hostPlatform.isDarwin [
"-DOPENGL_INCLUDE_DIR=${libGLX.dev}/include"
"-DOPENGL_gl_LIBRARY:FILEPATH=${libGLX}/lib/libGL.dylib"
"-DOPENGL_glu_LIBRARY:FILEPATH=${libGLU}/lib/libGLU.dylib"
"-DOPENGL_INCLUDE_DIR=${lib.getInclude libGLX}/include"
"-DOPENGL_gl_LIBRARY:FILEPATH=${lib.getLib libGLX}/lib/libGL.dylib"
"-DFREEGLUT_BUILD_DEMOS:BOOL=OFF"
"-DFREEGLUT_BUILD_STATIC:BOOL=OFF"
];
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;

View File

@ -65,20 +65,6 @@ stdenv.mkDerivation (finalAttrs: {
tkinter
]);
RENPY_DEPS_INSTALL = lib.concatStringsSep "::" [
ffmpeg.lib
freetype
fribidi
glew.dev
harfbuzz.dev
libGL
libGLU
libpng
SDL2
(lib.getDev SDL2)
zlib
];
enableParallelBuilding = true;
patches = [

View File

@ -5,7 +5,7 @@
cmake,
fetchFromGitHub,
gtkmm3,
libGL,
libGLX,
libX11,
libXdmcp,
libXext,
@ -91,11 +91,11 @@ stdenv.mkDerivation (finalAttrs: {
"--enable-avx2"
];
postPatch = ''
postPatch = lib.optionalString withGtk ''
substituteInPlace external/glad/src/egl.c \
--replace-fail libEGL.so.1 "${lib.getLib libGL}/lib/libEGL.so.1"
--replace-fail libEGL.so.1 "${lib.getLib libGLX}/lib/libEGL.so.1"
substituteInPlace external/glad/src/glx.c \
--replace-fail libGL.so.1 ${lib.getLib libGL}/lib/libGL.so.1
--replace-fail libGL.so.1 ${lib.getLib libGLX}/lib/libGL.so.1
'';
preConfigure = ''

View File

@ -110,6 +110,7 @@ buildPythonPackage rec {
homepage = "http://www.pyglet.org/";
description = "Cross-platform windowing and multimedia library";
license = licenses.bsd3;
inherit (mesa.meta) platforms;
# The patch needs adjusting for nonLinux platforms.
platforms = platforms.linux;
};
}

View File

@ -29,12 +29,6 @@ stdenv.mkDerivation rec {
hash = "sha256-0o2PQEN0/Z7FUPZEo2HxFFa+mN2bZnYI++HVu4ONpNA=";
};
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "/usr/X11R6/lib/libGL.dylib" "${libGL}/lib/libGL.dylib" \
--replace "/usr/X11R6/lib/libGLU.dylib" "${libGLU}/lib/libGLU.dylib"
'';
nativeBuildInputs = [
cmake
swig

View File

@ -98,7 +98,9 @@ let
attrName: attrValue:
let
pretty = lib.generators.toPretty { };
duplicates = builtins.filter (dep: (builtins.elem (lib.getName dep) filteredDepNames)) attrValue;
duplicates = builtins.filter (
dep: dep != null && builtins.elem (lib.getName dep) filteredDepNames
) attrValue;
in
if duplicates != [ ] then
lib.warn "Duplicate dependencies in ${attrName} of package ${pname}: ${pretty duplicates}"

View File

@ -9636,12 +9636,15 @@ with pkgs;
#
# Android NDK provides an OpenGL implementation, we can just use that.
#
# On macOS, we use the OpenGL framework. Packages that still need GLX
# specifically can pull in libGLX instead. If you have a package that
# should work without X11 but it cant find the library, it may help
# to add the path to `NIX_CFLAGS_COMPILE`:
# On macOS, the SDK provides the OpenGL framework in `stdenv`.
# Packages that still need GLX specifically can pull in `libGLX`
# instead. If you have a package that should work without X11 but it
# cant find the library, it may help to add the path to
# `$NIX_CFLAGS_COMPILE`:
#
# -L${libGL}/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
# preConfigure = ''
# export NIX_CFLAGS_COMPILE+=" -L$SDKROOT/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries"
# '';
#
# If you still cant get it working, please dont hesitate to ping
# @NixOS/darwin-maintainers to ask an expert to take a look.
@ -9649,25 +9652,26 @@ with pkgs;
if stdenv.hostPlatform.useAndroidPrebuilt then
stdenv
else if stdenv.hostPlatform.isDarwin then
darwin.apple_sdk.frameworks.OpenGL
null
else
libglvnd;
# On macOS, we use the OpenGL framework. Packages that use libGLX on
# macOS may need to depend on mesa_glu directly if this doesnt work.
libGLU = if stdenv.hostPlatform.isDarwin then darwin.apple_sdk.frameworks.OpenGL else mesa_glu;
# On macOS, the SDK provides the OpenGL framework in `stdenv`.
# Packages that use `libGLX` on macOS may need to depend on
# `mesa_glu` directly if this doesnt work.
libGLU = if stdenv.hostPlatform.isDarwin then null else mesa_glu;
# libglvnd does not work (yet?) on macOS.
# `libglvnd` does not work (yet?) on macOS.
libGLX = if stdenv.hostPlatform.isDarwin then mesa else libglvnd;
# On macOS, we use the GLUT framework. Packages that use libGLX on
# macOS may need to depend on freeglut directly if this doesnt work.
libglut = if stdenv.hostPlatform.isDarwin then darwin.apple_sdk.frameworks.GLUT else freeglut;
# On macOS, the SDK provides the GLUT framework in `stdenv`. Packages
# that use `libGLX` on macOS may need to depend on `freeglut`
# directly if this doesnt work.
libglut = if stdenv.hostPlatform.isDarwin then null else freeglut;
mesa =
if stdenv.hostPlatform.isDarwin then
callPackage ../development/libraries/mesa/darwin.nix {
}
callPackage ../development/libraries/mesa/darwin.nix { }
else
callPackage ../development/libraries/mesa { };

View File

@ -26609,6 +26609,7 @@ with self;
artistic1
gpl1Plus
]; # taken from EPEL
badPlatforms = lib.platforms.darwin;
};
};