2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
lib,
|
|
|
|
substituteAll,
|
|
|
|
fetchPypi,
|
|
|
|
buildPythonPackage,
|
|
|
|
SDL2,
|
|
|
|
SDL2_ttf,
|
|
|
|
SDL2_image,
|
|
|
|
SDL2_gfx,
|
|
|
|
SDL2_mixer,
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2024-04-21 15:54:59 +00:00
|
|
|
pname = "pysdl2";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "0.9.16";
|
2022-10-06 18:32:54 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# The tests use OpenGL using find_library, which would have to be
|
|
|
|
# patched; also they seem to actually open X windows and test stuff
|
|
|
|
# like "screensaver disabling", which would have to be cleverly
|
|
|
|
# sandboxed. Disable for now.
|
|
|
|
doCheck = false;
|
2022-10-06 18:32:54 +00:00
|
|
|
pythonImportsCheck = [ "sdl2" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
2024-04-21 15:54:59 +00:00
|
|
|
pname = "PySDL2";
|
|
|
|
inherit version;
|
2024-02-07 01:22:34 +00:00
|
|
|
hash = "sha256-ECdAa62+zdMP5W6AClp2rX1ycaOuwLes94DuJqAPLUA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Deliberately not in propagated build inputs; users can decide
|
|
|
|
# which library they want to include.
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs = [
|
|
|
|
SDL2_ttf
|
|
|
|
SDL2_image
|
|
|
|
SDL2_gfx
|
|
|
|
SDL2_mixer
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [ SDL2 ];
|
2020-09-25 04:45:31 +00:00
|
|
|
patches = [
|
2024-06-05 15:53:02 +00:00
|
|
|
(substituteAll (
|
|
|
|
{
|
|
|
|
src = ./PySDL2-dll.patch;
|
|
|
|
}
|
|
|
|
//
|
|
|
|
builtins.mapAttrs
|
|
|
|
(_: pkg: "${pkg}/lib/lib${pkg.pname}${stdenv.hostPlatform.extensions.sharedLibrary}")
|
|
|
|
{
|
|
|
|
# substituteAll keys must start lowercase
|
|
|
|
sdl2 = SDL2;
|
|
|
|
sdl2_ttf = SDL2_ttf;
|
|
|
|
sdl2_image = SDL2_image;
|
|
|
|
sdl2_gfx = SDL2_gfx;
|
|
|
|
sdl2_mixer = SDL2_mixer;
|
|
|
|
}
|
|
|
|
))
|
2020-09-25 04:45:31 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Wrapper around the SDL2 library and as such similar to the discontinued PySDL project";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/marcusva/py-sdl2";
|
|
|
|
license = lib.licenses.publicDomain;
|
|
|
|
maintainers = with lib.maintainers; [ pmiddend ];
|
|
|
|
};
|
|
|
|
}
|