1{
2 lib,
3 buildPythonPackage,
4 fetchurl,
5 isPy27,
6 renpy,
7 cython_0,
8 SDL2,
9 SDL2_image,
10 SDL2_ttf,
11 SDL2_mixer,
12 libjpeg,
13 libpng,
14 setuptools,
15}:
16let
17 pname = "pygame-sdl2";
18 version = "2.1.0";
19 renpy_version = renpy.base_version;
20in
21
22buildPythonPackage {
23 inherit pname version;
24 name = "${pname}-${version}-${renpy_version}";
25 pyproject = true;
26
27 src = fetchurl {
28 url = "https://www.renpy.org/dl/${renpy_version}/pygame_sdl2-${version}+renpy${renpy_version}.tar.gz";
29 hash = "sha256-Zib39NyQ1pGVCWPrK5/Tl3dAylUlmKZKxU8pf+OpAdY=";
30 };
31
32 # force rebuild of headers needed for install
33 prePatch = ''
34 rm -rf gen gen3
35 '';
36
37 # Remove build tag which produces invaild version
38 postPatch = ''
39 sed -i '2d' setup.cfg
40 '';
41
42 nativeBuildInputs = [
43 SDL2.dev
44 cython_0
45 setuptools
46 ];
47
48 buildInputs = [
49 SDL2
50 SDL2_image
51 SDL2_ttf
52 SDL2_mixer
53 libjpeg
54 libpng
55 ];
56
57 doCheck = isPy27; # python3 tests are non-functional
58
59 meta = {
60 description = "A reimplementation of parts of pygame API using SDL2";
61 homepage = "https://github.com/renpy/pygame_sdl2";
62 license = with lib.licenses; [
63 lgpl2
64 zlib
65 ];
66 maintainers = with lib.maintainers; [ raskin ];
67 };
68}