From 4a9dfd90e9de0b9be3491654ffddcc576d574ee8 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 15 Mar 2022 07:09:17 +0100 Subject: update to 0.4.0 drop all patches, all merged upstream --- PHPINFO | 2 +- REFLECTION | 2 +- php-pecl-sdl-mixer.spec | 12 +- sdl_mixer-build.patch | 466 ------------------------------------------------ 4 files changed, 8 insertions(+), 474 deletions(-) delete mode 100644 sdl_mixer-build.patch diff --git a/PHPINFO b/PHPINFO index 2bf8697..3c0a4e5 100644 --- a/PHPINFO +++ b/PHPINFO @@ -2,7 +2,7 @@ SDL_mixer SDL_mixer support => enabled -SDL_mixer PHP extension version => 0.3.0 +SDL_mixer PHP extension version => 0.4.0 SDL_mixer linked version => 2.0.4 SDL_mixer compiled version => 2.0.4 SDL_mixer flags => flac, mod, mp3, ogg, mid, opus diff --git a/REFLECTION b/REFLECTION index ec69dde..8cb56ec 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #121 SDL_mixer version 0.3.0 ] { +Extension [ extension #121 SDL_mixer version 0.4.0 ] { - Dependencies { Dependency [ sdl (Required) ] diff --git a/php-pecl-sdl-mixer.spec b/php-pecl-sdl-mixer.spec index 82cf60b..78658eb 100644 --- a/php-pecl-sdl-mixer.spec +++ b/php-pecl-sdl-mixer.spec @@ -19,20 +19,18 @@ %global pecl_name sdl_mixer # no ini file (loaded by phpsdl helper) -%global upstream_version 0.3.0 +%global upstream_version 0.4.0 #global upstream_prever RC1 Summary: Binding of SDL_mixer for PHP Name: %{?scl_prefix}php-pecl-sdl-mixer Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} -Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: zlib URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz -Patch0: %{pecl_name}-build.patch - BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 8.0 @@ -82,8 +80,6 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS -%patch0 -p1 - # Check version as upstream often forget to update this extver=$(sed -n '/define PHP_SDL_MIXER_VERSION/{s/.* "//;s/".*$//;p}' src/php_sdl_mixer.h) if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}%{?gh_date:-dev}"; then @@ -199,6 +195,10 @@ fi %changelog +* Tue Mar 15 2022 Remi Collet - 0.4.0-1 +- update to 0.4.0 +- drop all patches, all merged upstream + * Mon Mar 14 2022 Remi Collet - 0.3.0-2 - fix dependencies diff --git a/sdl_mixer-build.patch b/sdl_mixer-build.patch deleted file mode 100644 index cb22e35..0000000 --- a/sdl_mixer-build.patch +++ /dev/null @@ -1,466 +0,0 @@ -From be799d73a50fba84803a5640f897d71769886860 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Subject: [PATCH] SDL is required - ---- - package.xml | 8 +++++++- - src/php_sdl_mixer.c | 9 ++++++++- - 2 files changed, 15 insertions(+), 2 deletions(-) - -diff --git a/src/php_sdl_mixer.c b/src/php_sdl_mixer.c -index a8a0325..ef58d05 100644 ---- a/src/php_sdl_mixer.c -+++ b/src/php_sdl_mixer.c -@@ -41,8 +41,15 @@ PHP_MINFO_FUNCTION(sdl_mixer) - php_info_print_table_end(); - } - -+static const zend_module_dep ext_deps[] = { -+ ZEND_MOD_REQUIRED("sdl") -+ ZEND_MOD_END -+}; -+ - zend_module_entry sdl_mixer_module_entry = { -- STANDARD_MODULE_HEADER, -+ STANDARD_MODULE_HEADER_EX, -+ NULL, -+ ext_deps, - "SDL_mixer", - ext_functions, - PHP_MINIT(sdl_mixer), -From 6e4308959dae7179beb9422797e7fb637c62b919 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Sun, 13 Mar 2022 08:12:37 +0100 -Subject: [PATCH] check if Mix_HasMusicDecoder is available - ---- - config.m4 | 4 ++++ - src/music.c | 2 ++ - src/php_sdl_mixer.stub.php | 7 ++++++- - src/php_sdl_mixer_arginfo.h | 12 ++++++++++-- - 4 files changed, 22 insertions(+), 3 deletions(-) - -diff --git a/config.m4 b/config.m4 -index a70426e..2468383 100644 ---- a/config.m4 -+++ b/config.m4 -@@ -30,6 +30,10 @@ if test "$PHP_SDL_MIXER" != "no"; then - AC_MSG_ERROR([libSDL2_mixer not found!]) - ]) - -+ AC_CHECK_LIB(SDL2_mixer, Mix_HasMusicDecoder, [ -+ AC_DEFINE(HAVE_MIX_HASMUSICDECODER, 1, [ Have sdl_mixer support ]) -+ ]) -+ - AC_DEFINE(HAVE_SDL_MIXER, 1, [ Have sdl_mixer support ]) - - PHP_SUBST(SDL_MIXER_SHARED_LIBADD) -diff --git a/src/music.c b/src/music.c -index 7f4c178..122dffe 100644 ---- a/src/music.c -+++ b/src/music.c -@@ -83,6 +83,7 @@ PHP_FUNCTION(Mix_GetMusicDecoder) - RETURN_STRING(result); - } - -+#if defined(HAVE_MIX_HASMUSICDECODER) - PHP_FUNCTION(Mix_HasMusicDecoder) - { - char *name = NULL; -@@ -96,6 +97,7 @@ PHP_FUNCTION(Mix_HasMusicDecoder) - - RETURN_BOOL(result == SDL_TRUE); - } -+#endif - - PHP_FUNCTION(Mix_PlayMusic) - { -diff --git a/src/php_sdl_mixer.stub.php b/src/php_sdl_mixer.stub.php -index c73689c..0ceef5e 100644 ---- a/src/php_sdl_mixer.stub.php -+++ b/src/php_sdl_mixer.stub.php -@@ -1,6 +1,9 @@ - -Date: Mon, 14 Mar 2022 10:11:00 +0100 -Subject: [PATCH 1/2] split stub and arginfo - ---- - package.xml | 4 ++++ - src/Mix_Chunk.c | 1 + - src/Mix_Chunk.stub.php | 8 ++++++++ - src/Mix_Chunk_arginfo.h | 20 ++++++++++++++++++++ - src/Mix_Music.c | 1 + - src/Mix_Music.stub.php | 8 ++++++++ - src/Mix_Music_arginfo.h | 20 ++++++++++++++++++++ - src/mixer.c | 5 +---- - src/php_sdl_mixer.c | 1 + - src/php_sdl_mixer.h | 1 - - src/php_sdl_mixer.stub.php | 2 -- - src/php_sdl_mixer_arginfo.h | 34 +--------------------------------- - 12 files changed, 65 insertions(+), 40 deletions(-) - create mode 100644 src/Mix_Chunk.stub.php - create mode 100644 src/Mix_Chunk_arginfo.h - create mode 100644 src/Mix_Music.stub.php - create mode 100644 src/Mix_Music_arginfo.h - -diff --git a/src/Mix_Chunk.c b/src/Mix_Chunk.c -index 014108c..6fa1a5b 100644 ---- a/src/Mix_Chunk.c -+++ b/src/Mix_Chunk.c -@@ -1,4 +1,5 @@ - #include "Mix_Chunk.h" -+#include "Mix_Chunk_arginfo.h" - - zend_class_entry *mix_chunk_ce = NULL; - zend_object_handlers php_mix_chunk_object_handlers; -diff --git a/src/Mix_Chunk.stub.php b/src/Mix_Chunk.stub.php -new file mode 100644 -index 0000000..7814a12 ---- /dev/null -+++ b/src/Mix_Chunk.stub.php -@@ -0,0 +1,8 @@ -+ce_flags |= ZEND_ACC_FINAL; -+ -+ return class_entry; -+} -diff --git a/src/Mix_Music.c b/src/Mix_Music.c -index 3c1e3f5..1030404 100644 ---- a/src/Mix_Music.c -+++ b/src/Mix_Music.c -@@ -1,4 +1,5 @@ - #include "Mix_Music.h" -+#include "Mix_Music_arginfo.h" - - zend_class_entry *mix_music_ce = NULL; - zend_object_handlers php_mix_music_object_handlers; -diff --git a/src/Mix_Music.stub.php b/src/Mix_Music.stub.php -new file mode 100644 -index 0000000..e1b56cc ---- /dev/null -+++ b/src/Mix_Music.stub.php -@@ -0,0 +1,8 @@ -+ce_flags |= ZEND_ACC_FINAL; -+ -+ return class_entry; -+} -diff --git a/src/mixer.c b/src/mixer.c -index c976351..7c5d69b 100644 ---- a/src/mixer.c -+++ b/src/mixer.c -@@ -4,9 +4,6 @@ - - #include "mixer.h" - --static zend_class_entry *php_mix_chunk_ce; --static zend_object_handlers php_mix_chunk_handlers; -- - extern zend_class_entry *mix_chunk_ce; - extern zend_class_entry *get_php_sdl_rwops_ce(void); - extern SDL_RWops *zval_to_sdl_rwops(zval *z_val); -@@ -549,4 +546,4 @@ PHP_FUNCTION(Mix_GetError) { - if (error) { - RETURN_STRING(error); - } --} -\ No newline at end of file -+} -diff --git a/src/php_sdl_mixer.c b/src/php_sdl_mixer.c -index ef58d05..4707e04 100644 ---- a/src/php_sdl_mixer.c -+++ b/src/php_sdl_mixer.c -@@ -1,6 +1,7 @@ - #include "php_sdl_mixer.h" - #include "mixer.h" - #include "music.h" -+#include "php_sdl_mixer_arginfo.h" - - #ifdef COMPILE_DL_SDL_MIXER - ZEND_GET_MODULE(sdl_mixer) -diff --git a/src/php_sdl_mixer.h b/src/php_sdl_mixer.h -index eddf015..c909d33 100644 ---- a/src/php_sdl_mixer.h -+++ b/src/php_sdl_mixer.h -@@ -23,7 +23,6 @@ extern "C" { - #include - #include - #include "SDL_mixer.h" --#include "php_sdl_mixer_arginfo.h" - - #ifdef __cplusplus - } // extern "C" -diff --git a/src/php_sdl_mixer.stub.php b/src/php_sdl_mixer.stub.php -index 0ceef5e..05e5596 100644 ---- a/src/php_sdl_mixer.stub.php -+++ b/src/php_sdl_mixer.stub.php -@@ -76,5 +76,3 @@ function Mix_GetError(): string {} - /** @alias SDL_ClearError */ - function Mix_ClearError(): string {} - --final class Mix_Chunk {} --final class Mix_Music {} -diff --git a/src/php_sdl_mixer_arginfo.h b/src/php_sdl_mixer_arginfo.h -index 696df72..5af4cbc 100644 ---- a/src/php_sdl_mixer_arginfo.h -+++ b/src/php_sdl_mixer_arginfo.h -@@ -1,5 +1,5 @@ - /* This is a generated file, edit the .stub.php file instead. -- * Stub hash: 0dec727e1d30954b0817f144d4e81e938a9f2d3c */ -+ * Stub hash: 06f9569d612687e9fe0e904dcce9ebd88f9e6997 */ - - ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Mix_Init, 0, 1, IS_LONG, 0) - ZEND_ARG_TYPE_INFO(0, flags, IS_LONG, 0) -@@ -393,35 +393,3 @@ static const zend_function_entry ext_functions[] = { - ZEND_FALIAS(Mix_ClearError, SDL_ClearError, arginfo_Mix_ClearError) - ZEND_FE_END - }; -- -- --static const zend_function_entry class_Mix_Chunk_methods[] = { -- ZEND_FE_END --}; -- -- --static const zend_function_entry class_Mix_Music_methods[] = { -- ZEND_FE_END --}; -- --static zend_class_entry *register_class_Mix_Chunk(void) --{ -- zend_class_entry ce, *class_entry; -- -- INIT_CLASS_ENTRY(ce, "Mix_Chunk", class_Mix_Chunk_methods); -- class_entry = zend_register_internal_class_ex(&ce, NULL); -- class_entry->ce_flags |= ZEND_ACC_FINAL; -- -- return class_entry; --} -- --static zend_class_entry *register_class_Mix_Music(void) --{ -- zend_class_entry ce, *class_entry; -- -- INIT_CLASS_ENTRY(ce, "Mix_Music", class_Mix_Music_methods); -- class_entry = zend_register_internal_class_ex(&ce, NULL); -- class_entry->ce_flags |= ZEND_ACC_FINAL; -- -- return class_entry; --} - -From 159a86fb28f2f51da09d9ac7b378095aa23c3326 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Mon, 14 Mar 2022 11:14:39 +0100 -Subject: [PATCH 2/2] properly init/quit sdl_mixer library - ---- - src/php_sdl_mixer.c | 39 ++++++++++++++++++++++++++++++++++++++- - 1 file changed, 38 insertions(+), 1 deletion(-) - -diff --git a/src/php_sdl_mixer.c b/src/php_sdl_mixer.c -index 4707e04..9e5d7f8 100644 ---- a/src/php_sdl_mixer.c -+++ b/src/php_sdl_mixer.c -@@ -2,6 +2,7 @@ - #include "mixer.h" - #include "music.h" - #include "php_sdl_mixer_arginfo.h" -+#include "zend_smart_string.h" - - #ifdef COMPILE_DL_SDL_MIXER - ZEND_GET_MODULE(sdl_mixer) -@@ -9,9 +10,13 @@ ZEND_GET_MODULE(sdl_mixer) - - #define PHP_MINIT_CALL(func) PHP_MINIT(func)(INIT_FUNC_ARGS_PASSTHRU) - -+static int sld_mixer_flags; -+ - /* {{{ PHP_MINIT_FUNCTION */ - PHP_MINIT_FUNCTION(sdl_mixer) - { -+ sld_mixer_flags = Mix_Init(MIX_INIT_FLAC|MIX_INIT_MOD|MIX_INIT_MP3|MIX_INIT_OGG|MIX_INIT_MID|MIX_INIT_OPUS); -+ - php_mix_chunk_minit_helper(); - php_mix_music_minit_helper(); - -@@ -25,9 +30,19 @@ PHP_MINIT_FUNCTION(sdl_mixer) - } - /* }}} */ - -+/* {{{ PHP_MINIT_FUNCTION */ -+PHP_MSHUTDOWN_FUNCTION(sdl_mixer) -+{ -+ Mix_Quit(); -+ -+ return SUCCESS; -+} -+/* }}} */ -+ - PHP_MINFO_FUNCTION(sdl_mixer) - { - char buffer[128]; -+ smart_string info = {0}; - SDL_version compile_version; - const SDL_version *link_version = Mix_Linked_Version(); - SDL_MIXER_VERSION(&compile_version); -@@ -39,6 +54,28 @@ PHP_MINFO_FUNCTION(sdl_mixer) - php_info_print_table_row(2, "SDL_mixer linked version", buffer); - snprintf(buffer, sizeof(buffer), "%d.%d.%d", compile_version.major, compile_version.minor, compile_version.patch); - php_info_print_table_row(2, "SDL_mixer compiled version", buffer); -+ if (sld_mixer_flags & MIX_INIT_FLAC) { -+ smart_string_appends(&info, "flac"); -+ } -+ if (sld_mixer_flags & MIX_INIT_MOD) { -+ smart_string_appends(&info, ", mod"); -+ } -+ if (sld_mixer_flags & MIX_INIT_MP3) { -+ smart_string_appends(&info, ", mp3"); -+ } -+ if (sld_mixer_flags & MIX_INIT_OGG) { -+ smart_string_appends(&info, ", ogg"); -+ } -+ if (sld_mixer_flags & MIX_INIT_MID) { -+ smart_string_appends(&info, ", mid"); -+ } -+ if (sld_mixer_flags & MIX_INIT_OPUS) { -+ smart_string_appends(&info, ", opus"); -+ } -+ smart_string_0(&info); -+ php_info_print_table_row(2, "SDL_mixer flags", info.c); -+ smart_string_free(&info); -+ - php_info_print_table_end(); - } - -@@ -54,7 +91,7 @@ zend_module_entry sdl_mixer_module_entry = { - "SDL_mixer", - ext_functions, - PHP_MINIT(sdl_mixer), -- NULL, /* PHP_MSHUTDOWN - Module shutdown */ -+ PHP_MSHUTDOWN(sdl_mixer), - NULL, /* PHP_RINIT - Request initialization */ - NULL, /* PHP_RSHUTDOWN - Request shutdown */ - PHP_MINFO(sdl_mixer), -- cgit