From 3f0b8c691d29bfead175f75d3e48fa5275913502 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 21 Mar 2022 09:33:00 +0100 Subject: update to 2.6.0 fix build with PHP 8.0 using patch from https://github.com/Ponup/php-sdl/pull/60 open https://github.com/Ponup/php-sdl/issues/61 build failure with 2.0.10 open https://github.com/Ponup/php-sdl/issues/62 deprecated call --- PHPINFO | 6 +- REFLECTION | 464 ++++++++++++++++++++++++++++++++++++++++-------------- php-pecl-sdl.spec | 15 +- sdl-pr60.patch | 126 +++++++++++++++ 4 files changed, 484 insertions(+), 127 deletions(-) create mode 100644 sdl-pr60.patch diff --git a/PHPINFO b/PHPINFO index 6160b84..2301e29 100644 --- a/PHPINFO +++ b/PHPINFO @@ -2,6 +2,6 @@ SDL SDL support => enabled -SDL module version => 2.5.0 -SDL2 headers version => 2.0.14 -SDL2 library version => 2.0.14 +SDL module version => 2.6.0 +SDL2 headers version => 2.0.20 +SDL2 library version => 2.0.20 diff --git a/REFLECTION b/REFLECTION index aeeaaa2..a00c702 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #84 SDL version 2.5.0 ] { +Extension [ extension #120 SDL version 2.6.0 ] { - Constants [738] { Constant [ int SDL_BLENDMODE_NONE ] { 0 } @@ -716,11 +716,11 @@ Extension [ extension #84 SDL version 2.5.0 ] { Constant [ int SDL_PREALLOC ] { 1 } Constant [ int SDL_RLEACCEL ] { 2 } Constant [ int SDL_DONTFREE ] { 4 } - Constant [ int SDL_COMPILEDVERSION ] { 2014 } + Constant [ int SDL_COMPILEDVERSION ] { 2020 } Constant [ int SDL_MAJOR_VERSION ] { 2 } Constant [ int SDL_MINOR_VERSION ] { 0 } - Constant [ int SDL_PATCHLEVEL ] { 14 } - Constant [ string SDL_REVISION ] { hg-14525:e52d96ea04fc } + Constant [ int SDL_PATCHLEVEL ] { 20 } + Constant [ string SDL_REVISION ] { @21791b5012198ae204842be1197e9a0b915f4aaa } Constant [ int SDL_WINDOW_FULLSCREEN ] { 1 } Constant [ int SDL_WINDOW_OPENGL ] { 2 } Constant [ int SDL_WINDOW_SHOWN ] { 4 } @@ -1240,6 +1240,65 @@ Extension [ extension #84 SDL version 2.5.0 ] { Parameter #2 [ &$h ] } } + Function [ function SDL_RenderDrawPointF ] { + + - Parameters [3] { + Parameter #0 [ $renderer ] + Parameter #1 [ float $x ] + Parameter #2 [ float $y ] + } + - Return [ int ] + } + Function [ function SDL_RenderDrawLineF ] { + + - Parameters [5] { + Parameter #0 [ $renderer ] + Parameter #1 [ float $x1 ] + Parameter #2 [ float $y1 ] + Parameter #3 [ float $x2 ] + Parameter #4 [ float $y2 ] + } + - Return [ int ] + } + Function [ function SDL_RenderDrawRectF ] { + + - Parameters [2] { + Parameter #0 [ $renderer ] + Parameter #1 [ SDL_FRect $rect ] + } + - Return [ int ] + } + Function [ function SDL_RenderFillRectF ] { + + - Parameters [2] { + Parameter #0 [ $renderer ] + Parameter #1 [ SDL_FRect $rect ] + } + - Return [ int ] + } + Function [ function SDL_RenderCopyF ] { + + - Parameters [4] { + Parameter #0 [ $renderer ] + Parameter #1 [ SDL_Texture $texture ] + Parameter #2 [ ?SDL_Rect $srcrect ] + Parameter #3 [ ?SDL_FRect $dstrect ] + } + - Return [ int ] + } + Function [ function SDL_RenderCopyExF ] { + + - Parameters [7] { + Parameter #0 [ $renderer ] + Parameter #1 [ SDL_Texture $texture ] + Parameter #2 [ ?SDL_Rect $srcrect ] + Parameter #3 [ ?SDL_FRect $dstrect ] + Parameter #4 [ float $angle ] + Parameter #5 [ ?SDL_FPoint $center ] + Parameter #6 [ int $flip ] + } + - Return [ int ] + } Function [ function SDL_CreateRGBSurface ] { - Parameters [8] { @@ -1478,61 +1537,6 @@ Extension [ extension #84 SDL version 2.5.0 ] { Parameter #7 [ $dst_pitch ] } } - Function [ function SDL_RectEmpty ] { - - - Parameters [1] { - Parameter #0 [ SDL_Rect $rect ] - } - } - Function [ function SDL_RectEquals ] { - - - Parameters [2] { - Parameter #0 [ SDL_Rect $rectA ] - Parameter #1 [ SDL_Rect $rectB ] - } - } - Function [ function SDL_HasIntersection ] { - - - Parameters [2] { - Parameter #0 [ SDL_Rect $rectA ] - Parameter #1 [ SDL_Rect $rectB ] - } - } - Function [ function SDL_IntersectRect ] { - - - Parameters [3] { - Parameter #0 [ SDL_Rect $rectA ] - Parameter #1 [ SDL_Rect $rectB ] - Parameter #2 [ &$result ] - } - } - Function [ function SDL_UnionRect ] { - - - Parameters [3] { - Parameter #0 [ SDL_Rect $rectA ] - Parameter #1 [ SDL_Rect $rectB ] - Parameter #2 [ &$result ] - } - } - Function [ function SDL_IntersectRectAndLine ] { - - - Parameters [5] { - Parameter #0 [ SDL_Rect $rect ] - Parameter #1 [ &$X1 ] - Parameter #2 [ &$Y1 ] - Parameter #3 [ &$X2 ] - Parameter #4 [ &$Y2 ] - } - } - Function [ function SDL_EnclosePoints ] { - - - Parameters [4] { - Parameter #0 [ array $point ] - Parameter #1 [ $count ] - Parameter #2 [ SDL_Rect $clip ] - Parameter #3 [ &$rect ] - } - } Function [ function SDL_WaitEvent ] { - Parameters [1] { @@ -2468,10 +2472,104 @@ Extension [ extension #84 SDL version 2.5.0 ] { Parameter #1 [ $value ] } } + Function [ function SDL_PointInRect ] { + + - Parameters [2] { + Parameter #0 [ SDL_Point $p ] + Parameter #1 [ SDL_Rect $r ] + } + - Return [ bool ] + } + Function [ function SDL_RectEmpty ] { + + - Parameters [1] { + Parameter #0 [ SDL_Rect $r ] + } + - Return [ bool ] + } + Function [ function SDL_RectEquals ] { + + - Parameters [2] { + Parameter #0 [ SDL_Rect $a ] + Parameter #1 [ SDL_Rect $b ] + } + - Return [ bool ] + } + Function [ function SDL_HasIntersection ] { + + - Parameters [2] { + Parameter #0 [ SDL_Rect $A ] + Parameter #1 [ SDL_Rect $B ] + } + - Return [ bool ] + } + Function [ function SDL_IntersectRect ] { + + - Parameters [3] { + Parameter #0 [ SDL_Rect $A ] + Parameter #1 [ SDL_Rect $B ] + Parameter #2 [ ?SDL_Rect &$result ] + } + - Return [ bool ] + } + Function [ function SDL_UnionRect ] { + + - Parameters [3] { + Parameter #0 [ SDL_Rect $A ] + Parameter #1 [ SDL_Rect $B ] + Parameter #2 [ ?SDL_Rect &$result ] + } + - Return [ void ] + } + Function [ function SDL_EnclosePoints ] { + + - Parameters [4] { + Parameter #0 [ SDL_Point $points ] + Parameter #1 [ int $count ] + Parameter #2 [ SDL_Rect $clip ] + Parameter #3 [ ?SDL_Rect &$result ] + } + - Return [ bool ] + } + Function [ function SDL_IntersectRectAndLine ] { + + - Parameters [5] { + Parameter #0 [ SDL_Rect $rect ] + Parameter #1 [ int &$X1 ] + Parameter #2 [ int &$Y1 ] + Parameter #3 [ int &$X2 ] + Parameter #4 [ int &$Y2 ] + } + - Return [ bool ] + } + Function [ function SDL_FRectEmpty ] { + + - Parameters [1] { + Parameter #0 [ SDL_FRect $r ] + } + - Return [ bool ] + } + Function [ function SDL_HasIntersectionF ] { + + - Parameters [2] { + Parameter #0 [ SDL_FRect $A ] + Parameter #1 [ SDL_FRect $B ] + } + - Return [ bool ] + } + Function [ function SDL_IntersectFRect ] { + + - Parameters [3] { + Parameter #0 [ SDL_FRect $A ] + Parameter #1 [ SDL_FRect $B ] + Parameter #2 [ ?SDL_FRect &$result ] + } + - Return [ bool ] + } } - - Classes [21] { - Class [ class SDL_Event ] { + - Classes [23] { + Class [ class SDL_Event implements Stringable ] { - Constants [0] { } @@ -2495,15 +2593,16 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } } } - Class [ class SDL_GLContext ] { + Class [ class SDL_GLContext implements Stringable ] { - Constants [31] { Constant [ public int RED_SIZE ] { 0 } @@ -2561,10 +2660,11 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ public method Delete ] { @@ -2575,7 +2675,7 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Class [ class SDL_MessageBoxColor ] { + Class [ class SDL_MessageBoxColor implements Stringable ] { - Constants [6] { Constant [ public int BACKGROUND ] { 0 } @@ -2608,15 +2708,16 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } } } - Class [ class SDL_MessageBoxButtonData ] { + Class [ class SDL_MessageBoxButtonData implements Stringable ] { - Constants [2] { Constant [ public int RETURNKEY_DEFAULT ] { 1 } @@ -2645,15 +2746,16 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } } } - Class [ class SDL_MessageBoxData ] { + Class [ class SDL_MessageBoxData implements Stringable ] { - Constants [3] { Constant [ public int ERROR ] { 16 } @@ -2690,10 +2792,11 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ public method Show ] { @@ -2705,7 +2808,7 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Class [ class SDL_Cursor ] { + Class [ class SDL_Cursor implements Stringable ] { - Constants [13] { Constant [ public int ARROW ] { 0 } @@ -2791,10 +2894,11 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ public method Free ] { @@ -2811,7 +2915,7 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Class [ class SDL_mutex ] { + Class [ class SDL_mutex implements Stringable ] { - Constants [2] { Constant [ public int TIMEDOUT ] { 1 } @@ -2834,10 +2938,11 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ public method Lock ] { @@ -2866,7 +2971,7 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Class [ class SDL_sem ] { + Class [ class SDL_sem implements Stringable ] { - Constants [0] { } @@ -2888,10 +2993,11 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ public method Wait ] { @@ -2933,7 +3039,7 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Class [ class SDL_cond ] { + Class [ class SDL_cond implements Stringable ] { - Constants [0] { } @@ -2954,10 +3060,11 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ public method Wait ] { @@ -2995,7 +3102,7 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Class [ class SDL_Color ] { + Class [ class SDL_Color implements Stringable ] { - Constants [0] { } @@ -3024,15 +3131,16 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } } } - Class [ class SDL_Palette implements ArrayAccess ] { + Class [ class SDL_Palette implements Stringable, ArrayAccess ] { - Constants [0] { } @@ -3058,10 +3166,11 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ public method count ] { @@ -3116,7 +3225,7 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Class [ class SDL_PixelFormat ] { + Class [ class SDL_PixelFormat implements Stringable ] { - Constants [0] { } @@ -3154,10 +3263,11 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ public method GetRGB ] { @@ -3215,7 +3325,7 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Class [ class SDL_Pixels implements ArrayAccess ] { + Class [ class SDL_Pixels implements Stringable, ArrayAccess ] { - Constants [0] { } @@ -3241,10 +3351,11 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ public method count ] { @@ -3301,7 +3412,7 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Class [ class SDL_Rect ] { + Class [ class SDL_Rect implements Stringable ] { - Constants [0] { } @@ -3313,78 +3424,147 @@ Extension [ extension #84 SDL version 2.5.0 ] { } - Properties [4] { - Property [ public $x = 0 ] - Property [ public $y = 0 ] - Property [ public $w = 0 ] - Property [ public $h = 0 ] + Property [ public int $x ] + Property [ public int $y ] + Property [ public int $w ] + Property [ public int $h ] } - Methods [8] { Method [ public method __construct ] { - Parameters [4] { - Parameter #0 [ int $x = ] - Parameter #1 [ int $y = ] - Parameter #2 [ int $w = ] - Parameter #3 [ int $y = ] + Parameter #0 [ int $x ] + Parameter #1 [ int $y ] + Parameter #2 [ int $w ] + Parameter #3 [ int $h ] } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ public method Empty ] { - Parameters [0] { } + - Return [ bool ] } Method [ public method Equal ] { - Parameters [1] { - Parameter #0 [ SDL_Rect $rect ] + Parameter #0 [ SDL_Rect $b ] } + - Return [ bool ] } Method [ public method HasIntersection ] { - Parameters [1] { - Parameter #0 [ SDL_Rect $rect ] + Parameter #0 [ SDL_Rect $B ] } + - Return [ bool ] } Method [ public method Intersect ] { - Parameters [2] { - Parameter #0 [ SDL_Rect $rect ] - Parameter #1 [ &$result ] + Parameter #0 [ SDL_Rect $B ] + Parameter #1 [ ?SDL_Rect &$result ] } + - Return [ bool ] } Method [ public method Union ] { - Parameters [2] { - Parameter #0 [ SDL_Rect $rect ] - Parameter #1 [ &$result ] + Parameter #0 [ SDL_Rect $B ] + Parameter #1 [ ?SDL_Rect &$result ] } + - Return [ void ] } Method [ public method IntersectLine ] { - Parameters [4] { - Parameter #0 [ &$X1 ] - Parameter #1 [ &$Y1 ] - Parameter #2 [ &$X2 ] - Parameter #3 [ &$Y2 ] + Parameter #0 [ int &$X1 ] + Parameter #1 [ int &$Y1 ] + Parameter #2 [ int &$X2 ] + Parameter #3 [ int &$Y2 ] } + - Return [ bool ] } } } - Class [ class SDL_Point ] { + Class [ class SDL_FRect implements Stringable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [4] { + Property [ public float $x ] + Property [ public float $y ] + Property [ public float $w ] + Property [ public float $h ] + } + + - Methods [5] { + Method [ public method __construct ] { + + - Parameters [4] { + Parameter #0 [ float $x ] + Parameter #1 [ float $y ] + Parameter #2 [ float $w ] + Parameter #3 [ float $h ] + } + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] + } + + Method [ public method Empty ] { + + - Parameters [0] { + } + - Return [ bool ] + } + + Method [ public method HasIntersection ] { + + - Parameters [1] { + Parameter #0 [ SDL_FRect $B ] + } + - Return [ bool ] + } + + Method [ public method Intersect ] { + + - Parameters [2] { + Parameter #0 [ SDL_FRect $B ] + Parameter #1 [ ?SDL_FRect &$result ] + } + - Return [ bool ] + } + } + } + + Class [ class SDL_Point implements Stringable ] { - Constants [0] { } @@ -3396,28 +3576,63 @@ Extension [ extension #84 SDL version 2.5.0 ] { } - Properties [2] { - Property [ public $x = 0 ] - Property [ public $y = 0 ] + Property [ public int $x ] + Property [ public int $y ] } - Methods [2] { Method [ public method __construct ] { - Parameters [2] { - Parameter #0 [ $x ] - Parameter #1 [ $y ] + Parameter #0 [ int $x ] + Parameter #1 [ int $y ] + } + } + + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] + } + } + } + + Class [ class SDL_FPoint implements Stringable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [2] { + Property [ public float $x ] + Property [ public float $y ] + } + + - Methods [2] { + Method [ public method __construct ] { + + - Parameters [2] { + Parameter #0 [ float $x ] + Parameter #1 [ float $y ] } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } } } - Class [ class SDL_RWops ] { + Class [ class SDL_RWops implements Stringable ] { - Constants [6] { Constant [ public int UNKNOWN ] { 0 } @@ -3476,10 +3691,11 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ public method Free ] { @@ -3625,7 +3841,7 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Class [ class SDL_WindowShapeMode ] { + Class [ class SDL_WindowShapeMode implements Stringable ] { - Constants [4] { Constant [ public int Default ] { 0 } @@ -3655,15 +3871,16 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } } } - Class [ class SDL_Surface ] { + Class [ class SDL_Surface implements Stringable ] { - Constants [4] { Constant [ public int SWSURFACE ] { 0 } @@ -3717,10 +3934,11 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ public method Free ] { @@ -3942,7 +4160,7 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Class [ class SDL_DisplayMode ] { + Class [ class SDL_DisplayMode implements Stringable ] { - Constants [0] { } @@ -3971,15 +4189,16 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } } } - Class [ class SDL_Window ] { + Class [ class SDL_Window implements Stringable ] { - Constants [18] { Constant [ public int FULLSCREEN ] { 1 } @@ -4042,10 +4261,11 @@ Extension [ extension #84 SDL version 2.5.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ public method UpdateSurface ] { diff --git a/php-pecl-sdl.spec b/php-pecl-sdl.spec index c648495..c202871 100644 --- a/php-pecl-sdl.spec +++ b/php-pecl-sdl.spec @@ -14,13 +14,16 @@ Summary: Simple DirectMedia Layer for PHP Name: %{?scl_prefix}php-pecl-sdl -Version: 2.5.0 -Release: 3%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Version: 2.6.0 +Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: PHP Group: Development/Languages URL: https://pecl.php.net/package/sdl Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz +# https://github.com/Ponup/php-sdl/pull/60 +Patch0: %{pecl_name}-pr60.patch + BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 8.0 @@ -69,6 +72,7 @@ mv %{pecl_name}-%{version} NTS cd NTS #sed -e 's/2.3.0/%{version}/' -i src/php_sdl.h +%patch0 -p1 -b .pr60 # Sanity check, really often broken extver=$(sed -n '/#define PHP_SDL_VERSION/{s/.* "//;s/".*$//;p}' src/php_sdl.h) @@ -198,6 +202,13 @@ fi %changelog +* Mon Mar 21 2022 Remi Collet - 2.6.0-1 +- update to 2.6.0 +- fix build with PHP 8.0 using patch from + https://github.com/Ponup/php-sdl/pull/60 +- open https://github.com/Ponup/php-sdl/issues/61 build failure with 2.0.10 +- open https://github.com/Ponup/php-sdl/issues/62 deprecated call + * Mon Mar 14 2022 Remi Collet - 2.5.0-3 - handle all SDL extensions in launcher (for sdl_mixer) diff --git a/sdl-pr60.patch b/sdl-pr60.patch new file mode 100644 index 0000000..149a137 --- /dev/null +++ b/sdl-pr60.patch @@ -0,0 +1,126 @@ +From b6c4b90482558b18e0dba665768b1ad0855684d5 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 21 Mar 2022 08:21:19 +0100 +Subject: [PATCH 1/2] fix PHP 8.0 build + +--- + src/pixels.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/pixels.c b/src/pixels.c +index ef1525b..4594d58 100644 +--- a/src/pixels.c ++++ b/src/pixels.c +@@ -20,6 +20,12 @@ + #include "zend_interfaces.h" + #include "zend_operators.h" + ++/* for PHP 8.0 */ ++#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX ++#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ ++ ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) ++#endif ++ + static zend_class_entry *php_sdl_color_ce; + static zend_object_handlers php_sdl_color_handlers; + struct php_sdl_color { + +From c5105dc060edec6d1291e36c3aed30e892630b14 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 21 Mar 2022 09:07:45 +0100 +Subject: [PATCH 2/2] register rect functions in rect.c + +--- + src/php_sdl.c | 18 +++--------------- + src/rect.c | 11 +++++++++++ + src/rect.h | 1 + + 3 files changed, 15 insertions(+), 15 deletions(-) + +diff --git a/src/php_sdl.c b/src/php_sdl.c +index 531f842..c409c6c 100644 +--- a/src/php_sdl.c ++++ b/src/php_sdl.c +@@ -31,7 +31,6 @@ + #include "power.h" + #include "pixels.h" + #include "rect.h" +-#include "rect_arginfo.h" + #include "render.h" + #include "rwops.h" + #include "sdl.h" +@@ -68,6 +67,7 @@ zend_bool php_sdl_check_overflow(int a, int b, int silent) + + + #define PHP_MINIT_CALL(func) PHP_MINIT(func)(INIT_FUNC_ARGS_PASSTHRU) ++#define PHP_MSHUTDOWN_CALL(func) PHP_MSHUTDOWN(func)(SHUTDOWN_FUNC_ARGS_PASSTHRU) + + /* {{{ PHP_MINIT_FUNCTION */ + PHP_MINIT_FUNCTION(sdl) +@@ -107,6 +107,8 @@ PHP_MINIT_FUNCTION(sdl) + /* {{{ PHP_MSHUTDOWN_FUNCTION */ + PHP_MSHUTDOWN_FUNCTION(sdl) + { ++ PHP_MSHUTDOWN_CALL(sdl_rect); ++ + return SUCCESS; + } + /* }}} */ +@@ -260,20 +262,6 @@ static zend_function_entry sdl_functions[] = { + //PHP_FALIAS(SDL_BlitSurface, SDL_UpperBlit, arginfo_SDL_UpperBlit) + //PHP_FALIAS(SDL_BlitScaled, SDL_UpperBlitScaled, arginfo_SDL_UpperBlit) + +- // Rect +- ZEND_FE(SDL_RectEmpty, arginfo_SDL_RectEmpty) +- ZEND_FE(SDL_RectEquals, arginfo_SDL_RectEquals) +- ZEND_FE(SDL_HasIntersection, arginfo_SDL_HasIntersection) +- ZEND_FE(SDL_IntersectRect, arginfo_SDL_IntersectRect) +- ZEND_FE(SDL_UnionRect, arginfo_SDL_UnionRect) +- ZEND_FE(SDL_IntersectRectAndLine, arginfo_SDL_IntersectRectAndLine) +- ZEND_FE(SDL_EnclosePoints, arginfo_SDL_EnclosePoints) +- ZEND_FE(SDL_PointInRect, arginfo_SDL_PointInRect) +- +- ZEND_FE(SDL_FRectEmpty, arginfo_SDL_FRectEmpty) +- ZEND_FE(SDL_HasIntersectionF, arginfo_SDL_HasIntersectionF) +- ZEND_FE(SDL_IntersectFRect, arginfo_SDL_IntersectFRect) +- + // Events + ZEND_FE(SDL_WaitEvent, arginfo_SDL_WaitEvent) + ZEND_FE(SDL_PollEvent, arginfo_SDL_PollEvent) +diff --git a/src/rect.c b/src/rect.c +index 6773f56..926d1b2 100644 +--- a/src/rect.c ++++ b/src/rect.c +@@ -697,6 +697,8 @@ PHP_FUNCTION(SDL_PointInRect) + /* {{{ MINIT */ + PHP_MINIT_FUNCTION(sdl_rect) + { ++ zend_register_functions(NULL, ext_functions, NULL, type); ++ + php_sdl_rect_ce = register_class_SDL_Rect(); + memcpy(&php_sdl_rect_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + +@@ -712,3 +714,12 @@ PHP_MINIT_FUNCTION(sdl_rect) + return SUCCESS; + } + /* }}} */ ++ ++/* {{{ PHP_MSHUTDOWN_FUNCTION */ ++PHP_MSHUTDOWN_FUNCTION(sdl_rect) ++{ ++ zend_unregister_functions(ext_functions, -1, NULL); ++ ++ return SUCCESS; ++} ++/* }}} */ +diff --git a/src/rect.h b/src/rect.h +index 67ba131..baddfd6 100644 +--- a/src/rect.h ++++ b/src/rect.h +@@ -40,6 +40,7 @@ zend_class_entry *get_php_sdl_fpoint_ce(void); + zend_bool zval_to_sdl_fpoint(zval *value, SDL_FPoint *rect); + + PHP_MINIT_FUNCTION(sdl_rect); ++PHP_MSHUTDOWN_FUNCTION(sdl_rect); + + #ifdef __cplusplus + } // extern "C" -- cgit