From 69a4c5cd24b3ac71140ca6bb3a2eadaba15f137c Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 17 Mar 2014 08:52:01 +0100 Subject: php-pecl-haru: cleanups, doc in pecl_docdir --- php-pecl-haru.spec | 96 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 63 insertions(+), 33 deletions(-) diff --git a/php-pecl-haru.spec b/php-pecl-haru.spec index 4da24d4..e8a1c07 100644 --- a/php-pecl-haru.spec +++ b/php-pecl-haru.spec @@ -1,12 +1,23 @@ -%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}} -%global pecl_name haru +# spec file for php-pecl-haru +# +# Copyright (c) 2012-2014 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} +%{!?__php: %global __php %{_bindir}/php} + +%global pecl_name haru +%global with_zts 0%{?__ztsphp:1} Summary: Haru PDF functions Name: php-pecl-haru Version: 1.0.4 -Release: 1%{?dist}.2 +Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} -# https://bugs.php.net/60958 - Please Provides LICENSE file License: PHP Group: Development/Languages URL: http://pecl.php.net/package/haru @@ -31,7 +42,24 @@ Provides: php-%{pecl_name}%{?_isa} = %{version} Provides: php-pecl(%{pecl_name}) = %{version} Provides: php-pecl(%{pecl_name})%{?_isa} = %{version} +%if "%{?vendor}" == "Remi Collet" +# Other third party repo stuff +Obsoletes: php53-pecl-%{pecl_name} +Obsoletes: php53u-pecl-%{pecl_name} +Obsoletes: php54-pecl-%{pecl_name} +%if "%{php_version}" > "5.5" +Obsoletes: php55u-pecl-%{pecl_name} +%endif +%if "%{php_version}" > "5.6" +Obsoletes: php56u-pecl-%{pecl_name} +%endif +%endif + +%if 0%{?fedora} < 20 +# Filter shared private +%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} %{?filter_setup} +%endif %description @@ -45,6 +73,7 @@ Documentation : http://www.php.net/haru %prep %setup -c -q +mv %{pecl_name}-%{version} NTS # Create configuration file cat >%{pecl_name}.ini << 'EOF' @@ -53,30 +82,30 @@ extension=%{pecl_name}.so EOF # Check extension version -extver=$(sed -n '/#define PHP_HARU_VERSION/{s/.* "//;s/".*$//;p}' %{pecl_name}-%{version}/php_haru.h) +extver=$(sed -n '/#define PHP_HARU_VERSION/{s/.* "//;s/".*$//;p}' NTS/php_haru.h) if test "x${extver}" != "x%{version}"; then : Error: Upstream extension version is ${extver}, expecting %{version}. exit 1 fi -%if 0%{?__ztsphp:1} +%if %{with_zts} # Build ZTS extension if ZTS devel available (fedora >= 17) -cp -r %{pecl_name}-%{version} %{pecl_name}-zts +cp -r NTS ZTS %endif %build export PHP_RPATH=no -cd %{pecl_name}-%{version} +cd NTS %{_bindir}/phpize %configure \ --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/php-config make %{?_smp_mflags} -%if 0%{?__ztsphp:1} -cd ../%{pecl_name}-zts +%if %{with_zts} +cd ../ZTS %{_bindir}/zts-phpize %configure \ --with-libdir=%{_lib} \ @@ -87,21 +116,25 @@ make %{?_smp_mflags} %install rm -rf %{buildroot} -make install -C %{pecl_name}-%{version} \ - INSTALL_ROOT=%{buildroot} - -%if 0%{?__ztsphp:1} -make install -C %{pecl_name}-zts \ - INSTALL_ROOT=%{buildroot} +make install -C NTS INSTALL_ROOT=%{buildroot} # Drop in the bit of configuration +install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini + +%if %{with_zts} +make install -C ZTS INSTALL_ROOT=%{buildroot} + install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini %endif -install -D -m 644 %{pecl_name}.ini %{buildroot}%{_sysconfdir}/php.d/%{pecl_name}.ini # Install XML package description install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml +# Test & Documentation +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 + %clean rm -rf %{buildroot} @@ -118,40 +151,38 @@ fi %check -cd %{pecl_name}-%{version} - -# only check if build extension can be loaded -php -n -q \ - -d extension_dir=modules \ - -d extension=%{pecl_name}.so \ +: Check if build NTS extension can be loaded +%{__php} -n -q \ + -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ --modules | grep %{pecl_name} -%if 0%{?__ztsphp:1} -cd ../%{pecl_name}-zts - -# only check if build extension can be loaded +%if %{with_zts} +: Check if build ZTS extension can be loaded %{__ztsphp} -n -q \ - -d extension_dir=modules \ - -d extension=%{pecl_name}.so \ + -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ --modules | grep %{pecl_name} %endif %files %defattr(-, root, root, -) -%doc %{pecl_name}-%{version}/CREDITS +%doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml %config(noreplace) %{_sysconfdir}/php.d/%{pecl_name}.ini %{php_extdir}/%{pecl_name}.so -%if 0%{?__ztsphp:1} +%if %{with_zts} %config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini %{php_ztsextdir}/%{pecl_name}.so %endif %changelog +* Mon Mar 17 2014 Remi Collet - 1.0.4-2 +- cleanups +- install doc in pecl_docdir + * Mon Dec 24 2012 Remi Collet - 1.0.4-1 - update to 1.0.4 - also provides php-haru @@ -162,5 +193,4 @@ cd ../%{pecl_name}-zts * Thu Feb 02 2012 Remi Collet - 1.0.3-1 - Initial RPM - https://bugs.php.net/60958 - Please Provides LICENSE file -- https://bugs.php.net/60959 - Version 1.0.3 reports as 1.0.1 - +- https://bugs.php.net/60959 - Version 1.0.3 reports as 1.0.1 \ No newline at end of file -- cgit