summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore9
-rw-r--r--Makefile8
-rw-r--r--PHPINFO8
-rw-r--r--REFLECTION521
-rw-r--r--php-pecl-sdl-mixer.spec206
-rw-r--r--sdl_mixer-build.patch466
6 files changed, 1218 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..01f0400
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+clog
+package-*.xml
+*.tgz
+*.tar.bz2
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..9e525a3
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,8 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../../common/Makefile
+
+refl:
+ php -d extension=sdl -d extension=sdl_mixer --re sdl_mixer >REFLECTION
+ php -d extension=sdl -d extension=sdl_mixer --ri sdl_mixer >PHPINFO
+
diff --git a/PHPINFO b/PHPINFO
new file mode 100644
index 0000000..2bf8697
--- /dev/null
+++ b/PHPINFO
@@ -0,0 +1,8 @@
+
+SDL_mixer
+
+SDL_mixer support => enabled
+SDL_mixer PHP extension version => 0.3.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
new file mode 100644
index 0000000..ec69dde
--- /dev/null
+++ b/REFLECTION
@@ -0,0 +1,521 @@
+Extension [ <persistent> extension #121 SDL_mixer version 0.3.0 ] {
+
+ - Dependencies {
+ Dependency [ sdl (Required) ]
+ }
+
+ - Constants [5] {
+ Constant [ int MIX_DEFAULT_CHANNELS ] { 2 }
+ Constant [ int MIX_DEFAULT_FREQUENCY ] { 22050 }
+ Constant [ int MIX_DEFAULT_FORMAT ] { 32784 }
+ Constant [ int MIX_MAX_VOLUME ] { 128 }
+ Constant [ int MIX_CHANNELS ] { 8 }
+ }
+
+ - Functions {
+ Function [ <internal:SDL_mixer> function Mix_Init ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $flags ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_Quit ] {
+
+ - Parameters [0] {
+ }
+ - Return [ void ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_OpenAudio ] {
+
+ - Parameters [4] {
+ Parameter #0 [ <required> int $frequency ]
+ Parameter #1 [ <required> int $format ]
+ Parameter #2 [ <required> int $channels ]
+ Parameter #3 [ <required> int $chunksize ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_OpenAudioDevice ] {
+
+ - Parameters [6] {
+ Parameter #0 [ <required> int $frequency ]
+ Parameter #1 [ <required> int $format ]
+ Parameter #2 [ <required> int $channels ]
+ Parameter #3 [ <required> int $chunksize ]
+ Parameter #4 [ <required> string $device ]
+ Parameter #5 [ <required> int $allowed_changes ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_AllocateChannels ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $numchans ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_QuerySpec ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> int &$frequency ]
+ Parameter #1 [ <required> int &$format ]
+ Parameter #2 [ <required> int &$channels ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_LoadWAV_RW ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> SDL_RWops $src ]
+ Parameter #1 [ <required> int $freesrc ]
+ }
+ - Return [ Mix_Chunk ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_LoadWAV ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> string $file ]
+ }
+ - Return [ Mix_Chunk ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_FreeChunk ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> Mix_Chunk $chunk ]
+ }
+ - Return [ void ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_GetNumChunkDecoders ] {
+
+ - Parameters [0] {
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_GetChunkDecoder ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $index ]
+ }
+ - Return [ string ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_HasChunkDecoder ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> string $name ]
+ }
+ - Return [ bool ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_ReserveChannels ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $num ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_GroupChannel ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> int $which ]
+ Parameter #1 [ <required> int $tag ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_GroupChannels ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> int $from ]
+ Parameter #1 [ <required> int $to ]
+ Parameter #2 [ <required> int $tag ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_GroupAvailable ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $tag ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_GroupCount ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $tag ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_GroupOldest ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $tag ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_GroupNewer ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $tag ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_PlayChannel ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> int $channel ]
+ Parameter #1 [ <required> Mix_Chunk $chunk ]
+ Parameter #2 [ <required> int $loops ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_PlayChannelTimed ] {
+
+ - Parameters [4] {
+ Parameter #0 [ <required> int $channel ]
+ Parameter #1 [ <required> Mix_Chunk $chunk ]
+ Parameter #2 [ <required> int $loops ]
+ Parameter #3 [ <required> int $ticks ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_FadeInChannelTimed ] {
+
+ - Parameters [5] {
+ Parameter #0 [ <required> int $channel ]
+ Parameter #1 [ <required> Mix_Chunk $chunk ]
+ Parameter #2 [ <required> int $loops ]
+ Parameter #3 [ <required> int $ms ]
+ Parameter #4 [ <required> int $ticks ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_Volume ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> int $channel ]
+ Parameter #1 [ <required> int $volume ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_VolumeChunk ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> Mix_Chunk $chunk ]
+ Parameter #1 [ <required> int $volume ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_HaltChannel ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $channel ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_HaltGroup ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $tag ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_ExpireChannel ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> int $channel ]
+ Parameter #1 [ <required> int $ticks ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_FadeOutChannel ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> int $which ]
+ Parameter #1 [ <required> int $ms ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_FadeOutGroup ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> int $tag ]
+ Parameter #1 [ <required> int $ms ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_Pause ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $channel ]
+ }
+ - Return [ void ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_Resume ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $channel ]
+ }
+ - Return [ void ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_Paused ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $channel ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_Playing ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $channel ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_GetChunk ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $channel ]
+ }
+ - Return [ Mix_Chunk ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_CloseAudio ] {
+
+ - Parameters [0] {
+ }
+ - Return [ void ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_LoadMUS ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> string $file ]
+ }
+ - Return [ Mix_Music ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_LoadMUS_RW ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> SDL_RWops $src ]
+ Parameter #1 [ <required> int $freesrc ]
+ }
+ - Return [ Mix_Music ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_FreeMusic ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> Mix_Music $music ]
+ }
+ - Return [ void ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_GetNumMusicDecoders ] {
+
+ - Parameters [0] {
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_GetMusicDecoder ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $index ]
+ }
+ - Return [ string ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_PlayMusic ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> Mix_Music $music ]
+ Parameter #1 [ <required> int $loops ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_FadeInMusic ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> Mix_Music $music ]
+ Parameter #1 [ <required> int $loops ]
+ Parameter #2 [ <required> int $ms ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_FadeInMusicPos ] {
+
+ - Parameters [4] {
+ Parameter #0 [ <required> Mix_Music $music ]
+ Parameter #1 [ <required> int $loops ]
+ Parameter #2 [ <required> int $ms ]
+ Parameter #3 [ <required> float $position ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_VolumeMusic ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $volume ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_HaltMusic ] {
+
+ - Parameters [0] {
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_FadeOutMusic ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $ms ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_PauseMusic ] {
+
+ - Parameters [0] {
+ }
+ - Return [ void ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_ResumeMusic ] {
+
+ - Parameters [0] {
+ }
+ - Return [ void ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_RewindMusic ] {
+
+ - Parameters [0] {
+ }
+ - Return [ void ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_PausedMusic ] {
+
+ - Parameters [0] {
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_SetMusicPosition ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> float $position ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_PlayingMusic ] {
+
+ - Parameters [0] {
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_SetMusicCMD ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> string $command ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_SetSynchroValue ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> int $value ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_GetSynchroValue ] {
+
+ - Parameters [0] {
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_SetSoundFonts ] {
+
+ - Parameters [1] {
+ Parameter #0 [ <required> string $paths ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_GetSoundFonts ] {
+
+ - Parameters [0] {
+ }
+ - Return [ string ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_SetPosition ] {
+
+ - Parameters [3] {
+ Parameter #0 [ <required> int $channel ]
+ Parameter #1 [ <required> int $angle ]
+ Parameter #2 [ <required> int $distance ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_SetDistance ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> int $channel ]
+ Parameter #1 [ <required> int $distance ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_SetReverseStereo ] {
+
+ - Parameters [2] {
+ Parameter #0 [ <required> int $channel ]
+ Parameter #1 [ <required> int $flip ]
+ }
+ - Return [ int ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_SetError ] {
+
+ - Parameters [0] {
+ }
+ - Return [ string ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_GetError ] {
+
+ - Parameters [0] {
+ }
+ - Return [ string ]
+ }
+ Function [ <internal:SDL_mixer> function Mix_ClearError ] {
+
+ - Parameters [0] {
+ }
+ - Return [ string ]
+ }
+ }
+
+ - Classes [2] {
+ Class [ <internal:SDL_mixer> final class Mix_Chunk ] {
+
+ - Constants [0] {
+ }
+
+ - Static properties [0] {
+ }
+
+ - Static methods [0] {
+ }
+
+ - Properties [0] {
+ }
+
+ - Methods [0] {
+ }
+ }
+
+ Class [ <internal:SDL_mixer> final class Mix_Music ] {
+
+ - Constants [0] {
+ }
+
+ - Static properties [0] {
+ }
+
+ - Static methods [0] {
+ }
+
+ - Properties [0] {
+ }
+
+ - Methods [0] {
+ }
+ }
+ }
+}
+
diff --git a/php-pecl-sdl-mixer.spec b/php-pecl-sdl-mixer.spec
new file mode 100644
index 0000000..4405678
--- /dev/null
+++ b/php-pecl-sdl-mixer.spec
@@ -0,0 +1,206 @@
+# remirepo spec file for php-pecl-sdl-mixer
+#
+# Copyright (c) 2022 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+
+# we don't want -z defs linker flag
+%undefine _strict_symbol_defs_build
+
+%if 0%{?scl:1}
+%scl_package php-pecl-sdl-mixer
+%endif
+
+%bcond_with tests
+%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
+%global pecl_name sdl_mixer
+# no ini file (loaded by phpsdl helper)
+
+%global upstream_version 0.3.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: 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
+BuildRequires: %{?scl_prefix}php-sdl >= 2.5.0
+BuildRequires: %{?scl_prefix}php-pear
+BuildRequires: SDL2_mixer-devel
+
+Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
+Requires: %{?scl_prefix}php(api) = %{php_core_api}
+BuildRequires: %{?scl_prefix}php-sdl%{?_isa} >= 2.5.0
+%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}}
+
+Provides: %{?scl_prefix}php-%{pecl_name} = %{version}
+Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version}
+Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version}
+Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version}
+# Notice pecl_name != name
+Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release}
+Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release}
+
+%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
+# Other third party repo stuff
+Obsoletes: php80-pecl-%{pecl_name} <= %{version}
+%if "%{php_version}" > "8.1"
+Obsoletes: php81-pecl-%{pecl_name} <= %{version}
+%endif
+%endif
+
+
+%description
+SDL_mixer extension for PHP provides the binding of functions for audio
+loading, playing and mixing.
+
+Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}.
+
+
+%prep
+%setup -qc
+mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS
+
+# Don't install/register tests
+sed -e 's/role="test"/role="src"/' \
+ %{?_licensedir:-e '/LICENSE/s/role="doc"/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
+ : Error: Upstream version is ${extver}, expecting %{upstream_version}%{?upstream_prever}%{?gh_date:-dev}.
+ exit 1
+fi
+cd ..
+
+
+%if %{with_zts}
+# duplicate for ZTS build
+cp -pr NTS ZTS
+%endif
+
+
+%build
+%{?dtsenable}
+
+peclconf() {
+%configure \
+ --enable-sdl_mixer \
+ --with-php-config=$1
+}
+
+cd NTS
+%{_bindir}/phpize
+peclconf %{_bindir}/php-config
+make %{?_smp_mflags}
+
+%if %{with_zts}
+cd ../ZTS
+%{_bindir}/zts-phpize
+peclconf %{_bindir}/zts-php-config
+make %{?_smp_mflags}
+%endif
+
+
+%install
+%{?dtsenable}
+
+# Install the NTS stuff
+make -C NTS install INSTALL_ROOT=%{buildroot}
+
+# Install XML package description
+install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
+
+# Install the ZTS stuff
+%if %{with_zts}
+make -C ZTS install INSTALL_ROOT=%{buildroot}
+%endif
+
+# Documentation
+for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//')
+do [ -f NTS/$i ] && install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
+done
+
+
+%check
+: Minimal load test for NTS extension
+%{_bindir}/php --no-php-ini \
+ --define extension=sdl \
+ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
+ --modules | grep -i '^%{pecl_name}$'
+
+%if %{with_zts}
+: Minimal load test for ZTS extension
+%{__ztsphp} --no-php-ini \
+ --define extension=sdl \
+ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
+ --modules | grep -i '^%{pecl_name}$'
+
+%endif
+
+%if %{with tests}
+cd NTS
+: Run upstream test suite
+# ignore deprecated (in SDL 2.5.0)
+TEST_PHP_ARGS="-n -d error_reporting=24575 -d extension=sdl -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \
+%{__php} -n run-tests.php -q --show-diff
+%endif
+
+
+%if 0%{?fedora} < 24 && 0%{?rhel} < 8
+# when pear installed alone, after us
+%triggerin -- %{?scl_prefix}php-pear
+if [ -x %{__pecl} ] ; then
+ %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
+fi
+
+# posttrans as pear can be installed after us
+%posttrans
+if [ -x %{__pecl} ] ; then
+ %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
+fi
+
+%postun
+if [ $1 -eq 0 -a -x %{__pecl} ] ; then
+ %{pecl_uninstall} %{pecl_name} >/dev/null || :
+fi
+%endif
+
+
+%files
+%{?_licensedir:%license NTS/LICENSE}
+%doc %{pecl_docdir}/%{pecl_name}
+%{pecl_xmldir}/%{name}.xml
+
+%{php_extdir}/%{pecl_name}.so
+
+%if %{with_zts}
+%{php_ztsextdir}/%{pecl_name}.so
+%endif
+
+
+%changelog
+* Mon Mar 14 2022 Remi Collet <remi@remirepo.net> - 0.3.0-1
+- initial package
+- open https://github.com/kea/php-sdl-mixer/pull/3
+ SDL is required
+- open https://github.com/kea/php-sdl-mixer/pull/4
+ check if Mix_HasMusicDecoder is available
+- open https://github.com/kea/php-sdl-mixer/pull/5
+ split arginfo and properly init/quit library
diff --git a/sdl_mixer-build.patch b/sdl_mixer-build.patch
new file mode 100644
index 0000000..cb22e35
--- /dev/null
+++ b/sdl_mixer-build.patch
@@ -0,0 +1,466 @@
+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),