Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perlPackages.SDL: fix on perl >= 5.38.0 #256402

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions pkgs/development/perl-modules/sdl-modern-perl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
From d734d03862d7dcc776bd2fa3ba662cdd5879b32e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <[email protected]>
Date: Wed, 12 Jul 2023 17:55:27 +0200
Subject: [PATCH] Adapt to perl 5.37.1

Perl 5.37.1 removed a deprecated sv_nv() macro and SDL fails to build
with Perl 5.38.0:

lib/SDLx/Controller/Interface.xs:60:26: error: implicit declaration of function 'sv_nv'
60 | out->dv_x = sv_nv(temp);
| ^~~~~

Users are advised to use SvNVx() macro instead. SvNVx() seems to have been
available all the time (it predates a commit from 1993-10-07).

This patch does that.

https://github.com/PerlGameDev/SDL/issues/303
---
src/SDLx/Controller/Interface.xs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/SDLx/Controller/Interface.xs b/src/SDLx/Controller/Interface.xs
index 3dc202b7..d326c885 100644
--- a/src/SDLx/Controller/Interface.xs
+++ b/src/SDLx/Controller/Interface.xs
@@ -57,15 +57,15 @@ void evaluate(SDLx_Interface *obj, SDLx_Derivative *out, SDLx_State *initial, fl

SV *temp;
temp = av_pop(accel);
- out->dv_x = sv_nv(temp);
+ out->dv_x = SvNVx(temp);
SvREFCNT_dec(temp);

temp = av_pop(accel);
- out->dv_y = sv_nv(temp);
+ out->dv_y = SvNVx(temp);
SvREFCNT_dec(temp);

temp = av_pop(accel);
- out->dang_v = sv_nv(temp);
+ out->dang_v = SvNVx(temp);
SvREFCNT_dec(temp);

SvREFCNT_dec((SV *)accel);
@@ -90,15 +90,15 @@ void evaluate_dt(SDLx_Interface *obj, SDLx_Derivative *out, SDLx_State *initial,

SV *temp;
temp = av_pop(accel);
- out->dv_x = sv_nv(temp);
+ out->dv_x = SvNVx(temp);
SvREFCNT_dec(temp);

temp = av_pop(accel);
- out->dv_y = sv_nv(temp);
+ out->dv_y = SvNVx(temp);
SvREFCNT_dec(temp);

temp = av_pop(accel);
- out->dang_v = sv_nv(temp);
+ out->dang_v = SvNVx(temp);
SvREFCNT_dec(temp);

SvREFCNT_dec((SV *)accel);
4 changes: 4 additions & 0 deletions pkgs/top-level/perl-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21442,6 +21442,10 @@ with self; {
url = "mirror://cpan/authors/id/F/FR/FROGGS/SDL-2.548.tar.gz";
hash = "sha256-JSoZK/qcIHCkiDcH0TnDpF2cRRjM1moeaZtbeVm9T7U=";
};
patches = [
# https://github.com/PerlGameDev/SDL/pull/304
../development/perl-modules/sdl-modern-perl.patch
];
perlPreHook = "export LD=$CC";
preCheck = "rm t/core_audiospec.t";
buildInputs = [ pkgs.SDL pkgs.SDL_gfx pkgs.SDL_mixer pkgs.SDL_image pkgs.SDL_ttf pkgs.SDL_Pango pkgs.SDL_net AlienSDL CaptureTiny TestDeep TestDifferences TestException TestMost TestWarn ];
Expand Down