From 8ef2c4f994f8f294aaab4a89ca30a66331f78961 Mon Sep 17 00:00:00 2001 From: Leah Amelia Chen Date: Mon, 13 May 2024 20:36:02 +0200 Subject: [PATCH 1/4] renpy: unbreak by compiling with Cython 0.x Ren'Py does not like Cython 3.x :( See renpy/renpy#5359. --- pkgs/development/interpreters/renpy/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/interpreters/renpy/default.nix b/pkgs/development/interpreters/renpy/default.nix index 45a3630f7c57..ba4c20e693da 100644 --- a/pkgs/development/interpreters/renpy/default.nix +++ b/pkgs/development/interpreters/renpy/default.nix @@ -25,7 +25,9 @@ in stdenv.mkDerivation rec { nativeBuildInputs = [ pkg-config makeWrapper - python3.pkgs.cython + # Ren'Py currently does not compile on Cython 3.x. + # See https://github.com/renpy/renpy/issues/5359 + python3.pkgs.cython_0 python3.pkgs.setuptools ]; From 20b8d480ee2787e9a4f2608ace8296c905038f34 Mon Sep 17 00:00:00 2001 From: Leah Amelia Chen Date: Mon, 13 May 2024 21:35:50 +0200 Subject: [PATCH 2/4] renpy: 8.1.3 -> 8.2.1 Also switched to `pyproject = true;` for `pythonPackages.pygame-sdl2`, and added a dependency on Harfbuzz for Ren'Py --- .../interpreters/renpy/default.nix | 24 +++++++++---------- .../python-modules/pygame-sdl2/default.nix | 8 +++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pkgs/development/interpreters/renpy/default.nix b/pkgs/development/interpreters/renpy/default.nix index ba4c20e693da..725025fc8cd6 100644 --- a/pkgs/development/interpreters/renpy/default.nix +++ b/pkgs/development/interpreters/renpy/default.nix @@ -1,5 +1,5 @@ { lib, stdenv, fetchFromGitHub, python3, pkg-config, SDL2 -, libpng, ffmpeg, freetype, glew, libGL, libGLU, fribidi, zlib +, libpng, ffmpeg, freetype, glew, libGL, libGLU, fribidi, zlib, harfbuzz , makeWrapper }: @@ -8,18 +8,18 @@ let # 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.1.3"; - vc_version = "23091805"; -in stdenv.mkDerivation rec { - pname = "renpy"; - + base_version = "8.2.1"; + vc_version = "24030407"; version = "${base_version}.${vc_version}"; +in stdenv.mkDerivation { + pname = "renpy"; + inherit version; src = fetchFromGitHub { owner = "renpy"; repo = "renpy"; rev = version; - sha256 = "sha256-bYqnKSWY8EEGr1+12cWeT9/ZSv5OrKLsRqCnnIruDQw="; + hash = "sha256-07Hj8mJGR0+Pn1DQ+sK5YQ3x3CTMsZ5h5yEoz44b2TM="; }; nativeBuildInputs = [ @@ -32,14 +32,14 @@ in stdenv.mkDerivation rec { ]; buildInputs = [ - SDL2 libpng ffmpeg freetype glew libGLU libGL fribidi zlib + SDL2 libpng ffmpeg freetype glew libGLU libGL fribidi zlib harfbuzz ] ++ (with python3.pkgs; [ python pygame-sdl2 tkinter future six pefile requests ecdsa ]); - RENPY_DEPS_INSTALL = lib.concatStringsSep "::" (map (path: path) [ - SDL2 SDL2.dev libpng ffmpeg.lib freetype glew.dev libGLU libGL fribidi zlib - ]); + RENPY_DEPS_INSTALL = lib.concatStringsSep "::" [ + SDL2 SDL2.dev libpng ffmpeg.lib freetype glew.dev libGLU libGL fribidi zlib harfbuzz.dev + ]; enableParallelBuilding = true; @@ -55,7 +55,7 @@ in stdenv.mkDerivation rec { official = False nightly = False # Look at https://renpy.org/latest.html for what to put. - version_name = 'Where No One Has Gone Before' + version_name = '64bit Sensation' EOF ''; diff --git a/pkgs/development/python-modules/pygame-sdl2/default.nix b/pkgs/development/python-modules/pygame-sdl2/default.nix index 0201c9cb4a8a..825b3db76812 100644 --- a/pkgs/development/python-modules/pygame-sdl2/default.nix +++ b/pkgs/development/python-modules/pygame-sdl2/default.nix @@ -1,16 +1,16 @@ { lib, buildPythonPackage, fetchurl, isPy27, renpy -, cython_0, SDL2, SDL2_image, SDL2_ttf, SDL2_mixer, libjpeg, libpng }: +, cython_0, SDL2, SDL2_image, SDL2_ttf, SDL2_mixer, libjpeg, libpng, setuptools }: buildPythonPackage rec { pname = "pygame-sdl2"; version = "2.1.0"; - format = "setuptools"; + pyproject = true; renpy_version = renpy.base_version; name = "${pname}-${version}-${renpy_version}"; src = fetchurl { url = "https://www.renpy.org/dl/${renpy_version}/pygame_sdl2-${version}+renpy${renpy_version}.tar.gz"; - hash = "sha256-mrfrsRAVEqw7fwtYdeATp/8AtMn74x9pJEXwYZPOl2I="; + hash = "sha256-Zib39NyQ1pGVCWPrK5/Tl3dAylUlmKZKxU8pf+OpAdY="; }; # force rebuild of headers needed for install @@ -24,7 +24,7 @@ buildPythonPackage rec { ''; nativeBuildInputs = [ - SDL2.dev cython_0 + SDL2.dev cython_0 setuptools ]; buildInputs = [ From b881e25eb60ee6d2bc856e8ff8a90dffe0c515fc Mon Sep 17 00:00:00 2001 From: Leah Amelia Chen Date: Mon, 13 May 2024 21:46:20 +0200 Subject: [PATCH 3/4] renpy: reformat with nixfmt-rfc-style and migrate to by-name --- .../re/renpy/package.nix} | 79 ++++++++++++++----- .../re}/renpy/shutup-erofs-errors.patch | 0 pkgs/top-level/all-packages.nix | 2 - 3 files changed, 61 insertions(+), 20 deletions(-) rename pkgs/{development/interpreters/renpy/default.nix => by-name/re/renpy/package.nix} (70%) rename pkgs/{development/interpreters => by-name/re}/renpy/shutup-erofs-errors.patch (100%) diff --git a/pkgs/development/interpreters/renpy/default.nix b/pkgs/by-name/re/renpy/package.nix similarity index 70% rename from pkgs/development/interpreters/renpy/default.nix rename to pkgs/by-name/re/renpy/package.nix index 725025fc8cd6..d31ad9ced864 100644 --- a/pkgs/development/interpreters/renpy/default.nix +++ b/pkgs/by-name/re/renpy/package.nix @@ -1,6 +1,20 @@ -{ lib, stdenv, fetchFromGitHub, python3, pkg-config, SDL2 -, libpng, ffmpeg, freetype, glew, libGL, libGLU, fribidi, zlib, harfbuzz -, makeWrapper +{ + lib, + stdenv, + fetchFromGitHub, + python3, + pkg-config, + SDL2, + libpng, + ffmpeg, + freetype, + glew, + libGL, + libGLU, + fribidi, + zlib, + harfbuzz, + makeWrapper, }: let @@ -11,7 +25,8 @@ let base_version = "8.2.1"; vc_version = "24030407"; version = "${base_version}.${vc_version}"; -in stdenv.mkDerivation { +in +stdenv.mkDerivation { pname = "renpy"; inherit version; @@ -31,21 +46,47 @@ in stdenv.mkDerivation { python3.pkgs.setuptools ]; - buildInputs = [ - SDL2 libpng ffmpeg freetype glew libGLU libGL fribidi zlib harfbuzz - ] ++ (with python3.pkgs; [ - python pygame-sdl2 tkinter future six pefile requests ecdsa - ]); + buildInputs = + [ + SDL2 + libpng + ffmpeg + freetype + glew + libGLU + libGL + fribidi + zlib + harfbuzz + ] + ++ (with python3.pkgs; [ + python + pygame-sdl2 + tkinter + future + six + pefile + requests + ecdsa + ]); RENPY_DEPS_INSTALL = lib.concatStringsSep "::" [ - SDL2 SDL2.dev libpng ffmpeg.lib freetype glew.dev libGLU libGL fribidi zlib harfbuzz.dev + SDL2 + SDL2.dev + libpng + ffmpeg.lib + freetype + glew.dev + libGLU + libGL + fribidi + zlib + harfbuzz.dev ]; enableParallelBuilding = true; - patches = [ - ./shutup-erofs-errors.patch - ]; + patches = [ ./shutup-erofs-errors.patch ]; postPatch = '' cp tutorial/game/tutorial_director.rpy{m,} @@ -81,15 +122,17 @@ in stdenv.mkDerivation { env.NIX_CFLAGS_COMPILE = with python3.pkgs; "-I${pygame-sdl2}/include/${python.libPrefix}"; - meta = with lib; { + meta = { description = "Visual Novel Engine"; mainProgram = "renpy"; homepage = "https://renpy.org/"; changelog = "https://renpy.org/doc/html/changelog.html"; - license = licenses.mit; - platforms = platforms.linux; - maintainers = with maintainers; [ shadowrz ]; + license = lib.licenses.mit; + platforms = lib.platforms.linux; + maintainers = with lib.maintainers; [ shadowrz ]; }; - passthru = { inherit base_version vc_version; }; + passthru = { + inherit base_version vc_version; + }; } diff --git a/pkgs/development/interpreters/renpy/shutup-erofs-errors.patch b/pkgs/by-name/re/renpy/shutup-erofs-errors.patch similarity index 100% rename from pkgs/development/interpreters/renpy/shutup-erofs-errors.patch rename to pkgs/by-name/re/renpy/shutup-erofs-errors.patch diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6aab5726b385..eaeea11111b9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12393,8 +12393,6 @@ with pkgs; redsocks = callPackage ../tools/networking/redsocks { }; - renpy = callPackage ../development/interpreters/renpy { }; - rep = callPackage ../development/tools/rep { }; repseek = callPackage ../applications/science/biology/repseek { }; From 3ac42f62c70eb9613f49458c5f3ab0ecdea8a9d8 Mon Sep 17 00:00:00 2001 From: Leah Amelia Chen Date: Mon, 13 May 2024 22:09:21 +0200 Subject: [PATCH 4/4] pygame-sdl2: reformat with nixfmt-rfc-style, modernize --- .../python-modules/pygame-sdl2/default.nix | 53 ++++++++++++------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/pkgs/development/python-modules/pygame-sdl2/default.nix b/pkgs/development/python-modules/pygame-sdl2/default.nix index 825b3db76812..8d8c5dee83a6 100644 --- a/pkgs/development/python-modules/pygame-sdl2/default.nix +++ b/pkgs/development/python-modules/pygame-sdl2/default.nix @@ -1,12 +1,28 @@ -{ lib, buildPythonPackage, fetchurl, isPy27, renpy -, cython_0, SDL2, SDL2_image, SDL2_ttf, SDL2_mixer, libjpeg, libpng, setuptools }: - -buildPythonPackage rec { +{ + lib, + buildPythonPackage, + fetchurl, + isPy27, + renpy, + cython_0, + SDL2, + SDL2_image, + SDL2_ttf, + SDL2_mixer, + libjpeg, + libpng, + setuptools, +}: +let pname = "pygame-sdl2"; version = "2.1.0"; - pyproject = true; renpy_version = renpy.base_version; +in + +buildPythonPackage { + inherit pname version; name = "${pname}-${version}-${renpy_version}"; + pyproject = true; src = fetchurl { url = "https://www.renpy.org/dl/${renpy_version}/pygame_sdl2-${version}+renpy${renpy_version}.tar.gz"; @@ -24,27 +40,26 @@ buildPythonPackage rec { ''; nativeBuildInputs = [ - SDL2.dev cython_0 setuptools + SDL2.dev + cython_0 + setuptools ]; buildInputs = [ - SDL2 SDL2_image SDL2_ttf SDL2_mixer - libjpeg libpng + SDL2 + SDL2_image + SDL2_ttf + SDL2_mixer + libjpeg + libpng ]; - doCheck = isPy27; # python3 tests are non-functional - postInstall = '' - ( cd "$out"/include/python*/ ; - ln -s pygame-sdl2 pygame_sdl2 || true ; ) - ''; - - meta = with lib; { + meta = { description = "A reimplementation of parts of pygame API using SDL2"; - homepage = "https://github.com/renpy/pygame_sdl2"; - # Some parts are also available under Zlib License - license = licenses.lgpl2; - maintainers = with maintainers; [ raskin ]; + homepage = "https://github.com/renpy/pygame_sdl2"; + license = with lib.licenses; [ lgpl2 zlib ]; + maintainers = with lib.maintainers; [ raskin ]; }; }