diff options
author | Remi Collet <fedora@famillecollet.com> | 2013-10-26 08:17:51 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2013-10-26 08:17:51 +0200 |
commit | 7066d35959fcca745b29e347f8286882f0e27664 (patch) | |
tree | 68e2cc570b9af93cb16f9e0c707d6030b24d2f4c |
php-pecl-pthreads: 0.0.45 (stable) new package
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | php-pecl-pthreads.spec | 152 |
2 files changed, 156 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..13af741 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../../../common/Makefile + diff --git a/php-pecl-pthreads.spec b/php-pecl-pthreads.spec new file mode 100644 index 0000000..7454cd2 --- /dev/null +++ b/php-pecl-pthreads.spec @@ -0,0 +1,152 @@ +# spec file for php-pecl-pthreads +# +# Copyright (c) 2013 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/3.0/ +# +# Please, preserve the changelog entries +# +%{!?php_inidir: %{expand: %%global php_inidir %{_sysconfdir}/php.d}} +%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}} + +%global pecl_name pthreads + +Summary: Threading API +Name: php-pecl-%{pecl_name} +Version: 0.0.45 +Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +License: PHP +Group: Development/Languages +URL: http://pecl.php.net/package/%{pecl_name} +Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: php-zts-devel > 5.3 +BuildRequires: php-pear + +Requires(post): %{__pecl} +Requires(postun): %{__pecl} +Requires: php(zend-abi) = %{php_zend_api} +Requires: php(api) = %{php_core_api} + +Provides: php-%{pecl_name} = %{version} +Provides: php-%{pecl_name}%{?_isa} = %{version} +Provides: php-pecl(%{pecl_name}) = %{version} +Provides: php-pecl(%{pecl_name})%{?_isa} = %{version} + +# Filter shared private +%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} +%{?filter_setup} + + +%description +A compatible Threading API for PHP5.3+ + +This extension is only available for PHP in ZTS mode. + + +%prep +%setup -q -c + +# Fix roles +sed -e '/LICENSE/s/role="src"/role="doc"/' \ + -e '/README/s/role="src"/role="doc"/' \ + -i package.xml + +cd %{pecl_name}-%{version} +# Fix version +sed -e '/PHP_PTHREADS_VERSION/s/0.45-rc/%{version}/' -i php_pthreads.h + +# Sanity check, really often broken +extver=$(sed -n '/#define PHP_PTHREADS_VERSION/{s/.* "//;s/".*$//;p}' php_pthreads.h) +if test "x${extver}" != "x%{version}"; then + : Error: Upstream extension version is ${extver}, expecting %{version}. + exit 1 +fi +cd .. + +# Create configuration file +cat > %{pecl_name}.ini << 'EOF' +; Enable %{pecl_name} extension module +extension=%{pecl_name}.so +EOF + + +%build +cd %{pecl_name}-%{version} +%{_bindir}/zts-phpize +%configure \ + --with-php-config=%{_bindir}/zts-php-config +make %{?_smp_mflags} + + +%install +rm -rf %{buildroot} + +make -C %{pecl_name}-%{version} \ + install INSTALL_ROOT=%{buildroot} + +# install config file +install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini + +# Install XML package description +install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml + +# Test & Documentation +cd %{pecl_name}-%{version} +for i in $(grep 'role="test"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') +do sed -e 's/\r//' -i $i + install -Dpm 644 $i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i +done +for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') +do sed -e 's/\r//' -i $i + install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +done + + +%post +%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : + + +%postun +if [ $1 -eq 0 ] ; then + %{pecl_uninstall} %{pecl_name} >/dev/null || : +fi + + +%check +cd %{pecl_name}-%{version} + +# This one fails, need investigation +rm tests/gone.phpt + +# Minimal load test for ZTS extension +%{__ztsphp} --no-php-ini \ + --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ + --modules | grep %{pecl_name} + +# Upstream test suite for ZTS extension +TEST_PHP_EXECUTABLE=%{_bindir}/zts-php \ +TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ +NO_INTERACTION=1 \ +REPORT_EXIT_STATUS=1 \ +%{_bindir}/zts-php -n run-tests.php + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%doc %{pecl_docdir}/%{pecl_name} +%doc %{pecl_testdir}/%{pecl_name} +%{pecl_xmldir}/%{name}.xml +%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini +%{php_ztsextdir}/%{pecl_name}.so + + +%changelog +* Sat Oct 26 2013 Remi Collet <remi@fedoraproject.org> - 0.0.45-1 +- initial package, version 0.0.45 (stable) + open https://github.com/krakjoe/pthreads/pull/193 |