Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 2.0 kB view raw
1{ lib, stdenv 2, buildPythonPackage 3, fetchPypi 4, pkgs 5, pillow 6}: 7 8buildPythonPackage rec { 9 pname = "pyopengl"; 10 version = "3.1.6"; 11 12 src = fetchPypi { 13 pname = "PyOpenGL"; 14 inherit version; 15 hash = "sha256-jqbIdzkn7adAW//G9buTvoFWmnsFyMrFDNlOlp3OXic="; 16 }; 17 18 propagatedBuildInputs = [ pillow ]; 19 20 patchPhase = let 21 ext = stdenv.hostPlatform.extensions.sharedLibrary; in lib.optionalString (!stdenv.isDarwin) '' 22 # Theses lines are patching the name of dynamic libraries 23 # so pyopengl can find them at runtime. 24 substituteInPlace OpenGL/platform/glx.py \ 25 --replace "'GL'" "'${pkgs.libGL}/lib/libGL${ext}'" \ 26 --replace "'GLU'" "'${pkgs.libGLU}/lib/libGLU${ext}'" \ 27 --replace "'glut'" "'${pkgs.freeglut}/lib/libglut${ext}'" 28 '' + '' 29 # https://github.com/NixOS/nixpkgs/issues/76822 30 # pyopengl introduced a new "robust" way of loading libraries in 3.1.4. 31 # The later patch of the filepath does not work anymore because 32 # pyopengl takes the "name" (for us: the path) and tries to add a 33 # few suffix during its loading phase. 34 # The following patch put back the "name" (i.e. the path) in the 35 # list of possible files. 36 substituteInPlace OpenGL/platform/ctypesloader.py \ 37 --replace "filenames_to_try = []" "filenames_to_try = [name]" 38 ''; 39 40 # Need to fix test runner 41 # Tests have many dependencies 42 # Extension types could not be found. 43 # Should run test suite from $out/${python.sitePackages} 44 doCheck = false; 45 46 meta = with lib; { 47 homepage = "https://pyopengl.sourceforge.net/"; 48 description = "PyOpenGL, the Python OpenGL bindings"; 49 longDescription = '' 50 PyOpenGL is the cross platform Python binding to OpenGL and 51 related APIs. The binding is created using the standard (in 52 Python 2.5) ctypes library, and is provided under an extremely 53 liberal BSD-style Open-Source license. 54 ''; 55 license = "BSD-style"; 56 platforms = platforms.mesaPlatforms; 57 }; 58 59 60}