summary refs log tree commit diff
path: root/pkgs/development/interpreters/renpy/default.nix
blob: 0d0cbbab2b5221ab663ec0ed0bfb2e96de9dcf50 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ stdenv, fetchurl, pythonPackages, pkgconfig, SDL2
, libpng, ffmpeg, freetype, glew, mesa, fribidi, zlib
, glib
}:

with pythonPackages;

stdenv.mkDerivation {
  name = "renpy-6.99.12.4";

  meta = {
    description = "Ren'Py Visual Novel Engine";
    homepage = "http://renpy.org/";
    license = stdenv.lib.licenses.mit;
    platforms = stdenv.lib.platforms.linux;
    # This is an ancient version, last updated in 2014 (3d59f42ce); it fails to
    # build with the most recent pygame version, and fails to run with 1.9.1.
    broken = true;
  };

  src = fetchurl {
    url = "http://www.renpy.org/dl/6.99.12.4/renpy-6.99.12.4-source.tar.bz2";
    sha256 = "035342rr39zp7krp08z0xhcl73gqbqyilshgmljq0ynfrxxckn35";
  };

  buildInputs = [
    python cython pkgconfig wrapPython
    SDL2 libpng ffmpeg freetype glew mesa fribidi zlib pygame_sdl2 glib
  ];

  pythonPath = [ pygame_sdl2 ];

  RENPY_DEPS_INSTALL = stdenv.lib.concatStringsSep "::" (map (path: "${path}") [
    SDL2 SDL2.dev libpng ffmpeg ffmpeg.out freetype glew.dev glew.out mesa fribidi zlib
  ]);

  buildPhase = ''
    python module/setup.py build
  '';

  installPhase = ''
    mkdir -p $out/share/renpy
    cp -r renpy renpy.py $out/share/renpy
    python module/setup.py install --prefix=$out --install-lib=$out/share/renpy/module

    makeWrapper ${python}/bin/python $out/bin/renpy \
      --set PYTHONPATH $PYTHONPATH \
      --set RENPY_BASE $out/share/renpy \
      --add-flags "-O $out/share/renpy/renpy.py"
  '';

  NIX_CFLAGS_COMPILE = "-I${pygame_sdl2}/include/${python.libPrefix}";
}