diff --git a/SDL-2.548-Adapt-to-SDL-3.2.24.patch b/SDL-2.548-Adapt-to-SDL-3.2.24.patch new file mode 100644 index 0000000..2d5a3df --- /dev/null +++ b/SDL-2.548-Adapt-to-SDL-3.2.24.patch @@ -0,0 +1,56 @@ +From 8cd2c619916c09b327c3230b975d1eace2924d58 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Tue, 7 Oct 2025 14:16:23 +0200 +Subject: [PATCH] Adapt to SDL 3.2.24 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +After upgrading SDL from 3.2.22 to 3.2.24 t/core.t started to fail +like this: + + # Failed test '[get_error] got error ' + # at t/core.t line 69. + # got: '' + # expected: anything else + # Looks like you failed 1 test of 28. + t/core.t ........................ Dubious, test returned 1 (wstat 256, 0x100) + Failed 1/28 subtests + (3 TODO tests unexpectedly succeeded) + +The failure is triggered by SDL 5594d03da086ab255b1d7ace1496f3a0c109a83d commit +("Leave letterbox borders set to the frame clear color"). + +SDL_SetVideoMode(640, 480, 232, SDL_ANYFORMAT) kept succeeding, but +SDL_GetError() stopped returning "rect has a negative size" error. + +Because the new behavior is more consistent and because the Perl test +checks for SDL::get_error() instead of SDL::Video::set_video_mode() +return value, I conlude that the Perl test wants to test +SDL::get_error() and uses SDL::Video::set_video_mode() only as a way +to produce an error. + +Thus this patch uses a different SDL::Video::set_video_mode() +arguments to obtain an error ("Invalid width or height"). + +Signed-off-by: Petr Písař +--- + t/core.t | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/t/core.t b/t/core.t +index 1ccac868..8b35b9bc 100644 +--- a/t/core.t ++++ b/t/core.t +@@ -62,7 +62,7 @@ is( SDL_INIT_EVENTTHREAD(), 16777216, + 'SDL_INIT_EVENTTHREAD() should also be available' + ); + +-my $display = SDL::Video::set_video_mode( 640, 480, 232, SDL_ANYFORMAT ); ++my $display = SDL::Video::set_video_mode( -1, 480, 232, SDL_ANYFORMAT ); + + isnt( SDL::get_error(), '', '[get_error] got error ' . SDL::get_error() ); + TODO: +-- +2.51.0 + diff --git a/SDL-2.548-Fix-building-in-ISO-C23.patch b/SDL-2.548-Fix-building-in-ISO-C23.patch new file mode 100644 index 0000000..81b88ef --- /dev/null +++ b/SDL-2.548-Fix-building-in-ISO-C23.patch @@ -0,0 +1,67 @@ +From 2a1eb99101a89e46c13b75b08a4c685e0f7425fe Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Tue, 11 Feb 2025 12:14:27 +0100 +Subject: [PATCH] Fix building in ISO C23 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Building with GCC 15, which defaults to ISO C23, failed like this: + + In file included from lib/SDL_perl.xs:32: + lib/SDL_perl.c:654:13: error: conflicting types for ‘boot_SDL’; have ‘void(PerlInterpreter *, CV *)’ {aka ‘void(struct interpreter *, struct cv *)’} + 654 | XS_EXTERNAL(boot_SDL); /* prototype to pass -Wmissing-prototypes */ + | ^~~~~~~~ + /usr/lib64/perl5/CORE/XSUB.h:149:34: note: in definition of macro ‘XS_EXTERNAL’ + 149 | # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__) + | ^~~~ + lib/SDL_perl.xs:147:6: note: previous declaration of ‘boot_SDL’ with type ‘void(void)’ + 147 | void boot_SDL(); + | ^~~~~~~~ + lib/SDL_perl.c:655:13: error: conflicting types for ‘boot_SDL’; have ‘void(PerlInterpreter *, CV *)’ {aka ‘void(struct interpreter *, struct cv *)’} + 655 | XS_EXTERNAL(boot_SDL) + | ^~~~~~~~ + /usr/lib64/perl5/CORE/XSUB.h:149:34: note: in definition of macro ‘XS_EXTERNAL’ + 149 | # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__) + | ^~~~ + lib/SDL_perl.xs:147:6: note: previous declaration of ‘boot_SDL’ with type ‘void(void)’ + 147 | void boot_SDL(); + | ^~~~~~~~ + +The cause is a mismatch between how boot_SDL() was declared and used +in src/SDL.xs and how Perl generates a boot function for XS packages. +This patch fixes it by passing current Perl interpreter and, probably +ignored, cv argument. + +Resolves: https://github.com/PerlGameDev/SDL/issues/294 +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2341036 +Signed-off-by: Petr Písař +--- + src/SDL.xs | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/SDL.xs b/src/SDL.xs +index a13882c8..5856e3af 100644 +--- a/src/SDL.xs ++++ b/src/SDL.xs +@@ -144,7 +144,7 @@ sdl_perl_atexit (void) + SDL_Quit(); + } + +-void boot_SDL(); ++XS(boot_SDL); + void boot_SDL__OpenGL(); + + XS(boot_SDL_perl) +@@ -155,7 +155,7 @@ XS(boot_SDL_perl) + #endif + PL_perl_destruct_level = 2; + GET_TLS_CONTEXT +- boot_SDL(); ++ boot_SDL(aTHX_ cv); + + #if defined WINDOWS || defined WIN32 + SDL_RegisterApp ("SDLPerl App", 0, GetModuleHandle (NULL)); +-- +2.48.1 + diff --git a/SDL-2.548-Read-only-t-core_rwops.t.patch b/SDL-2.548-Read-only-t-core_rwops.t.patch new file mode 100644 index 0000000..251aead --- /dev/null +++ b/SDL-2.548-Read-only-t-core_rwops.t.patch @@ -0,0 +1,62 @@ +From 4cc57bf07c5ee60baac971e2b06c342851eeaff2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Tue, 7 Oct 2025 15:33:33 +0200 +Subject: [PATCH] Read-only t/core_rwops.t +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +t/core_rwops.t used to create a file in the current working directory +and then test that SDL::RWOps can open it, seek in it and read it. +I.e. the test did not perform any write operation, yet setting up the +test required writing. + +This unnecessary write prevented from running the tests from +a read-only location. + +This patch precreates the test file so that no write operation is +needed when running the test. + +Signed-off-by: Petr Písař +--- + t/core_rwops.t | 7 +------ + test/data/rwops | 1 + + 2 files changed, 2 insertions(+), 6 deletions(-) + create mode 100644 test/data/rwops + +diff --git a/t/core_rwops.t b/t/core_rwops.t +index 5f40a82f..0c9d5628 100644 +--- a/t/core_rwops.t ++++ b/t/core_rwops.t +@@ -11,11 +11,7 @@ my @done = qw/ + /; + can_ok( 'SDL::RWOps', @done ); + +-open FH, '>', '.rwops'; +-print FH 'rwops'; +-close FH; +- +-my $file = SDL::RWOps->new_file( '.rwops', 'rw' ); ++my $file = SDL::RWOps->new_file( 'test/data/rwops', 'r' ); + isa_ok( $file, 'SDL::RWOps', '[from_file] returns RWOps' ); + + #0 SEEK_SET +@@ -35,7 +31,6 @@ SKIP: + is( $blocks, 5, '[read] got ' . $char ); + } + $file->close(); +-unlink '.rwops'; + my @left = qw/ + from_fp + from_mem +diff --git a/test/data/rwops b/test/data/rwops +new file mode 100644 +index 00000000..d6380184 +--- /dev/null ++++ b/test/data/rwops +@@ -0,0 +1 @@ ++rwops +\ No newline at end of file +-- +2.51.0 + diff --git a/SDL-2.548-core_surface.t-test-data-icon.bmp-is-really-4-bits-p.patch b/SDL-2.548-core_surface.t-test-data-icon.bmp-is-really-4-bits-p.patch new file mode 100644 index 0000000..5c39f38 --- /dev/null +++ b/SDL-2.548-core_surface.t-test-data-icon.bmp-is-really-4-bits-p.patch @@ -0,0 +1,29 @@ +From 39c0ab8fc0b2277ece593b9b50f79f6e1ccd1fc5 Mon Sep 17 00:00:00 2001 +From: Daniel Kamil Kozar +Date: Thu, 12 Jun 2025 21:43:54 +0200 +Subject: [PATCH] core_surface.t: test/data/icon.bmp is really 4 bits per pixel +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Písař +--- + t/core_surface.t | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/t/core_surface.t b/t/core_surface.t +index 897536b6..baa962aa 100644 +--- a/t/core_surface.t ++++ b/t/core_surface.t +@@ -51,7 +51,7 @@ is( $image->h, 32, 'image has height' ); + + my $pixel_format = $image->format; + isa_ok( $pixel_format, 'SDL::PixelFormat' ); +-is( $pixel_format->BitsPerPixel, 8, ' BitsPerPixel' ); ++is( $pixel_format->BitsPerPixel, 4, ' BitsPerPixel' ); + is( $pixel_format->BytesPerPixel, 1, ' BytesPerPixel' ); + is( $pixel_format->Rloss, 8, ' Rloss' ); + is( $pixel_format->Gloss, 8, ' Gloss' ); +-- +2.50.1 + diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..c778f75 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,16 @@ +--- !Policy +product_versions: + - fedora-rawhide +decision_context: bodhi_update_push_stable +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.rpmdeplint.functional} +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_stable +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.installability.functional} + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.rpminspect.static-analysis} + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} diff --git a/perl-SDL.rpmlintrc b/perl-SDL.rpmlintrc new file mode 100644 index 0000000..a5d5f5e --- /dev/null +++ b/perl-SDL.rpmlintrc @@ -0,0 +1 @@ +addFilter('-tests\.noarch: W: no-documentation') diff --git a/perl-SDL.spec b/perl-SDL.spec index 94d348e..4255a45 100644 --- a/perl-SDL.spec +++ b/perl-SDL.spec @@ -1,6 +1,6 @@ Name: perl-SDL Version: 2.548 -Release: 25%{?dist} +Release: 31%{?dist} Summary: Simple DirectMedia Layer for Perl # COPYING: GPL-2.0 text # lib/pods/SDL.pod: GPL-1.0-or-later OR Artistic-1.0-Perl @@ -26,13 +26,13 @@ Summary: Simple DirectMedia Layer for Perl # src/SDL.xs: LGPL-2.1-or-later # src/SDLx/SFont.h: LGPL-2.1-or-later # src/SDLx/SFont.xs: LGPL-2.1-or-later -## Used at build-time, but not in any binary package -# Build.PL: refers to LGPL -# inc/My/Builder.pm: LGPL-2.1-or-later # test/data/5x7.fnt: LGPL-2.1-only (see test/data/README) # test/data/tribe_i.wav: GPL-3.0-only OR LGPL-2.0-only OR CC-BY-SA-3.0 # (see test/data/README; there is a typo in the file # name) +## Used at build-time, but not in any binary package +# Build.PL: refers to LGPL +# inc/My/Builder.pm: LGPL-2.1-or-later ## Not in any binary package and not used # META.json: refers to LGPL-2.1 # OFL.txt: OFL-1.1-RFN text @@ -42,18 +42,31 @@ License: LGPL-2.1-or-later AND (GPL-1.0-or-later OR Artistic-1.0-Perl) SourceLicense: %{license} AND LGPL-2.1-only AND (GPL-3.0-only OR LGPL-2.0-only OR CC-BY-SA-3.0) AND OFL-1.1-RFN URL: http://sdl.perl.org/ Source0: https://cpan.metacpan.org/authors/id/F/FR/FROGGS/SDL-%{version}.tar.gz -# Fix an implicit function declaration, proposed to the upstream, +# Fix an implicit function declaration, in upstream after 2.548, # bug #2177189, . Patch0: SDL-2.548-Fix-implicit-declaration-of-_calc_offset.patch # Unbundle Gentium Book Basic font, not suitable for the upstream, the file is -# delete in %%prep section. +# deleted in %%prep section. Patch1: SDL-2.548-Unbundle-Gentium-Book-Basic-regular-font.patch -# Adapt to perl 5.37.1, proposed to upstream, +# Adapt to perl 5.37.1, in upstream after 2.548, # Patch2: SDL-2.548-Adapt-to-perl-5.37.1.patch # Fix reference counting an event filter callback, bug #2272636, -# proposed to the upstream, +# in upstream after 2.548, Patch3: SDL-2.548-Fix-reference-counting-in-set_event_filter.patch +# Adapt to GCC 15, bug #2341036, +# , in upstream after 2.548, +# +Patch4: SDL-2.548-Fix-building-in-ISO-C23.patch +# Adapt t/core_surface.t test to SDL3, incompatible with SDL2, bug #2341036, +# proposed to upstream, +Patch5: SDL-2.548-core_surface.t-test-data-icon.bmp-is-really-4-bits-p.patch +# Adapt t/core.t test to SDL-3.2.24, bug #2401791, proposed upstream, +# +Patch6: SDL-2.548-Adapt-to-SDL-3.2.24.patch +# Make the tests read-only, proposed upstream, +# +Patch7: SDL-2.548-Read-only-t-core_rwops.t.patch BuildRequires: coreutils BuildRequires: findutils BuildRequires: libGLU-devel @@ -109,6 +122,11 @@ BuildRequires: perl(threads::shared) Requires: sil-gentium-basic-book-fonts %{?perl_default_filter} +# Remove under-specified dependencies +%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\(Test::Most\\)$ +# Hide private modules +%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\(SDL::TestTool\\) +%global __provides_exclude %{?__provides_exclude:%{__provides_exclude}|}^perl\\(SDL::TestTool\\) %description SDL_perl is a package of Perl modules that provide both functional and @@ -129,6 +147,20 @@ some tasks specific to SDL applications - e.g. packaging SDL application/game into PAR archive. +%package tests +Summary: Tests for %{name} +License: LGPL-2.1-or-later AND (GPL-3.0-only OR LGPL-2.0-only OR CC-BY-SA-3.0) +BuildArch: noarch +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +Requires: perl(Test::Most) >= 0.21 +Requires: sil-gentium-basic-book-fonts + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + + %prep %autosetup -p1 -n SDL-%{version} # Delete a bundled font file, code removed with @@ -146,6 +178,11 @@ sed -i -e 's|lib/pods|lib|' MANIFEST # Disable the sdlx_controller_interface.t test, it hangs on arm rm t/sdlx_controller_interface.t sed -i -e '/t\/sdlx_controller_interface\.t/d' MANIFEST +# Help generators to recognize Perl scripts +for F in t/*.t; do + perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!\s*perl}{$Config{startperl}}' "$F" + chmod +x "$F" +done %build perl Build.PL installdirs=vendor optimize="$RPM_OPT_FLAGS" @@ -159,6 +196,14 @@ export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print ./Build install destdir=%{buildroot} create_packlist=0 find %{buildroot} -type f -name '*.bs' -a -size 0 -delete %{_fixperms} %{buildroot}/* +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name}/upstream +cp -a t test %{buildroot}%{_libexecdir}/%{name}/upstream +cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' +#!/bin/sh +cd %{_libexecdir}/%{name}/upstream && exec prove -I . -j "$(getconf _NPROCESSORS_ONLN)" +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test %files %license COPYING @@ -181,7 +226,29 @@ find %{buildroot} -type f -name '*.bs' -a -size 0 -delete %{perl_vendorarch}/Module/Build/SDL.pm %{_mandir}/man3/Module::Build::SDL.* +%files tests +%{_libexecdir}/%{name} + %changelog +* Tue Oct 07 2025 Petr Pisar - 2.548-31 +- Adapt tests to SDL-3.2.24 (bug #2401791) +- Package the tests + +* Fri Jul 25 2025 Fedora Release Engineering - 2.548-30 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild + +* Fri Jul 11 2025 Petr Pisar - 2.548-29 +- Adapt t/core_surface.t test to SDL3 (bug #2341036) + +* Mon Jul 07 2025 Jitka Plesnikova - 2.548-28 +- Perl 5.42 rebuild + +* Tue Feb 11 2025 Petr Pisar - 2.548-27 +- Adapt to GCC 15 (bug #2341036) + +* Sat Jan 18 2025 Fedora Release Engineering - 2.548-26 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Fri Jul 19 2024 Fedora Release Engineering - 2.548-25 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild diff --git a/tests/upstream-tests.fmf b/tests/upstream-tests.fmf new file mode 100644 index 0000000..b138789 --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-SDL +require: perl-SDL-tests +test: /usr/libexec/perl-SDL/test