python312Packages.pyftgl: fix build on darwin; fix source; refactor and modenize (#354973)

This commit is contained in:
Emily 2024-11-10 14:30:04 +00:00 committed by GitHub
commit d40ed47baa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,7 @@
buildPythonPackage,
fetchFromGitHub,
stdenv,
setuptools,
boost,
freetype,
ftgl,
@ -12,29 +13,30 @@
}:
let
pythonVersion = with lib.versions; "${major python.version}${minor python.version}";
in
buildPythonPackage rec {
pname = "pyftgl";
version = "0.4b";
format = "setuptools";
pyproject = true;
src = fetchFromGitHub {
owner = "umlaeute";
repo = "${pname}-${version}";
rev = version;
sha256 = "12zcjv4cwwjihiaf74kslrdmmk4bs47h7006gyqfwdfchfjdgg4r";
repo = "pyftgl";
rev = "refs/tags/${version}";
sha256 = "sha256-mbzXpIPMNe6wfwaAAw/Ri8xaW6Z6kuNUhFFyzsiW7Is=";
};
postPatch = ''
sed -i "s,'boost_python','boost_python${pythonVersion}',g" setup.py
'';
build-system = [ setuptools ];
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
NIX_CFLAGS_COMPILE = "-L${libGL}/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries";
};
postPatch =
''
substituteInPlace setup.py \
--replace-fail boost_python boost_python${pythonVersion}
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
export NIX_CFLAGS_COMPILE+=" -L$SDKROOT/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries"
'';
buildInputs = [
boost
@ -44,8 +46,8 @@ buildPythonPackage rec {
libGL
];
meta = with lib; {
meta = {
description = "Python bindings for FTGL (FreeType for OpenGL)";
license = licenses.gpl2Plus;
license = lib.licenses.gpl2Plus;
};
}