diff --git a/pkgs/by-name/sd/sdl2-compat/package.nix b/pkgs/by-name/sd/sdl2-compat/package.nix index e16eb5927cec0..fde780a230426 100644 --- a/pkgs/by-name/sd/sdl2-compat/package.nix +++ b/pkgs/by-name/sd/sdl2-compat/package.nix @@ -2,7 +2,6 @@ cmake, lib, fetchFromGitHub, - fetchpatch2, ninja, sdl3, stdenv, @@ -31,13 +30,13 @@ let in stdenv.mkDerivation (finalAttrs: { pname = "sdl2-compat"; - version = "2.32.58"; + version = "2.32.60"; src = fetchFromGitHub { owner = "libsdl-org"; repo = "sdl2-compat"; tag = "release-${finalAttrs.version}"; - hash = "sha256-Ngmr/KG5dQ1IDVafn2Jw/29hFCzPGKc9GOenT/4fsIM="; + hash = "sha256-8nhSyifEeYEZj9tqid1x67jhxqmrR61NwQ/g0Z8vbw8="; }; nativeBuildInputs = [ @@ -74,12 +73,6 @@ stdenv.mkDerivation (finalAttrs: { patches = [ ./find-headers.patch - - # https://github.com/libsdl-org/sdl2-compat/pull/545 - (fetchpatch2 { - url = "https://github.com/libsdl-org/sdl2-compat/commit/b799076c72c2492224e81544f58f92b737cccbd3.patch?full_index=1"; - hash = "sha256-fAc8yBlT+XFHDKcF4MFgBAz2WtXGmhYzNNrjaGSr+do="; - }) ]; setupHook = ./setup-hook.sh; diff --git a/pkgs/by-name/sd/sdl3/package.nix b/pkgs/by-name/sd/sdl3/package.nix index 0e5feb85776ad..48ef594995ad4 100644 --- a/pkgs/by-name/sd/sdl3/package.nix +++ b/pkgs/by-name/sd/sdl3/package.nix @@ -61,7 +61,7 @@ assert lib.assertMsg (ibusSupport -> dbusSupport) "SDL3 requires dbus support to stdenv.mkDerivation (finalAttrs: { pname = "sdl3"; - version = "3.2.26"; + version = "3.2.28"; outputs = [ "lib" @@ -74,18 +74,14 @@ stdenv.mkDerivation (finalAttrs: { owner = "libsdl-org"; repo = "SDL"; tag = "release-${finalAttrs.version}"; - hash = "sha256-edcub/zeho4mB3tItp+PSD5l+H6jUPm3seiBP6ppT0k="; + hash = "sha256-nfnvzog1bON2IaBOeWociV82lmRY+qXgdeXBe6GYlww="; }; postPatch = # Tests timeout on Darwin - # `testtray` loads assets from a relative path, which we are patching to be absolute lib.optionalString (finalAttrs.finalPackage.doCheck) '' substituteInPlace test/CMakeLists.txt \ --replace-fail 'set(noninteractive_timeout 10)' 'set(noninteractive_timeout 30)' - - substituteInPlace test/testtray.c \ - --replace-warn '../test/' '${placeholder "installedTests"}/share/assets/' '' + lib.optionalString waylandSupport '' substituteInPlace src/video/wayland/SDL_waylandmessagebox.c \ diff --git a/pkgs/development/python-modules/pygame-ce/0001-Use-SDL_AllocFormat-instead-of-creating-it-manually.patch b/pkgs/development/python-modules/pygame-ce/0001-Use-SDL_AllocFormat-instead-of-creating-it-manually.patch deleted file mode 100644 index 1e1f407dbc193..0000000000000 --- a/pkgs/development/python-modules/pygame-ce/0001-Use-SDL_AllocFormat-instead-of-creating-it-manually.patch +++ /dev/null @@ -1,151 +0,0 @@ -From 3e3fbdc11ab00c4c04eb68c40b23979245c987fa Mon Sep 17 00:00:00 2001 -From: Marcin Serwin -Date: Sat, 8 Nov 2025 19:47:41 +0100 -Subject: [PATCH] Use SDL_AllocFormat instead of creating it manually - -According to the docs, `SDL_PixelFormat` is a read-only structure. -Creating it manually leaves out some important fields like `format` and -`next` pointer to be undefined. - -Signed-off-by: Marcin Serwin ---- - src_c/surface.c | 80 ++++++++++++++----------------------------------- - 1 file changed, 23 insertions(+), 57 deletions(-) - -diff --git a/src_c/surface.c b/src_c/surface.c -index f118a4db4..e51e80554 100644 ---- a/src_c/surface.c -+++ b/src_c/surface.c -@@ -1844,9 +1844,8 @@ surf_convert(pgSurfaceObject *self, PyObject *args) - */ - int bpp = 0; - SDL_Palette *palette = SDL_AllocPalette(default_palette_size); -- SDL_PixelFormat format; -+ Uint32 format_enum = 0; - -- memcpy(&format, surf->format, sizeof(format)); - if (pg_IntFromObj(argobject, &bpp)) { - Uint32 Rmask, Gmask, Bmask, Amask; - -@@ -1904,30 +1903,23 @@ surf_convert(pgSurfaceObject *self, PyObject *args) - "nonstandard bit depth given"); - } - } -- format.Rmask = Rmask; -- format.Gmask = Gmask; -- format.Bmask = Bmask; -- format.Amask = Amask; -+ format_enum = SDL_MasksToPixelFormatEnum(bpp, Rmask, Gmask, -+ Bmask, Amask); - } - else if (PySequence_Check(argobject) && - PySequence_Size(argobject) == 4) { -- Uint32 mask; -+ Uint32 Rmask, Gmask, Bmask, Amask; - -- if (!pg_UintFromObjIndex(argobject, 0, &format.Rmask) || -- !pg_UintFromObjIndex(argobject, 1, &format.Gmask) || -- !pg_UintFromObjIndex(argobject, 2, &format.Bmask) || -- !pg_UintFromObjIndex(argobject, 3, &format.Amask)) { -+ if (!pg_UintFromObjIndex(argobject, 0, &Rmask) || -+ !pg_UintFromObjIndex(argobject, 1, &Gmask) || -+ !pg_UintFromObjIndex(argobject, 2, &Bmask) || -+ !pg_UintFromObjIndex(argobject, 3, &Amask)) { - pgSurface_Unprep(self); - return RAISE(PyExc_ValueError, - "invalid color masks given"); - } -- mask = -- format.Rmask | format.Gmask | format.Bmask | format.Amask; -- for (bpp = 0; bpp < 32; ++bpp) { -- if (!(mask >> bpp)) { -- break; -- } -- } -+ format_enum = SDL_MasksToPixelFormatEnum(bpp, Rmask, Gmask, -+ Bmask, Amask); - } - else { - pgSurface_Unprep(self); -@@ -1935,22 +1927,11 @@ surf_convert(pgSurfaceObject *self, PyObject *args) - PyExc_ValueError, - "invalid argument specifying new format to convert to"); - } -- format.BitsPerPixel = (Uint8)bpp; -- format.BytesPerPixel = (bpp + 7) / 8; -- if (PG_FORMAT_BitsPerPixel((&format)) > 8) { -- /* Allow a 8 bit source surface with an empty palette to be -- * converted to a format without a palette (pygame-ce issue -- * #146). If the target format has a non-NULL palette pointer -- * then SDL_ConvertSurface checks that the palette is not -- * empty-- that at least one entry is not black. -- */ -- format.palette = NULL; -- } -- if (SDL_ISPIXELFORMAT_INDEXED(SDL_MasksToPixelFormatEnum( -- PG_FORMAT_BitsPerPixel((&format)), format.Rmask, -- format.Gmask, format.Bmask, format.Amask))) { -+ SDL_PixelFormat *format = SDL_AllocFormat(format_enum); -+ -+ if (SDL_ISPIXELFORMAT_INDEXED(format_enum)) { - if (SDL_ISPIXELFORMAT_INDEXED(PG_SURF_FORMATENUM(surf))) { -- SDL_SetPixelFormatPalette(&format, surf->format->palette); -+ SDL_SetPixelFormatPalette(format, surf->format->palette); - } - else { - /* Give the surface something other than an all white -@@ -1958,12 +1939,13 @@ surf_convert(pgSurfaceObject *self, PyObject *args) - */ - SDL_SetPaletteColors(palette, default_palette_colors, 0, - default_palette_size); -- SDL_SetPixelFormatPalette(&format, palette); -+ SDL_SetPixelFormatPalette(format, palette); - } - } -- newsurf = PG_ConvertSurface(surf, &format); -+ newsurf = PG_ConvertSurface(surf, format); - SDL_SetSurfaceBlendMode(newsurf, SDL_BLENDMODE_NONE); - SDL_FreePalette(palette); -+ SDL_FreeFormat(format); - } - } - else { -@@ -4540,29 +4522,13 @@ pgSurface_Blit(pgSurfaceObject *dstobj, pgSurfaceObject *srcobj, - } - else { - SDL_PixelFormat *fmt = src->format; -- SDL_PixelFormat newfmt; -+ SDL_PixelFormat *newfmt = -+ SDL_AllocFormat(SDL_MasksToPixelFormatEnum( -+ fmt->BitsPerPixel, fmt->Rmask, fmt->Gmask, fmt->Bmask, 0)); - -- newfmt.palette = 0; /* Set NULL (or SDL gets confused) */ --#if SDL_VERSION_ATLEAST(3, 0, 0) -- newfmt.bits_per_pixel = fmt->bits_per_pixel; -- newfmt.bytes_per_pixel = fmt->bytes_per_pixel; --#else -- newfmt.BitsPerPixel = fmt->BitsPerPixel; -- newfmt.BytesPerPixel = fmt->BytesPerPixel; --#endif -- newfmt.Amask = 0; -- newfmt.Rmask = fmt->Rmask; -- newfmt.Gmask = fmt->Gmask; -- newfmt.Bmask = fmt->Bmask; -- newfmt.Ashift = 0; -- newfmt.Rshift = fmt->Rshift; -- newfmt.Gshift = fmt->Gshift; -- newfmt.Bshift = fmt->Bshift; -- newfmt.Aloss = 0; -- newfmt.Rloss = fmt->Rloss; -- newfmt.Gloss = fmt->Gloss; -- newfmt.Bloss = fmt->Bloss; -- src = PG_ConvertSurface(src, &newfmt); -+ src = PG_ConvertSurface(src, newfmt); -+ -+ SDL_FreeFormat(newfmt); - if (src) { - #if SDL_VERSION_ATLEAST(3, 0, 0) - result = SDL_BlitSurface(src, srcrect, dst, dstrect) ? 0 : -1; --- -2.51.0 - diff --git a/pkgs/development/python-modules/pygame-ce/default.nix b/pkgs/development/python-modules/pygame-ce/default.nix index 1f132ab7fab0c..ed120e12e7613 100644 --- a/pkgs/development/python-modules/pygame-ce/default.nix +++ b/pkgs/development/python-modules/pygame-ce/default.nix @@ -62,11 +62,8 @@ buildPythonPackage rec { ); }) - # Can be removed with the next SDL3 bump. + # Can be removed after the SDL 3.4.0 bump. ./skip-rle-tests.patch - - # https://github.com/pygame-community/pygame-ce/pull/3639 - ./0001-Use-SDL_AllocFormat-instead-of-creating-it-manually.patch ]; postPatch = '' diff --git a/pkgs/development/python-modules/pygame-ce/skip-rle-tests.patch b/pkgs/development/python-modules/pygame-ce/skip-rle-tests.patch index f7ecc1ccb3305..6b488f0c880a0 100644 --- a/pkgs/development/python-modules/pygame-ce/skip-rle-tests.patch +++ b/pkgs/development/python-modules/pygame-ce/skip-rle-tests.patch @@ -2,14 +2,6 @@ diff --git a/test/surface_test.py b/test/surface_test.py index c2c91f4f5..58d916de8 100644 --- a/test/surface_test.py +++ b/test/surface_test.py -@@ -404,6 +404,7 @@ class SurfaceTypeTest(unittest.TestCase): - finally: - pygame.display.quit() - -+ @unittest.skipIf(True, "https://github.com/libsdl-org/SDL/pull/14429") - def test_solarwolf_rle_usage_2(self): - """Test for RLE status after setting alpha""" - @@ -435,6 +436,7 @@ class SurfaceTypeTest(unittest.TestCase): finally: pygame.display.quit()