summaryrefslogtreecommitdiffstats
path: root/sdl-pr60.patch
diff options
context:
space:
mode:
Diffstat (limited to 'sdl-pr60.patch')
-rw-r--r--sdl-pr60.patch126
1 files changed, 126 insertions, 0 deletions
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 <remi@remirepo.net>
+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 <remi@remirepo.net>
+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"