[php-zmq] Latest upstream with a total specfile rewrite from Remi Collet.

Ralph Bean ralph at fedoraproject.org
Thu Oct 24 18:33:51 UTC 2013


commit 12f74433cdf5ee14a531092c1278190a28688480
Author: Ralph Bean <rbean at redhat.com>
Date:   Thu Oct 24 14:33:49 2013 -0400

    Latest upstream with a total specfile rewrite from Remi Collet.

 .gitignore   |    1 +
 php-zmq.spec |  216 +++++++++++++++++++++++++++++++++++++++++++++++-----------
 sources      |    2 +-
 3 files changed, 178 insertions(+), 41 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 16f43ae..92c627d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 /php-zmq-0.6.0-2.20120613git516bd6f.tar.gz
+/zmq-1.0.8.tgz
diff --git a/php-zmq.spec b/php-zmq.spec
index a9b8804..ebd683e 100644
--- a/php-zmq.spec
+++ b/php-zmq.spec
@@ -1,63 +1,199 @@
-# Define version and release number
-%global version 0.6.0
+# spec file for php-zmq
+#
+# Copyright (c) 2013 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/3.0/
+#
+# Please, preserve the changelog entries
+#
+%{!?php_inidir:  %global php_inidir  %{_sysconfdir}/php.d}
+%{!?__pecl:      %global __pecl      %{_bindir}/pecl}
+
+%global with_zts   0%{?__ztsphp:1}
+%global pecl_name  zmq
+%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
+
+Summary:        ZeroMQ messaging
+Name:           php-%{pecl_name}
+Version:        1.0.8
+Release:        1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+License:        BSD
+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-devel > 5.2
+BuildRequires:  php-pear
+%if 0%{?fedora} >= 17 || 0%{?rhel} >= 6
+BuildRequires:  zeromq3-devel
+%else
+BuildRequires:  zeromq-devel >= 2.0.7
+%endif
+# needed on EL-5
+BuildRequires: pkgconfig
+
+Requires(post): %{__pecl}
+Requires(postun): %{__pecl}
+Requires:       php(zend-abi) = %{php_zend_api}
+Requires:       php(api) = %{php_core_api}
+
+# 1.0.7 is the first pecl release.
+Obsoletes:      php-%{pecl_name} < 1.0.7
+Provides:       php-%{pecl_name} = %{version}
+Provides:       php-%{pecl_name}%{?_isa} = %{version}
+Provides:       php-pecl(%{pecl_name}) = %{version}
+Provides:       php-pecl(%{pecl_name})%{?_isa} = %{version}
+
+%if 0%{?fedora} < 20
+# Filter shared private
+%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
+%{?filter_setup}
+%endif
 
-# Temporarily using git checkout since the release version won't build anymore.
-%global release 11.20120613git516bd6f
 
-Name:          php-zmq
-Version:       %{version}
-Release:       %{release}%{?dist}
-Summary:       PHP 0MQ/zmq/zeromq extension
-# See https://github.com/mkoppanen/php-zmq/pull/58 for discussion
-License:       BSD
-Group:         Development/Libraries
-URL:           http://github.com/mkoppanen/php-zmq
-Source:        php-zmq-0.6.0-2.20120613git516bd6f.tar.gz
+%description
+ZeroMQ is a software library that lets you quickly design and implement
+a fast message-based applications.
 
-BuildRequires: php-devel
-BuildRequires: php-cli
-BuildRequires: zeromq3-devel
 
-Requires:      php(zend-abi) = %{php_zend_api}
-Requires:      php(api) = %{php_core_api}
-Requires:      zeromq3
+%prep
+%setup -q -c
 
-%filter_from_provides /^zmq.so/d
-%filter_setup
+mv %{pecl_name}-%{version} NTS
 
-%description
-PHP extension for the 0MQ/zmq/zeromq messaging system
+%if %{with_zts}
+# Duplicate source tree for NTS / ZTS build
+cp -pr NTS ZTS
+%endif
 
-Uses zeromq3.
+# Create configuration file
+cat << 'EOF' | tee  %{pecl_name}.ini
+; Enable %{summary} extension module
+extension=%{pecl_name}.so
+EOF
 
-%prep
-%setup -q -n php-zmq
 
 %build
-/usr/bin/phpize
-%configure
-%{__make} %{?_smp_mflags}
+cd NTS
+%{_bindir}/phpize
+%configure \
+    --with-zmq \
+    --with-libdir=%{_lib} \
+    --with-php-config=%{_bindir}/php-config
+make %{?_smp_mflags}
+
+%if %{with_zts}
+cd ../ZTS
+%{_bindir}/zts-phpize
+%configure \
+    --with-zmq \
+    --with-libdir=%{_lib} \
+    --with-php-config=%{_bindir}/zts-php-config
+make %{?_smp_mflags}
+%endif
+
 
 %install
-%{__make} install INSTALL_ROOT=%{buildroot}
+rm -rf %{buildroot}
+
+make -C NTS \
+     install INSTALL_ROOT=%{buildroot}
+
+# install config file
+install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini
+
+# Install XML package description
+install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
+
+%if %{with_zts}
+make -C ZTS \
+     install INSTALL_ROOT=%{buildroot}
+
+install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini
+%endif
 
-# Create the ini location
-%{__mkdir} -p %{buildroot}/%{_sysconfdir}/php.d
+# Test & Documentation
+for i in $(grep 'role="test"' package.xml | sed -e 's/^.*name="//;s/".*$//')
+do install -Dpm 644 NTS/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i
+done
+for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//')
+do install -Dpm 644 NTS/$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
 
-# Preliminary extension ini
-echo "extension=zmq.so" > %{buildroot}/%{_sysconfdir}/php.d/zmq.ini
 
 %check
-NO_INTERACTION=1 \
-REPORT_EXIT_STATUS=1 \
-make test
+cd NTS
+: Minimal load test for NTS extension
+php --no-php-ini \
+    --define extension=%{buildroot}/%{php_extdir}/%{pecl_name}.so \
+    --modules | grep %{pecl_name}
+
+%if %{with_tests}
+: upstream test suite for NTS extension
+export TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so"
+export REPORT_EXIT_STATUS=1
+export NO_INTERACTION=1
+export TEST_PHP_EXECUTABLE=%{_bindir}/php
+%{_bindir}/php -n run-tests.php
+%endif
+
+%if %{with_zts}
+cd ../ZTS
+: Minimal load test for ZTS extension
+%{__ztsphp} --no-php-ini \
+    --define extension=%{buildroot}/%{php_ztsextdir}/%{pecl_name}.so \
+    --modules | grep %{pecl_name}
+
+%if %{with_tests}
+: upstream test suite for ZTS extension
+export TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so"
+export TEST_PHP_EXECUTABLE=%{_bindir}/zts-php
+%{_bindir}/zts-php -n run-tests.php
+%endif
+%endif
+
+
+%clean
+rm -rf %{buildroot}
+
 
 %files
-%doc README LICENSE
-%{_libdir}/php/modules/zmq.so
-%config(noreplace) %{_sysconfdir}/php.d/zmq.ini
+%defattr(-,root,root,-)
+%doc %{pecl_docdir}/%{pecl_name}
+%doc %{pecl_testdir}/%{pecl_name}
+%{pecl_xmldir}/%{name}.xml
+%config(noreplace) %{php_inidir}/%{pecl_name}.ini
+%{php_extdir}/%{pecl_name}.so
+
+%if %{with_zts}
+%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini
+%{php_ztsextdir}/%{pecl_name}.so
+%endif
+
 
 %changelog
+* Thu Oct 24 2013 Remi Collet <remi at fedoraproject.org> - 1.0.8-1
+- Update to 1.0.8
+- run upstream test suite during build
+- install tests in pecl test_dir
+
+* Thu Oct 24 2013 Remi Collet <remi at fedoraproject.org> - 1.0.7-1
+- initial package, version 1.0.7 (beta)
+- open https://github.com/mkoppanen/php-zmq/pull/108
+  to fix build warnings and include tests
+- rewrite spec file.
+
 * Sun Aug 04 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.6.0-11.20120613git516bd6f
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 
diff --git a/sources b/sources
index 4389a1c..8715f1c 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-9a2007974f3392ce0b6ee11d556237c8  php-zmq-0.6.0-2.20120613git516bd6f.tar.gz
+430ffc9827aa7653b7092f4175c01693  zmq-1.0.8.tgz


More information about the scm-commits mailing list