lol
1{ lib, stdenv, fetchFromGitHub, python3, pkg-config, SDL2
2, libpng, ffmpeg, freetype, glew, libGL, libGLU, fribidi, zlib
3, makeWrapper
4}:
5
6let
7 # https://renpy.org/doc/html/changelog.html#versioning
8 # base_version is of the form major.minor.patch
9 # vc_version is of the form YYMMDDCC
10 # version corresponds to the tag on GitHub
11 base_version = "8.1.1";
12 vc_version = "23060707";
13in stdenv.mkDerivation rec {
14 pname = "renpy";
15
16 version = "${base_version}.${vc_version}";
17
18 src = fetchFromGitHub {
19 owner = "renpy";
20 repo = "renpy";
21 rev = version;
22 sha256 = "sha256-aJ/MobZ6SNBYRC/EpUxAMLJ3pwK6PC92DV0YL/LF5Ew=";
23 };
24
25 nativeBuildInputs = [
26 pkg-config
27 makeWrapper
28 python3.pkgs.cython
29 python3.pkgs.setuptools
30 ];
31
32 buildInputs = [
33 SDL2 libpng ffmpeg freetype glew libGLU libGL fribidi zlib
34 ] ++ (with python3.pkgs; [
35 python pygame_sdl2 tkinter future six pefile requests ecdsa
36 ]);
37
38 RENPY_DEPS_INSTALL = lib.concatStringsSep "::" (map (path: path) [
39 SDL2 SDL2.dev libpng ffmpeg.lib freetype glew.dev libGLU libGL fribidi zlib
40 ]);
41
42 enableParallelBuilding = true;
43
44 patches = [
45 ./shutup-erofs-errors.patch
46 ];
47
48 postPatch = ''
49 cp tutorial/game/tutorial_director.rpy{m,}
50
51 cat > renpy/vc_version.py << EOF
52 version = '${version}'
53 official = False
54 nightly = False
55 # Look at https://renpy.org/latest.html for what to put.
56 version_name = 'Where No One Has Gone Before'
57 EOF
58 '';
59
60 buildPhase = with python3.pkgs; ''
61 runHook preBuild
62 ${python.pythonOnBuildForHost.interpreter} module/setup.py build --parallel=$NIX_BUILD_CORES
63 runHook postBuild
64 '';
65
66 installPhase = with python3.pkgs; ''
67 runHook preInstall
68
69 ${python.pythonOnBuildForHost.interpreter} module/setup.py install_lib -d $out/${python.sitePackages}
70 mkdir -p $out/share/renpy
71 cp -vr sdk-fonts gui launcher renpy the_question tutorial renpy.py $out/share/renpy
72
73 makeWrapper ${python.interpreter} $out/bin/renpy \
74 --set PYTHONPATH "$PYTHONPATH:$out/${python.sitePackages}" \
75 --add-flags "$out/share/renpy/renpy.py"
76
77 runHook postInstall
78 '';
79
80 env.NIX_CFLAGS_COMPILE = with python3.pkgs; "-I${pygame_sdl2}/include/${python.libPrefix}";
81
82 meta = with lib; {
83 description = "Visual Novel Engine";
84 homepage = "https://renpy.org/";
85 changelog = "https://renpy.org/doc/html/changelog.html";
86 license = licenses.mit;
87 platforms = platforms.linux;
88 maintainers = with maintainers; [ shadowrz ];
89 };
90
91 passthru = { inherit base_version vc_version; };
92}