summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2013-12-03 07:27:15 +0100
committerRemi Collet <fedora@famillecollet.com>2013-12-03 07:27:15 +0100
commit14bec8651175874f3c87eaef8f4b7e73aa152e6e (patch)
tree4319048dcc4c7343ca3e2388af397e54e0668a56
parentbbe66175e041d07c561c623f6451b062374d7d38 (diff)
php-pecl-sdl: 0.9.2
-rw-r--r--example.php37
-rw-r--r--php-pecl-sdl.spec52
-rw-r--r--sdl-nts.patch50
3 files changed, 85 insertions, 54 deletions
diff --git a/example.php b/example.php
deleted file mode 100644
index 4ac324e..0000000
--- a/example.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * Example of how to change screen properties such as title, icon or state using the PHP-SDL extension.
- *
- * @author Santiago Lizardo <santiagolizardo@php.net>
- */
-
-// require 'common.php';
-
-SDL_Init( SDL_INIT_VIDEO );
-
-$screen = SDL_SetVideoMode( 640, 480, 16, SDL_HWSURFACE );
-if( null == $screen )
-{
- fprintf( STDERR, 'Error: %s' . PHP_EOL, SDL_GetError() );
-}
-
-for( $i = 3; $i > 0; $i-- )
-{
- SDL_WM_SetCaption( "Switching to fullscreen mode in $i seconds...", null );
- SDL_Delay( 1000 );
-}
-
-SDL_WM_ToggleFullscreen( $screen );
-
-SDL_Delay( 3000 );
-
-SDL_WM_ToggleFullscreen( $screen );
-
-SDL_WM_SetCaption( "Back from fullscreen mode. Quitting in 2 seconds...", null );
-
-SDL_Delay( 2000 );
-
-SDL_FreeSurface( $screen );
-
-SDL_Quit();
-
diff --git a/php-pecl-sdl.spec b/php-pecl-sdl.spec
index a40b79f..88d6799 100644
--- a/php-pecl-sdl.spec
+++ b/php-pecl-sdl.spec
@@ -6,7 +6,7 @@
#
# Please, preserve the changelog entries
#
-
+%{?scl: %scl_package php-pecl-sdl}
%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d}
%{!?__pecl: %global __pecl %{_bindir}/pecl}
%{!?__php: %global __php %{_bindir}/php}
@@ -16,36 +16,46 @@
%global pecl_name sdl
Summary: Simple DirectMedia Layer for PHP
-Name: php-pecl-sdl
-Version: 0.9.1
+Name: %{?scl_prefix}php-pecl-sdl
+Version: 0.9.2
Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
License: PHP
Group: Development/Languages
URL: http://pecl.php.net/package/sdl
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
-# From code-examples.tgz
-# From http://sourceforge.net/projects/phpsdl/files/
-Source1: example.php
+Patch0: %{pecl_name}-nts.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-BuildRequires: php-devel > 5.2.0
-BuildRequires: php-pear
-BuildRequires: SDL-devel
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+BuildRequires: %{?scl_prefix}php-devel > 5.2.0
+BuildRequires: %{?scl_prefix}php-pear
+BuildRequires: SDL-devel
Requires(post): %{__pecl}
Requires(postun): %{__pecl}
-Requires: php(zend-abi) = %{php_zend_api}
-Requires: php(api) = %{php_core_api}
+Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
+Requires: %{?scl_prefix}php(api) = %{php_core_api}
Requires: %{__php}
%if %{with_zts}
Requires: %{__ztsphp}
%endif
-Provides: php-%{pecl_name} = %{version}
-Provides: php-%{pecl_name}%{?_isa} = %{version}
-Provides: php-pecl(%{pecl_name}) = %{version}
-Provides: php-pecl(%{pecl_name})%{?_isa} = %{version}
+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}
+
+%if 0%{!?scl:1}
+# Other third party repo stuff
+%if "%{php_version}" > "5.4"
+Obsoletes: php53-pecl-%{pecl_name}
+Obsoletes: php53u-pecl-%{pecl_name}
+Obsoletes: php54-pecl-%{pecl_name}
+%endif
+%if "%{php_version}" > "5.5"
+Obsoletes: php55u-pecl-%{pecl_name}
+%endif
+%endif
%if 0%{?fedora} < 20
# filter private shared
@@ -65,6 +75,9 @@ Use the "phpsdl" command to launch a SDL application.
%setup -q -c
mv %{pecl_name}-%{version} NTS
+pushd NTS
+%patch0 -p2 -b .nts
+popd
cat << 'EOF' | tee phpsdl
#!/bin/sh
@@ -120,7 +133,7 @@ cd NTS
for i in $(grep 'role="test"' ../package.xml | sed -e 's/^.*name="//;s/".*$//')
do install -Dpm 644 $i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i
done
-for i in %{SOURCE1} $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//')
+for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//')
do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
done
@@ -168,6 +181,11 @@ fi
%changelog
+* Tue Dec 03 2013 Remi Collet <remi@fedoraproject.org> - 0.9.2-1
+- Update to 0.9.2 (beta)
+- adapt for SCL
+- add patch to fix NTS build
+
* Tue Nov 26 2013 Remi Collet <remi@fedoraproject.org> - 0.9.1-1
- Update to 0.9.1 (beta)
- drop build patch merged upstream
diff --git a/sdl-nts.patch b/sdl-nts.patch
new file mode 100644
index 0000000..b3f1598
--- /dev/null
+++ b/sdl-nts.patch
@@ -0,0 +1,50 @@
+From 1cee84967f929c37a4031ad8f17422ba63d0ef6e Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora@famillecollet.com>
+Date: Tue, 3 Dec 2013 07:08:48 +0100
+Subject: [PATCH] fix NTS build
+
+---
+ sdl/php_sdl_time.c | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/sdl/php_sdl_time.c b/sdl/php_sdl_time.c
+index 882897d..ad51d09 100644
+--- a/sdl/php_sdl_time.c
++++ b/sdl/php_sdl_time.c
+@@ -29,7 +29,9 @@ int le_timer;
+
+ typedef struct php_sdl_timer {
+ SDL_TimerID id;
+- long caller_thread_id;
++#ifdef ZTS
++ THREAD_T caller_thread_id;
++#endif
+ zend_fcall_info *cb_fci;
+ } php_sdl_timer_t;
+
+@@ -72,7 +74,9 @@ PHP_FUNCTION(sdl_delay)
+ Uint32 php_sdl_timer_callback(Uint32 interval, void *param)
+ {
+ php_sdl_timer_t *timer_data = (php_sdl_timer_t*)param;
++#ifdef ZTS
+ void ***tsrm_ls = (void ***) ts_resource_ex(0, &(timer_data->caller_thread_id));
++#endif
+ zval *cb_retval = NULL;
+
+ timer_data->cb_fci->retval_ptr_ptr = &cb_retval;
+@@ -125,10 +129,8 @@ PHP_FUNCTION(sdl_addtimer)
+ }
+
+ // We need the callers thread id for the callback to occur in the right thread
+-#ifdef ZTS
+- timer_data->caller_thread_id = (long)tsrm_thread_id();
+-#else
+- timer_data->caller_thread_id = (long)getpid();
++#ifdef ZTS
++ timer_data->caller_thread_id = tsrm_thread_id();
+ #endif
+
+ timer_data->id = SDL_AddTimer((Uint32)interval, php_sdl_timer_callback, (void*)timer_data);
+--
+1.8.3.1
+