renpy: modernize derivation

This commit is contained in:
KSJ2000 2025-01-31 18:20:00 +02:00
parent 33c07e7725
commit e100269019

View File

@ -1,89 +1,84 @@
{ {
lib,
stdenv,
fetchFromGitHub, fetchFromGitHub,
fetchpatch,
python311,
pkg-config,
SDL2,
libpng,
ffmpeg, ffmpeg,
freetype, freetype,
fribidi,
glew, glew,
harfbuzz,
lib,
libGL, libGL,
libGLU, libGLU,
fribidi, libpng,
zlib,
harfbuzz,
makeWrapper, makeWrapper,
nix-update-script,
pkg-config,
python311,
SDL2,
stdenv,
versionCheckHook,
withoutSteam ? true, withoutSteam ? true,
zlib,
}: }:
let let
# https://renpy.org/doc/html/changelog.html#versioning python = python311;
# base_version is of the form major.minor.patch
# vc_version is of the form YYMMDDCC
# version corresponds to the tag on GitHub
base_version = "8.3.4";
vc_version = "24120703";
version = "${base_version}.${vc_version}";
in in
stdenv.mkDerivation { stdenv.mkDerivation (finalAttrs: {
pname = "renpy"; pname = "renpy";
inherit version; version = "8.3.4.24120703";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "renpy"; owner = "renpy";
repo = "renpy"; repo = "renpy";
rev = version; tag = finalAttrs.version;
hash = "sha256-GM6cx9yP5bgKWMSYOkZS9hE33/HJnsv4KmlB23jbkqg="; hash = "sha256-9f1ptw+6OQ2rMytwPZPtUd+K/ihnVKHUiELs22iTTqE=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
pkg-config
makeWrapper makeWrapper
pkg-config
# Ren'Py currently does not compile on Cython 3.x. # Ren'Py currently does not compile on Cython 3.x.
# See https://github.com/renpy/renpy/issues/5359 # See https://github.com/renpy/renpy/issues/5359
python311.pkgs.cython_0 python.pkgs.cython_0
python311.pkgs.setuptools python.pkgs.setuptools
]; ];
buildInputs = buildInputs =
[ [
SDL2
libpng
ffmpeg ffmpeg
freetype freetype
glew
libGLU
libGL
fribidi fribidi
zlib glew
harfbuzz harfbuzz
libGL
libGLU
libpng
SDL2
zlib
] ]
++ (with python311.pkgs; [ ++ (with python.pkgs; [
python
pygame-sdl2
tkinter
future
six
pefile
requests
ecdsa ecdsa
future
pefile
pygame-sdl2
python
requests
six
tkinter
]); ]);
RENPY_DEPS_INSTALL = lib.concatStringsSep "::" [ RENPY_DEPS_INSTALL = lib.concatStringsSep "::" [
SDL2
SDL2.dev
libpng
ffmpeg.lib ffmpeg.lib
freetype freetype
glew.dev
libGLU
libGL
fribidi fribidi
zlib glew.dev
harfbuzz.dev harfbuzz.dev
libGL
libGLU
libpng
SDL2
SDL2.dev
zlib
]; ];
enableParallelBuilding = true; enableParallelBuilding = true;
@ -97,7 +92,7 @@ stdenv.mkDerivation {
cp tutorial/game/tutorial_director.rpy{m,} cp tutorial/game/tutorial_director.rpy{m,}
cat > renpy/vc_version.py << EOF cat > renpy/vc_version.py << EOF
version = '${version}' version = '${finalAttrs.version}'
official = False official = False
nightly = False nightly = False
# Look at https://renpy.org/latest.html for what to put. # Look at https://renpy.org/latest.html for what to put.
@ -105,13 +100,13 @@ stdenv.mkDerivation {
EOF EOF
''; '';
buildPhase = with python311.pkgs; '' buildPhase = ''
runHook preBuild runHook preBuild
${python.pythonOnBuildForHost.interpreter} module/setup.py build --parallel=$NIX_BUILD_CORES ${python.pythonOnBuildForHost.interpreter} module/setup.py build --parallel=$NIX_BUILD_CORES
runHook postBuild runHook postBuild
''; '';
installPhase = with python311.pkgs; '' installPhase = ''
runHook preInstall runHook preInstall
${python.pythonOnBuildForHost.interpreter} module/setup.py install_lib -d $out/${python.sitePackages} ${python.pythonOnBuildForHost.interpreter} module/setup.py install_lib -d $out/${python.sitePackages}
@ -125,7 +120,13 @@ stdenv.mkDerivation {
runHook postInstall runHook postInstall
''; '';
env.NIX_CFLAGS_COMPILE = with python311.pkgs; "-I${pygame-sdl2}/include/${python.libPrefix}"; env.NIX_CFLAGS_COMPILE = "-I${python.pkgs.pygame-sdl2}/include/${python.libPrefix}";
nativeInstallCheckInputs = [ versionCheckHook ];
doInstallCheck = true;
versionCheckProgramArg = "--version";
passthru.updateScript = nix-update-script { };
meta = { meta = {
description = "Visual Novel Engine"; description = "Visual Novel Engine";
@ -133,9 +134,7 @@ stdenv.mkDerivation {
homepage = "https://renpy.org/"; homepage = "https://renpy.org/";
changelog = "https://renpy.org/doc/html/changelog.html"; changelog = "https://renpy.org/doc/html/changelog.html";
license = lib.licenses.mit; license = lib.licenses.mit;
platforms = lib.platforms.linux; platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ shadowrz ]; maintainers = with lib.maintainers; [ shadowrz ];
}; };
})
passthru = { inherit base_version vc_version; };
}