9425450
# Fedora spec file for php-pecl-propro
4a8608c
#
9425450
# Copyright (c) 2013-2016 Remi Collet
4a8608c
# License: CC-BY-SA
9425450
# http://creativecommons.org/licenses/by-sa/4.0/
4a8608c
#
4a8608c
# Please, preserve the changelog entries
4a8608c
#
e8df6b8
%{!?php_inidir:  %global php_inidir  %{_sysconfdir}/php.d}
e8df6b8
%{!?php_incldir: %global php_incldir %{_includedir}/php}
e8df6b8
%{!?__pecl:      %global __pecl      %{_bindir}/pecl}
e8df6b8
%{!?__php:       %global __php       %{_bindir}/php}
4a8608c
4a8608c
%global with_zts  0%{?__ztsphp:1}
4a8608c
%global pecl_name propro
535f3eb
%if "%{php_version}" < "5.6"
e8df6b8
%global ini_name  %{pecl_name}.ini
e8df6b8
%else
e8df6b8
%global ini_name  40-%{pecl_name}.ini
e8df6b8
%endif
4a8608c
4a8608c
Summary:        Property proxy
4a8608c
Name:           php-pecl-%{pecl_name}
9425450
Version:        1.0.2
9425450
Release:        1%{?dist}
4a8608c
License:        BSD
4a8608c
Group:          Development/Languages
4a8608c
URL:            http://pecl.php.net/package/%{pecl_name}
4a8608c
Source0:        http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
4a8608c
4a8608c
BuildRequires:  php-devel > 5.3
4a8608c
BuildRequires:  php-pear
4a8608c
4a8608c
Requires(post): %{__pecl}
4a8608c
Requires(postun): %{__pecl}
4a8608c
Requires:       php(zend-abi) = %{php_zend_api}
4a8608c
Requires:       php(api) = %{php_core_api}
4a8608c
4a8608c
Provides:       php-%{pecl_name} = %{version}
4a8608c
Provides:       php-%{pecl_name}%{?_isa} = %{version}
4a8608c
Provides:       php-pecl(%{pecl_name}) = %{version}
4a8608c
Provides:       php-pecl(%{pecl_name})%{?_isa} = %{version}
4a8608c
e8df6b8
%if 0%{?fedora} < 20 && 0%{?rhel} < 7
4a8608c
# Filter shared private
4a8608c
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
4a8608c
%{?filter_setup}
e8df6b8
%endif
e8df6b8
4a8608c
4a8608c
%description
4a8608c
A reusable split-off of pecl_http's property proxy API.
4a8608c
4a8608c
%package devel
4a8608c
Summary:       %{name} developer files (header)
4a8608c
Group:         Development/Libraries
4a8608c
Requires:      %{name}%{?_isa} = %{version}-%{release}
4a8608c
Requires:      php-devel%{?_isa}
4a8608c
4a8608c
%description devel
4a8608c
These are the files needed to compile programs using %{name}.
4a8608c
4a8608c
4a8608c
%prep
4a8608c
%setup -q -c
4a8608c
mv %{pecl_name}-%{version} NTS
4a8608c
4a8608c
cd NTS
4a8608c
# Sanity check, really often broken
4a8608c
extver=$(sed -n '/#define PHP_PROPRO_VERSION/{s/.* "//;s/".*$//;p}' php_propro.h)
4a8608c
if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then
4a8608c
   : Error: Upstream extension version is ${extver}, expecting %{version}%{?prever:-%{prever}}.
4a8608c
   exit 1
4a8608c
fi
4a8608c
cd ..
4a8608c
4a8608c
%if %{with_zts}
4a8608c
# Duplicate source tree for NTS / ZTS build
4a8608c
cp -pr NTS ZTS
4a8608c
%endif
4a8608c
4a8608c
# Create configuration file
e8df6b8
cat > %{ini_name} << 'EOF'
4a8608c
; Enable %{pecl_name} extension module
4a8608c
extension=%{pecl_name}.so
4a8608c
EOF
4a8608c
4a8608c
4a8608c
%build
4a8608c
cd NTS
4a8608c
%{_bindir}/phpize
4a8608c
%configure \
4a8608c
    --with-php-config=%{_bindir}/php-config
4a8608c
make %{?_smp_mflags}
4a8608c
4a8608c
%if %{with_zts}
4a8608c
cd ../ZTS
4a8608c
%{_bindir}/zts-phpize
4a8608c
%configure \
4a8608c
    --with-php-config=%{_bindir}/zts-php-config
4a8608c
make %{?_smp_mflags}
4a8608c
%endif
4a8608c
4a8608c
4a8608c
%install
e8df6b8
make -C NTS install INSTALL_ROOT=%{buildroot}
4a8608c
4a8608c
# install config file
e8df6b8
install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}
4a8608c
4a8608c
# Install XML package description
4a8608c
install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
4a8608c
4a8608c
%if %{with_zts}
e8df6b8
make -C ZTS install INSTALL_ROOT=%{buildroot}
e8df6b8
install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
4a8608c
%endif
4a8608c
e8df6b8
# Test & Documentation
e8df6b8
for i in $(grep 'role="test"' package.xml | sed -e 's/^.*name="//;s/".*$//')
e8df6b8
do install -Dpm 644 NTS/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i
e8df6b8
done
e8df6b8
for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//')
e8df6b8
do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
e8df6b8
done
e8df6b8
4a8608c
4a8608c
%post
4a8608c
%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
4a8608c
4a8608c
4a8608c
%postun
4a8608c
if [ $1 -eq 0 ] ; then
4a8608c
    %{pecl_uninstall} %{pecl_name} >/dev/null || :
4a8608c
fi
4a8608c
4a8608c
4a8608c
%check
4a8608c
# Minimal load test for NTS extension
4a8608c
cd NTS
e8df6b8
%{__php} --no-php-ini \
4a8608c
    --define extension_dir=modules \
4a8608c
    --define extension=%{pecl_name}.so \
4a8608c
    --modules | grep %{pecl_name}
4a8608c
4a8608c
# Upstream test suite
e8df6b8
TEST_PHP_EXECUTABLE=%{__php} \
4a8608c
TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \
4a8608c
NO_INTERACTION=1 \
4a8608c
REPORT_EXIT_STATUS=1 \
e8df6b8
%{__php} -n run-tests.php
4a8608c
4a8608c
%if %{with_zts}
4a8608c
# Minimal load test for ZTS extension
4a8608c
cd ../ZTS
4a8608c
%{__ztsphp} --no-php-ini \
4a8608c
    --define extension_dir=modules \
4a8608c
    --define extension=%{pecl_name}.so \
4a8608c
    --modules | grep %{pecl_name}
4a8608c
4a8608c
# Upstream test suite
4a8608c
TEST_PHP_EXECUTABLE=%{__ztsphp} \
4a8608c
TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \
4a8608c
NO_INTERACTION=1 \
4a8608c
REPORT_EXIT_STATUS=1 \
4a8608c
%{__ztsphp} -n run-tests.php
4a8608c
%endif
4a8608c
4a8608c
4a8608c
%files
e8df6b8
%doc %{pecl_docdir}/%{pecl_name}
4a8608c
%{pecl_xmldir}/%{name}.xml
e8df6b8
%config(noreplace) %{php_inidir}/%{ini_name}
4a8608c
%{php_extdir}/%{pecl_name}.so
4a8608c
4a8608c
%if %{with_zts}
e8df6b8
%config(noreplace) %{php_ztsinidir}/%{ini_name}
4a8608c
%{php_ztsextdir}/%{pecl_name}.so
4a8608c
%endif
4a8608c
4a8608c
%files devel
e8df6b8
%doc %{pecl_testdir}/%{pecl_name}
4a8608c
%{php_incldir}/ext/%{pecl_name}
4a8608c
4a8608c
%if %{with_zts}
4a8608c
%{php_ztsincldir}/ext/%{pecl_name}
4a8608c
%endif
4a8608c
4a8608c
e32c921
4a8608c
%changelog
9425450
* Tue Jan 19 2016 Remi Collet <remi@fedoraproject.org> - 1.0.2-1
9425450
- Update to 1.0.2 (stable)
9425450
213db6d
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-6
213db6d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
213db6d
c247642
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-5
c247642
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
c247642
535f3eb
* Thu Jun 19 2014 Remi Collet <rcollet@redhat.com> - 1.0.0-4
535f3eb
- rebuild for https://fedoraproject.org/wiki/Changes/Php56
535f3eb
656371a
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-3
656371a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
656371a
e8df6b8
* Thu Apr 24 2014 Remi Collet <rcollet@redhat.com> - 1.0.0-2
e8df6b8
- add numerical prefix to extension configuration file
e8df6b8
- install doc in pecl doc_dir
e8df6b8
- install tests in pecl test_dir
e8df6b8
5e996ee
* Tue Aug 20 2013 Remi Collet <remi@fedoraproject.org> - 1.0.0-1
5e996ee
- Update to 1.0.0 (stable)
5e996ee
b117712
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.0-2
b117712
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
b117712
4a8608c
* Sun Jun 16 2013 Remi Collet <remi@fedoraproject.org> - 0.1.0-1
4a8608c
- initial package