Merge pull request #236059 from wegank/pyopengl-darwin

python310Packages.pyopengl: unbreak on darwin
This commit is contained in:
Weijia Wang 2023-06-05 14:12:03 +03:00 committed by GitHub
commit be32c59e86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,17 +18,14 @@ buildPythonPackage rec {
propagatedBuildInputs = [ pillow ];
patchPhase = let
ext = stdenv.hostPlatform.extensions.sharedLibrary; in ''
ext = stdenv.hostPlatform.extensions.sharedLibrary; in lib.optionalString (!stdenv.isDarwin) ''
# Theses lines are patching the name of dynamic libraries
# so pyopengl can find them at runtime.
substituteInPlace OpenGL/platform/glx.py \
--replace "'GL'" "'${pkgs.libGL}/lib/libGL${ext}'" \
--replace "'GLU'" "'${pkgs.libGLU}/lib/libGLU${ext}'" \
--replace "'glut'" "'${pkgs.freeglut}/lib/libglut${ext}'"
substituteInPlace OpenGL/platform/darwin.py \
--replace "'OpenGL'" "'${pkgs.libGL}/lib/libGL${ext}'" \
--replace "'GLUT'" "'${pkgs.freeglut}/lib/libglut${ext}'"
'' + ''
# https://github.com/NixOS/nixpkgs/issues/76822
# pyopengl introduced a new "robust" way of loading libraries in 3.1.4.
# The later patch of the filepath does not work anymore because