2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv
|
2018-10-26 16:23:47 +01:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, pkgs
|
|
|
|
, pillow
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pyopengl";
|
2019-12-10 18:07:41 +00:00
|
|
|
version = "3.1.4";
|
2018-10-26 16:23:47 +01:00
|
|
|
|
|
|
|
src = fetchPypi {
|
2019-12-15 15:20:04 +00:00
|
|
|
pname = "PyOpenGL";
|
|
|
|
inherit version;
|
2019-12-10 18:07:41 +00:00
|
|
|
sha256 = "0bdf5ed600df30c8830455702338902528717c0af85ac5914f1dc5aa0bfa6eee";
|
2018-10-26 16:23:47 +01:00
|
|
|
};
|
|
|
|
|
2020-04-20 03:23:29 +01:00
|
|
|
propagatedBuildInputs = [ pillow ];
|
2018-10-26 16:23:47 +01:00
|
|
|
|
|
|
|
patchPhase = let
|
|
|
|
ext = stdenv.hostPlatform.extensions.sharedLibrary; in ''
|
2020-02-03 10:52:40 +00:00
|
|
|
# Theses lines are patching the name of dynamic libraries
|
|
|
|
# so pyopengl can find them at runtime.
|
2018-10-26 16:23:47 +01:00
|
|
|
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}'"
|
2020-02-03 10:52:40 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
# pyopengl takes the "name" (for us: the path) and tries to add a
|
|
|
|
# few suffix during its loading phase.
|
|
|
|
# The following patch put back the "name" (i.e. the path) in the
|
|
|
|
# list of possible files.
|
|
|
|
substituteInPlace OpenGL/platform/ctypesloader.py \
|
|
|
|
--replace "filenames_to_try = []" "filenames_to_try = [name]"
|
2018-10-26 16:23:47 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
# Need to fix test runner
|
|
|
|
# Tests have many dependencies
|
|
|
|
# Extension types could not be found.
|
|
|
|
# Should run test suite from $out/${python.sitePackages}
|
|
|
|
doCheck = false;
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://pyopengl.sourceforge.net/";
|
2018-10-26 16:23:47 +01:00
|
|
|
description = "PyOpenGL, the Python OpenGL bindings";
|
|
|
|
longDescription = ''
|
|
|
|
PyOpenGL is the cross platform Python binding to OpenGL and
|
|
|
|
related APIs. The binding is created using the standard (in
|
|
|
|
Python 2.5) ctypes library, and is provided under an extremely
|
|
|
|
liberal BSD-style Open-Source license.
|
|
|
|
'';
|
|
|
|
license = "BSD-style";
|
|
|
|
platforms = platforms.mesaPlatforms;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|