21cecf6002
GitOrigin-RevId: dd14e5d78e90a2ccd6007e569820de9b4861a6c2
55 lines
1.4 KiB
Nix
55 lines
1.4 KiB
Nix
{ lib, fetchPypi, buildPythonPackage, python, pkg-config, libX11
|
|
, SDL2, SDL2_image, SDL2_mixer, SDL2_ttf, libpng, libjpeg, portmidi, freetype
|
|
, fontconfig
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "pygame";
|
|
version = "2.0.1";
|
|
|
|
src = fetchPypi {
|
|
inherit pname version;
|
|
sha256 = "8b1e7b63f47aafcdd8849933b206778747ef1802bd3d526aca45ed77141e4001";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
pkg-config SDL2
|
|
];
|
|
|
|
buildInputs = [
|
|
SDL2 SDL2_image SDL2_mixer SDL2_ttf libpng libjpeg
|
|
portmidi libX11 freetype
|
|
];
|
|
|
|
preConfigure = ''
|
|
sed \
|
|
-e "s/origincdirs = .*/origincdirs = []/" \
|
|
-e "s/origlibdirs = .*/origlibdirs = []/" \
|
|
-e "/linux-gnu/d" \
|
|
-i buildconfig/config_unix.py
|
|
${lib.concatMapStrings (dep: ''
|
|
sed \
|
|
-e "/origincdirs =/a\ origincdirs += ['${lib.getDev dep}/include']" \
|
|
-e "/origlibdirs =/a\ origlibdirs += ['${lib.getLib dep}/lib']" \
|
|
-i buildconfig/config_unix.py
|
|
'') buildInputs
|
|
}
|
|
LOCALBASE=/ ${python.interpreter} buildconfig/config.py
|
|
'';
|
|
|
|
checkInputs = [ fontconfig ];
|
|
|
|
preCheck = ''
|
|
# No audio or video device in test environment
|
|
export SDL_VIDEODRIVER=dummy
|
|
export SDL_AUDIODRIVER=disk
|
|
export SDL_DISKAUDIOFILE=/dev/null
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Python library for games";
|
|
homepage = "https://www.pygame.org/";
|
|
license = licenses.lgpl21Plus;
|
|
platforms = platforms.linux;
|
|
};
|
|
}
|