From 3716de76b90abb325ec516b08f5f34a3e9f0db68 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 8 Dec 2015 18:34:56 +0100 Subject: php-smbclient: this is now a pecl package --- php-smbclient.spec | 115 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 84 insertions(+), 31 deletions(-) (limited to 'php-smbclient.spec') diff --git a/php-smbclient.spec b/php-smbclient.spec index e1298b6..0031593 100644 --- a/php-smbclient.spec +++ b/php-smbclient.spec @@ -18,8 +18,8 @@ %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner eduardok %global gh_project libsmbclient-php -%global gh_date 20150909 -%global prever -rc1 +#global gh_date 20150909 +%global prever RC1 %{?scl: %scl_package php-smbclient} %{!?scl: %global pkg_name %{name}} @@ -27,32 +27,37 @@ %{!?__pecl: %global __pecl %{_bindir}/pecl} %{!?__php: %global __php %{_bindir}/php} -%global ext_name smbclient +%global pecl_name smbclient %global with_zts 0%{?__ztsphp:1} %if "%{php_version}" < "5.6" -%global ini_name %{ext_name}.ini +%global ini_name %{pecl_name}.ini %else -%global ini_name 40-%{ext_name}.ini +%global ini_name 40-%{pecl_name}.ini %endif # Test suite requires a Samba server and configuration file %global with_tests 0%{?_with_tests:1} Name: %{?sub_prefix}php-smbclient Version: 0.8.0 -Release: 0.4.rc1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 0.5.%{prever}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Summary: PHP wrapper for libsmbclient Group: Development/Languages License: BSD URL: https://github.com/eduardok/libsmbclient-php +%if 0%{?ghdate} Source0: %{pkg_name}-%{version}-%{gh_short}.tgz # git snapshot as upstream doesn't provide test suite Source1: makesrc.sh +%else +Source0: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz +%endif %if %{with_tests} Source2: %{gh_project}-phpunit.xml %endif BuildRequires: %{?scl_prefix}php-devel +BuildRequires: %{?scl_prefix}php-pear BuildRequires: libsmbclient-devel > 3.6 %if %{with_tests} BuildRequires: php-composer(phpunit/phpunit) @@ -63,27 +68,37 @@ Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} %{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} # Rename -Obsoletes: %{?sub_prefix}php-libsmbclient < 0.8.0-0.2 -Provides: %{?sub_prefix}php-libsmbclient = %{version}-%{release} -Provides: %{?sub_prefix}php-libsmbclient%{?_isa} = %{version}-%{release} +Obsoletes: %{?sub_prefix}php-libsmbclient < 0.8.0-0.2 +Provides: %{?sub_prefix}php-libsmbclient = %{version}-%{release} +Provides: %{?sub_prefix}php-libsmbclient%{?_isa} = %{version}-%{release} +# For more-php56 +Provides: %{?scl_prefix}php-%{pecl_name} = %{version}-%{release} +Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version}-%{release} +# PECL +Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release} +Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} +Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} +Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} %if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} # Other third party repo stuff -Obsoletes: php53-%{ext_name} <= %{version} -Obsoletes: php53u-%{ext_name} <= %{version} -Obsoletes: php54-%{ext_name} <= %{version} -Obsoletes: php54w-%{ext_name} <= %{version} %if "%{php_version}" > "5.5" -Obsoletes: php55u-%{ext_name} <= %{version} -Obsoletes: php55w-%{ext_name} <= %{version} +Obsoletes: php55u-%{pecl_name} <= %{version} +Obsoletes: php55u-pecl-%{pecl_name} <= %{version} +Obsoletes: php55w-%{pecl_name} <= %{version} +Obsoletes: php55w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "5.6" -Obsoletes: php56u-%{ext_name} <= %{version} -Obsoletes: php56w-%{ext_name} <= %{version} +Obsoletes: php56u-%{pecl_name} <= %{version} +Obsoletes: php56u-pecl-%{pecl_name} <= %{version} +Obsoletes: php56w-%{pecl_name} <= %{version} +Obsoletes: php56w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.0" -Obsoletes: php70u-%{ext_name} <= %{version} -Obsoletes: php70w-%{ext_name} <= %{version} +Obsoletes: php70u-%{pecl_name} <= %{version} +Obsoletes: php70u-pecl-%{pecl_name} <= %{version} +Obsoletes: php70w-%{pecl_name} <= %{version} +Obsoletes: php70w-pecl-%{pecl_name} <= %{version} %endif %endif @@ -95,16 +110,24 @@ Obsoletes: php70w-%{ext_name} <= %{version} %description -%{ext_name} is a PHP extension that uses Samba's libsmbclient +%{pecl_name} is a PHP extension that uses Samba's libsmbclient library to provide Samba related functions and 'smb' streams to PHP programs. -Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{scl_vendor})}. +Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}. %prep %setup -q -c +%if 0%{?ghdate} mv %{gh_project}-%{gh_commit} NTS +mv NTS/package.xml . +%else +mv %{pecl_name}-%{version}%{?prever} NTS +%endif + +# Don't install/register tests +sed -e 's/role="test"/role="src"/' -i package.xml cd NTS # Check extension version @@ -117,7 +140,7 @@ cd .. cat << 'EOF' | tee %{ini_name} ; Enable %{summary} extension module -extension=%{ext_name}.so +extension=%{pecl_name}.so EOF @@ -147,23 +170,31 @@ make -C NTS install INSTALL_ROOT=%{buildroot} # install configuration install -Dpm 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} +# 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 -Dpm 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif +# 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 + %check : Minimal load test for NTS extension %{__php} --no-php-ini \ - --define extension=%{buildroot}%{php_extdir}/%{ext_name}.so \ - --modules | grep %{ext_name} + --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + --modules | grep %{pecl_name} %if %{with_zts} : Minimal load test for NTS extension %{__ztsphp} --no-php-ini \ - --define extension=%{buildroot}%{php_ztsextdir}/%{ext_name}.so \ - --modules | grep %{ext_name} + --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ + --modules | grep %{pecl_name} %endif %if %{with_tests} @@ -172,26 +203,48 @@ cd NTS cp %{SOURCE2} phpunit.xml %{__php} \ - --define extension=%{buildroot}%{php_extdir}/%{ext_name}.so \ + --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ %{_bindir}/phpunit --verbose %endif +# when pear installed alone, after us +%triggerin -- %{?scl_prefix}php-pear +if [ -x %{__pecl} ] ; then + %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +fi + +# posttrans as pear can be installed after us +%posttrans +if [ -x %{__pecl} ] ; then + %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +fi + +%postun +if [ $1 -eq 0 -a -x %{__pecl} ] ; then + %{pecl_uninstall} %{pecl_name} >/dev/null || : +fi + + %files %{!?_licensedir:%global license %%doc} -%license NTS/LICENSE -%doc NTS/README.md +%{?_licensedir:%license NTS/LICENSE} +%doc %{pecl_docdir}/%{pecl_name} +%{pecl_xmldir}/%{name}.xml %config(noreplace) %{php_inidir}/%{ini_name} -%{php_extdir}/%{ext_name}.so +%{php_extdir}/%{pecl_name}.so %if %{with_zts} %config(noreplace) %{php_ztsinidir}/%{ini_name} -%{php_ztsextdir}/%{ext_name}.so +%{php_ztsextdir}/%{pecl_name}.so %endif %changelog +* Tue Dec 8 2015 Remi Collet - 0.8.0-0.5.RC1 +- now available on PECL + * Tue Oct 13 2015 Remi Collet - 0.8.0-0.4.rc1 - rebuild for PHP 7.0.0RC5 new API version -- cgit