From e98c99a4f505845ec766c6cd2983f3e884efa9b9 Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Sun, 20 Apr 2025 15:30:32 +0200 Subject: [PATCH 1/5] pygame-ce: unbreak --- .../python-modules/pygame-ce/default.nix | 8 +++--- .../pygame-ce/skip-surface-tests.patch | 26 ------------------- 2 files changed, 3 insertions(+), 31 deletions(-) delete mode 100644 pkgs/development/python-modules/pygame-ce/skip-surface-tests.patch diff --git a/pkgs/development/python-modules/pygame-ce/default.nix b/pkgs/development/python-modules/pygame-ce/default.nix index 649c72c0be2ae..fb3b91d55d42c 100644 --- a/pkgs/development/python-modules/pygame-ce/default.nix +++ b/pkgs/development/python-modules/pygame-ce/default.nix @@ -19,7 +19,7 @@ libpng, libX11, portmidi, - SDL2, + SDL2_classic, SDL2_image, SDL2_mixer, SDL2_ttf, @@ -60,8 +60,6 @@ buildPythonPackage rec { ]) buildInputs ); }) - # Skip tests that should be disabled without video driver - ./skip-surface-tests.patch ]; postPatch = @@ -101,7 +99,7 @@ buildPythonPackage rec { libjpeg libpng portmidi - SDL2 + SDL2_classic SDL2_image SDL2_mixer SDL2_ttf @@ -117,7 +115,7 @@ buildPythonPackage rec { env = { - SDL_CONFIG = lib.getExe' (lib.getDev SDL2) "sdl2-config"; + SDL_CONFIG = lib.getExe' (lib.getDev SDL2_classic) "sdl2-config"; } // lib.optionalAttrs stdenv.cc.isClang { NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-function-pointer-types"; diff --git a/pkgs/development/python-modules/pygame-ce/skip-surface-tests.patch b/pkgs/development/python-modules/pygame-ce/skip-surface-tests.patch deleted file mode 100644 index 21d9c9060f3b8..0000000000000 --- a/pkgs/development/python-modules/pygame-ce/skip-surface-tests.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/test/surface_test.py b/test/surface_test.py -index 5ce78b6e..8b8f7ed5 100644 ---- a/test/surface_test.py -+++ b/test/surface_test.py -@@ -1091,6 +1091,10 @@ class GeneralSurfaceTests(unittest.TestCase): - finally: - pygame.display.quit() - -+ @unittest.skipIf( -+ os.environ.get("SDL_VIDEODRIVER") == "dummy", -+ 'requires a non-"dummy" SDL_VIDEODRIVER', -+ ) - def test_convert_init(self): - """Ensure initialization exceptions are raised - for surf.convert().""" -@@ -1118,6 +1122,10 @@ class GeneralSurfaceTests(unittest.TestCase): - finally: - pygame.display.quit() - -+ @unittest.skipIf( -+ os.environ.get("SDL_VIDEODRIVER") == "dummy", -+ 'requires a non-"dummy" SDL_VIDEODRIVER', -+ ) - def test_convert_alpha_init(self): - """Ensure initialization exceptions are raised - for surf.convert_alpha().""" From 3e2fd0eb8a0342d1b3587d0dc7a40ae6662a8a1f Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Thu, 17 Apr 2025 21:27:12 +0200 Subject: [PATCH 2/5] SDL2_image: add option to build without STB backend --- pkgs/by-name/sd/SDL2_image/package.nix | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/pkgs/by-name/sd/SDL2_image/package.nix b/pkgs/by-name/sd/SDL2_image/package.nix index 2672f76d3f8b6..ba907e6a93d5e 100644 --- a/pkgs/by-name/sd/SDL2_image/package.nix +++ b/pkgs/by-name/sd/SDL2_image/package.nix @@ -14,6 +14,7 @@ stdenv, zlib, # Boolean flags + enableSTB ? true, ## Darwin headless will hang when trying to run the SDL test program enableSdltest ? (!stdenv.hostPlatform.isDarwin), }: @@ -36,16 +37,20 @@ stdenv.mkDerivation (finalAttrs: { pkg-config ]; - buildInputs = [ - SDL2 - giflib - libXpm - libjpeg - libpng - libtiff - libwebp - zlib - ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ Foundation ]; + buildInputs = + [ + SDL2 + giflib + libXpm + libtiff + libwebp + zlib + ] + ++ lib.optionals (!enableSTB) [ + libjpeg + libpng + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ Foundation ]; configureFlags = [ @@ -54,6 +59,7 @@ stdenv.mkDerivation (finalAttrs: { (lib.enableFeature false "png-shared") (lib.enableFeature false "tif-shared") (lib.enableFeature false "webp-shared") + (lib.enableFeature enableSTB "stb-image") (lib.enableFeature enableSdltest "sdltest") ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ From 1435e1ed87dafaac0a9fc832d03caf272a47eb7a Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Thu, 17 Apr 2025 21:27:12 +0200 Subject: [PATCH 3/5] pygame{,-ce}: use latest version of SDL2_image --- pkgs/development/python-modules/pygame-ce/default.nix | 2 +- pkgs/development/python-modules/pygame/default.nix | 2 +- pkgs/top-level/python-packages.nix | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/pygame-ce/default.nix b/pkgs/development/python-modules/pygame-ce/default.nix index fb3b91d55d42c..3f0c7e30b98cd 100644 --- a/pkgs/development/python-modules/pygame-ce/default.nix +++ b/pkgs/development/python-modules/pygame-ce/default.nix @@ -100,7 +100,7 @@ buildPythonPackage rec { libpng portmidi SDL2_classic - SDL2_image + (SDL2_image.override { enableSTB = false; }) SDL2_mixer SDL2_ttf ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ AppKit ]; diff --git a/pkgs/development/python-modules/pygame/default.nix b/pkgs/development/python-modules/pygame/default.nix index f549bffc1d3b1..bb595909e5c90 100644 --- a/pkgs/development/python-modules/pygame/default.nix +++ b/pkgs/development/python-modules/pygame/default.nix @@ -87,7 +87,7 @@ buildPythonPackage rec { libX11 portmidi SDL2_classic - SDL2_image + (SDL2_image.override { enableSTB = false; }) SDL2_mixer SDL2_ttf ]; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6ab1d23a3b941..04431477502c4 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -12263,11 +12263,10 @@ self: super: with self; { pygal = callPackage ../development/python-modules/pygal { }; - pygame = callPackage ../development/python-modules/pygame { SDL2_image = pkgs.SDL2_image_2_0; }; + pygame = callPackage ../development/python-modules/pygame { }; pygame-ce = callPackage ../development/python-modules/pygame-ce { inherit (pkgs.darwin.apple_sdk.frameworks) AppKit; - SDL2_image = pkgs.SDL2_image_2_0; SDL2_mixer = pkgs.SDL2_mixer_2_0; }; From 8375464933954bcf54e05f979a3d2aeca0bd2632 Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Sun, 20 Apr 2025 15:24:19 +0200 Subject: [PATCH 4/5] SDL2_image_2_0: drop --- pkgs/by-name/sd/SDL2_image_2_0/package.nix | 17 ----------------- pkgs/top-level/aliases.nix | 1 + 2 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 pkgs/by-name/sd/SDL2_image_2_0/package.nix diff --git a/pkgs/by-name/sd/SDL2_image_2_0/package.nix b/pkgs/by-name/sd/SDL2_image_2_0/package.nix deleted file mode 100644 index 4897ff5ad44ab..0000000000000 --- a/pkgs/by-name/sd/SDL2_image_2_0/package.nix +++ /dev/null @@ -1,17 +0,0 @@ -# Dependency of pygame, toppler -{ SDL2_image, fetchurl }: - -SDL2_image.overrideAttrs (oldAttrs: { - version = "2.0.5"; - src = fetchurl { - inherit (oldAttrs.src) url; - hash = "sha256-vdX24CZoL31+G+C2BRsgnaL0AqLdi9HEvZwlrSYxCNA"; - }; - - postPatch = - (oldAttrs.postPatch or "") - + '' - # allow newer autoreconf to run successfully - touch NEWS README AUTHORS ChangeLog - ''; -}) diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 566df1693f5fe..92fa71c841f7e 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1569,6 +1569,7 @@ mapAliases { SDL_classic = SDL1; # Added 2024-09-03 SDL1 = throw "'SDL1' has been removed as development ended long ago with SDL 2.0 replacing it, use SDL_compat instead"; # Added 2025-03-27 SDL_gpu = throw "'SDL_gpu' has been removed due to lack of upstream maintenance and known users"; # Added 2025-03-15 + SDL_image_2_0 = throw "'SDL_image_2_0' has been removed in favor of the latest version"; # Added 2025-04-20 s2n = throw "'s2n' has been renamed to/replaced by 's2n-tls'"; # Converted to throw 2024-10-17 sandboxfs = throw "'sandboxfs' has been removed due to being unmaintained, consider using linux namespaces for sandboxing instead"; # Added 2024-06-06 sane-backends-git = throw "'sane-backends-git' has been renamed to/replaced by 'sane-backends'"; # Converted to throw 2024-10-17 From 8a6d7844ef50ca9f68a9af5ef1d71620b1992b4a Mon Sep 17 00:00:00 2001 From: Marcin Serwin Date: Sun, 20 Apr 2025 17:39:54 +0200 Subject: [PATCH 5/5] SDL2_image: remove unused deps --- pkgs/by-name/sd/SDL2_image/package.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkgs/by-name/sd/SDL2_image/package.nix b/pkgs/by-name/sd/SDL2_image/package.nix index ba907e6a93d5e..6baa7311a5c27 100644 --- a/pkgs/by-name/sd/SDL2_image/package.nix +++ b/pkgs/by-name/sd/SDL2_image/package.nix @@ -40,8 +40,6 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ SDL2 - giflib - libXpm libtiff libwebp zlib @@ -49,8 +47,7 @@ stdenv.mkDerivation (finalAttrs: { ++ lib.optionals (!enableSTB) [ libjpeg libpng - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ Foundation ]; + ]; configureFlags = [