summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2014-03-03 13:41:18 +0100
committerRemi Collet <fedora@famillecollet.com>2014-03-03 13:41:18 +0100
commit60957e364841bd307acd125878f9bd9952bf0261 (patch)
tree07d45ff6183e324c06d0b836c9fed9fe94cc2393
parentc641f53e1c55b35c66a8844b6749851e1a9c8632 (diff)
php-pecl-gearman: cleanups and rebuild
-rw-r--r--php-pecl-gearman.spec134
1 files changed, 89 insertions, 45 deletions
diff --git a/php-pecl-gearman.spec b/php-pecl-gearman.spec
index 3c574ec..9e7e298 100644
--- a/php-pecl-gearman.spec
+++ b/php-pecl-gearman.spec
@@ -1,6 +1,19 @@
-%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}}
+# spec file for php-pecl-gearman
+#
+# Copyright (c) 2011-2014 Remi Collet
+# Copyright (c) 2011 Paul Whalen
+#
+# License: MIT
+# http://opensource.org/licenses/MIT
+#
+# Please, preserve the changelog entries
+#
+%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d}
+%{!?__pecl: %global __pecl %{_bindir}/pecl}
+%{!?__php: %global __php %{_bindir}/php}
%global pecl_name gearman
+%global with_zts 0%{?__ztsphp:1}
%if 0%{?fedora} >= 12 && 0%{?fedora} <= 15
%global extver 0.8.3
@@ -16,56 +29,66 @@
%endif
-Name: php-pecl-gearman
-Version: %{extver}
-Release: 1%{?dist}.1
-Summary: PHP wrapper to libgearman
+Name: php-pecl-gearman
+Version: %{extver}
+Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+Summary: PHP wrapper to libgearman
-Group: Development/Tools
-License: PHP
-URL: http://gearman.org
-Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+Group: Development/Tools
+License: PHP
+URL: http://gearman.org
+Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: libgearman-devel > %{libver}
-BuildRequires: php-devel
-BuildRequires: php-pear
+BuildRequires: libgearman-devel > %{libver}
+BuildRequires: php-devel
+BuildRequires: php-pear
# Required by phpize
-BuildRequires: autoconf, automake, libtool
+BuildRequires: autoconf, automake, libtool
-Requires: php(zend-abi) = %{php_zend_api}
-Requires: php(api) = %{php_core_api}
-Requires(post): %{__pecl}
+Requires: php(zend-abi) = %{php_zend_api}
+Requires: php(api) = %{php_core_api}
+Requires(post): %{__pecl}
Requires(postun): %{__pecl}
-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: php-%{pecl_name} = %{version}
+Provides: php-%{pecl_name}%{?_isa} = %{version}
+Provides: php-pecl(%{pecl_name}) = %{version}
+Provides: php-pecl(%{pecl_name})%{?_isa} = %{version}
# Other third party repo stuff
-Obsoletes: php53-pecl-%{pecl_name}
-Obsoletes: php53u-pecl-%{pecl_name}
-Obsoletes: php54-pecl-%{pecl_name}
+Obsoletes: php53-pecl-%{pecl_name}
+Obsoletes: php53u-pecl-%{pecl_name}
+%if "%{php_version}" > "5.4"
+Obsoletes: php54-pecl-%{pecl_name}
+%endif
%if "%{php_version}" > "5.5"
-Obsoletes: php55u-pecl-%{pecl_name}
+Obsoletes: php55u-pecl-%{pecl_name}
+%endif
+%if "%{php_version}" > "5.6"
+Obsoletes: php56u-pecl-%{pecl_name}
%endif
-# Filter private shared
+%if 0%{?fedora} < 20
+# Filter shared private
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
%{?filter_setup}
+%endif
%description
This extension uses libgearman library to provide API for
communicating with gearmand, and writing clients and workers
+Documentation: http://php.net/gearman
+
%prep
%setup -q -c
+mv %{pecl_name}-%{version} NTS
-extver=$(sed -n '/#define PHP_GEARMAN_VERSION/{s/.* "//;s/".*$//;p}' %{pecl_name}-%{version}/php_gearman.h)
+extver=$(sed -n '/#define PHP_GEARMAN_VERSION/{s/.* "//;s/".*$//;p}' NTS/php_gearman.h)
if test "x${extver}" != "x%{version}"; then
: Error: Upstream version is ${extver}, expecting %{version}.
exit 1
@@ -76,51 +99,64 @@ cat >%{pecl_name}.ini <<EOF
extension=%{pecl_name}.so
EOF
-find %{pecl_name}-%{version} -type f -exec chmod -x {} \;
-cp -pr %{pecl_name}-%{version} %{pecl_name}-%{version}-zts
+find NTS -type f -exec chmod -x {} \;
+
+%if %{with_zts}
+cp -pr NTS ZTS
+%endif
%build
-cd %{pecl_name}-%{version}
+cd NTS
%{_bindir}/phpize
%configure --with-php-config=%{_bindir}/php-config
make %{?_smp_mflags}
-cd ../%{pecl_name}-%{version}-zts
+%if %{with_zts}
+cd ../ZTS
%{_bindir}/zts-phpize
%configure --with-php-config=%{_bindir}/zts-php-config
make %{?_smp_mflags}
+%endif
%install
rm -rf %{buildroot}
-make -C %{pecl_name}-%{version} \
- install INSTALL_ROOT=%{buildroot}
-
-make -C %{pecl_name}-%{version}-zts \
- install INSTALL_ROOT=%{buildroot}
+make -C NTS install INSTALL_ROOT=%{buildroot}
# Install XML package description
install -Dpm 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
# install config file
install -Dpm644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini
+
+%if %{with_zts}
+make -C ZTS install INSTALL_ROOT=%{buildroot}
install -Dpm644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini
+%endif
+# 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 LICENSE $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//')
+do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
+done
-%check
-# simple module load test
+%check
+: Minimal load test for NTS extension
%{__php} --no-php-ini \
- --define extension_dir=%{pecl_name}-%{version}/modules \
- --define extension=%{pecl_name}.so \
+ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
--modules | grep %{pecl_name}
+%if %{with_zts}
+: Minimal load test for ZTS extension
%{__ztsphp} --no-php-ini \
- --define extension_dir=%{pecl_name}-%{version}-zts/modules \
- --define extension=%{pecl_name}.so \
+ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
--modules | grep %{pecl_name}
+%endif
%clean
@@ -139,15 +175,23 @@ fi
%files
%defattr(-,root,root,-)
-%doc %{pecl_name}-%{version}/{ChangeLog,README,CREDITS,LICENSE}
+%doc %{pecl_docdir}/%{pecl_name}
+%doc %{pecl_testdir}/%{pecl_name}
%config(noreplace) %{php_inidir}/%{pecl_name}.ini
-%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini
%{php_extdir}/%{pecl_name}.so
-%{php_ztsextdir}/%{pecl_name}.so
%{pecl_xmldir}/%{name}.xml
+%if %{with_zts}
+%{php_ztsextdir}/%{pecl_name}.so
+%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini
+%endif
%changelog
+* Mon Mar 3 2014 Remi Collet <remi@fedoraproject.org> - 1.1.2-2
+- cleanups
+- install documentation in pecl_docdir
+- install tests in pecl_testdir
+
* Thu Aug 29 2013 Remi Collet <remi@fedoraproject.org> - 1.1.2-1
- update to 1.1.2