1{ lib, buildPythonPackage, fetchurl, isPy27, renpy
2, cython, SDL2, SDL2_image, SDL2_ttf, SDL2_mixer, libjpeg, libpng }:
3
4buildPythonPackage rec {
5 pname = "pygame_sdl2";
6 version = "2.1.0";
7 renpy_version = renpy.base_version;
8 name = "${pname}-${version}-${renpy_version}";
9
10 src = fetchurl {
11 url = "https://www.renpy.org/dl/${renpy_version}/pygame_sdl2-${version}-for-renpy-${renpy_version}.tar.gz";
12 hash = "sha256-u9DIFKd+uyphH3ETMJWYqt7YFyeIgBWoXUO3rC+RWjc=";
13 };
14
15 # force rebuild of headers needed for install
16 prePatch = ''
17 rm -rf gen gen3
18 '';
19
20 # Remove build tag which produces invaild version
21 postPatch = ''
22 sed -i '2d' setup.cfg
23 '';
24
25 nativeBuildInputs = [
26 SDL2.dev cython
27 ];
28
29 buildInputs = [
30 SDL2 SDL2_image SDL2_ttf SDL2_mixer
31 libjpeg libpng
32 ];
33
34
35 doCheck = isPy27; # python3 tests are non-functional
36
37 postInstall = ''
38 ( cd "$out"/include/python*/ ;
39 ln -s pygame-sdl2 pygame_sdl2 || true ; )
40 '';
41
42 meta = with lib; {
43 description = "A reimplementation of parts of pygame API using SDL2";
44 homepage = "https://github.com/renpy/pygame_sdl2";
45 # Some parts are also available under Zlib License
46 license = licenses.lgpl2;
47 maintainers = with maintainers; [ raskin ];
48 };
49}