diff options
-rw-r--r-- | PHPINFO | 2 | ||||
-rw-r--r-- | REFLECTION | 2 | ||||
-rw-r--r-- | php-pecl-sdl-mixer.spec | 12 | ||||
-rw-r--r-- | sdl_mixer-build.patch | 466 |
4 files changed, 8 insertions, 474 deletions
@@ -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 @@ -1,4 +1,4 @@ -Extension [ <persistent> extension #121 SDL_mixer version 0.3.0 ] { +Extension [ <persistent> 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 <remi@remirepo.net> - 0.4.0-1 +- update to 0.4.0 +- drop all patches, all merged upstream + * Mon Mar 14 2022 Remi Collet <remi@remirepo.net> - 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 <remi@remirepo.net> -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 <remi@remirepo.net> -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 @@ - <?php - --/** @generate-class-entries */ -+/** -+ * @generate-function-entries -+ * @generate-class-entries -+ */ - - function Mix_Init(int $flags): int {} - function Mix_Quit(): void {} -@@ -42,7 +45,9 @@ function Mix_LoadMUS_RW(SDL_RWops $src, int $freesrc): Mix_Music {} - function Mix_FreeMusic(Mix_Music $music): void {} - function Mix_GetNumMusicDecoders(): int {} - function Mix_GetMusicDecoder(int $index): string {} -+#ifdef HAVE_MIX_HASMUSICDECODER - function Mix_HasMusicDecoder(string $name): bool {} -+#endif - function Mix_PlayMusic(Mix_Music $music, int $loops): int {} - function Mix_FadeInMusic(Mix_Music $music, int $loops, int $ms): int {} - function Mix_FadeInMusicPos(Mix_Music $music, int $loops, int $ms, float $position): int {} -diff --git a/src/php_sdl_mixer_arginfo.h b/src/php_sdl_mixer_arginfo.h -index 848f81a..696df72 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: 1a36e3ed90a9a7c0ff05a89516ad4bcec0ef0d44 */ -+ * Stub hash: 0dec727e1d30954b0817f144d4e81e938a9f2d3c */ - - 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) -@@ -168,7 +168,11 @@ ZEND_END_ARG_INFO() - - #define arginfo_Mix_GetMusicDecoder arginfo_Mix_GetChunkDecoder - --#define arginfo_Mix_HasMusicDecoder arginfo_Mix_HasChunkDecoder -+#if defined(HAVE_MIX_HASMUSICDECODER) -+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Mix_HasMusicDecoder, 0, 1, _IS_BOOL, 0) -+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) -+ZEND_END_ARG_INFO() -+#endif - - ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_Mix_PlayMusic, 0, 2, IS_LONG, 0) - ZEND_ARG_OBJ_INFO(0, music, Mix_Music, 0) -@@ -292,7 +296,9 @@ ZEND_FUNCTION(Mix_LoadMUS_RW); - ZEND_FUNCTION(Mix_FreeMusic); - ZEND_FUNCTION(Mix_GetNumMusicDecoders); - ZEND_FUNCTION(Mix_GetMusicDecoder); -+#if defined(HAVE_MIX_HASMUSICDECODER) - ZEND_FUNCTION(Mix_HasMusicDecoder); -+#endif - ZEND_FUNCTION(Mix_PlayMusic); - ZEND_FUNCTION(Mix_FadeInMusic); - ZEND_FUNCTION(Mix_FadeInMusicPos); -@@ -359,7 +365,9 @@ static const zend_function_entry ext_functions[] = { - ZEND_FE(Mix_FreeMusic, arginfo_Mix_FreeMusic) - ZEND_FE(Mix_GetNumMusicDecoders, arginfo_Mix_GetNumMusicDecoders) - ZEND_FE(Mix_GetMusicDecoder, arginfo_Mix_GetMusicDecoder) -+#if defined(HAVE_MIX_HASMUSICDECODER) - ZEND_FE(Mix_HasMusicDecoder, arginfo_Mix_HasMusicDecoder) -+#endif - ZEND_FE(Mix_PlayMusic, arginfo_Mix_PlayMusic) - ZEND_FE(Mix_FadeInMusic, arginfo_Mix_FadeInMusic) - ZEND_FE(Mix_FadeInMusicPos, arginfo_Mix_FadeInMusicPos) -From 076920930c3cc6b2f347d9f5c860412ced13938d Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@remirepo.net> -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 @@ -+<?php -+ -+/** -+ * @generate-class-entries -+ */ -+ -+final class Mix_Chunk {} -+ -diff --git a/src/Mix_Chunk_arginfo.h b/src/Mix_Chunk_arginfo.h -new file mode 100644 -index 0000000..4ba7331 ---- /dev/null -+++ b/src/Mix_Chunk_arginfo.h -@@ -0,0 +1,20 @@ -+/* This is a generated file, edit the .stub.php file instead. -+ * Stub hash: 4d3739c322fe06235f1b4d21c5ad9a8b3bf45f02 */ -+ -+ -+ -+ -+static const zend_function_entry class_Mix_Chunk_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; -+} -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 @@ -+<?php -+ -+/** -+ * @generate-class-entries -+ */ -+ -+final class Mix_Music {} -+ -diff --git a/src/Mix_Music_arginfo.h b/src/Mix_Music_arginfo.h -new file mode 100644 -index 0000000..c0fb1e9 ---- /dev/null -+++ b/src/Mix_Music_arginfo.h -@@ -0,0 +1,20 @@ -+/* This is a generated file, edit the .stub.php file instead. -+ * Stub hash: c6b5d170cc55f739aa2b0cb08eae7d8d2bb45404 */ -+ -+ -+ -+ -+static const zend_function_entry class_Mix_Music_methods[] = { -+ ZEND_FE_END -+}; -+ -+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; -+} -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 <php.h> - #include <ext/standard/info.h> - #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 <remi@remirepo.net> -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), |