nixpkgs-suyu/pkgs/development/python-modules/pygame/default.nix
Dmitry Olyenyov 4e6676f27d pygame: preConfigure fix
Upstream moved build scripts to buildconfig folder and added some checks
for SDL locations. This breaks `sed` expression that was replacing library
paths. Fixes #60893
2019-05-04 08:29:10 +02:00

49 lines
1.3 KiB
Nix

{ lib, fetchPypi, buildPythonPackage, python, pkg-config, libX11
, SDL, SDL_image, SDL_mixer, SDL_ttf, libpng, libjpeg, portmidi, freetype
}:
buildPythonPackage rec {
pname = "pygame";
version = "1.9.5";
src = fetchPypi {
inherit pname version;
sha256 = "d15e7238015095a12c19379565a66285e989fdcb3807ec360b27338cd8bdaf05";
};
nativeBuildInputs = [
pkg-config SDL
];
buildInputs = [
SDL SDL_image SDL_mixer SDL_ttf libpng libjpeg
portmidi libX11 freetype
];
# Tests fail because of no audio device and display.
doCheck = false;
preConfigure = ''
sed \
-e "s/origincdirs = .*/origincdirs = []/" \
-e "s/origlibdirs = .*/origlibdirs = []/" \
-e "/'\/lib\/i386-linux-gnu', '\/lib\/x86_64-linux-gnu']/d" \
-e "/\/include\/smpeg/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
'';
meta = with lib; {
description = "Python library for games";
homepage = http://www.pygame.org/;
license = licenses.lgpl21Plus;
platforms = platforms.linux;
};
}