summary refs log tree commit diff
path: root/pkgs/development/python-modules/pygame/default.nix
blob: 93fa70e44bcffc624e28c86776d14ae7e18a1192 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{ stdenv, fetchurl, python, pkgconfig
, SDL, SDL_image, SDL_mixer, SDL_ttf, libpng, libjpeg
}:

stdenv.mkDerivation {
  name = "pygame-1.9.1";

  src = fetchurl {
    url = "http://www.pygame.org/ftp/pygame-1.9.1release.tar.gz";
    sha256 = "0cyl0ww4fjlf289pjxa53q4klyn55ajvkgymw0qrdgp4593raq52";
  };

  buildInputs = [
    python pkgconfig SDL SDL_image SDL_mixer SDL_ttf libpng libjpeg
  ];

  patches = [ ./pygame-v4l.patch ];

  configurePhase = ''
    for i in ${SDL_image} ${SDL_mixer} ${SDL_ttf} ${libpng} ${libjpeg}; do
      sed -e "/origincdirs =/a'$i/include'," -i config_unix.py
      sed -e "/origlibdirs =/aoriglibdirs += '$i/lib'," -i config_unix.py
    done

    yes Y | LOCALBASE=/ python config.py
  '';

  buildPhase = "python setup.py build"; 

  installPhase = "python setup.py install --prefix=$out";

  meta = {
    description = "Python library for games";
    homepage = "http://www.pygame.org/";
    license = stdenv.lib.licenses.lgpl21Plus;
  };
}