1{ stdenv, buildPythonPackage, fetchurl, isPy27, fetchpatch 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 = "6.99.14"; 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 sha256 = "1zsnb2bivbwysgxmfg9iv12arhpf3gqkmqinhciz955hlqv016b9"; 13 }; 14 15 # force rebuild of headers needed for install 16 prePatch = '' 17 rm -rf gen gen3 18 ''; 19 20 patches = [ 21 # fix for recent sdl2 22 (fetchpatch { 23 url = "https://github.com/apoleon/pygame_sdl2/commit/ced6051f4a4559a725804cc58c079e1efea0a573.patch"; 24 sha256 = "08rqjzvdlmmdf8kyd8ws5lzjy1mrwnds4fdy38inkyw7saydcxyr"; 25 }) 26 ]; 27 28 buildInputs = [ 29 SDL2 SDL2_image SDL2_ttf SDL2_mixer 30 cython libjpeg libpng 31 ]; 32 33 34 doCheck = isPy27; # python3 tests are non-functional 35 36 postInstall = '' 37 ( cd "$out"/include/python*/ ; 38 ln -s pygame-sdl2 pygame_sdl2 || true ; ) 39 ''; 40 41 meta = with stdenv.lib; { 42 description = "A reimplementation of parts of pygame API using SDL2"; 43 homepage = "https://github.com/renpy/pygame_sdl2"; 44 # Some parts are also available under Zlib License 45 license = licenses.lgpl2; 46 maintainers = with maintainers; [ raskin ]; 47 }; 48}