Blame SPECS/php-pecl-memcache.spec

2b8996
# spec file for php-pecl-memcache
2b8996
#
2b8996
# Copyright (c) 2007-2015 Remi Collet
2b8996
# License: CC-BY-SA
2b8996
# http://creativecommons.org/licenses/by-sa/3.0/
2b8996
#
2b8996
# Please, preserve the changelog entries
2b8996
#
2b8996
%{?scl:          %scl_package         php-pecl-memcache}
2b8996
%{!?php_inidir:  %global php_inidir   %{_sysconfdir}/php.d}
2b8996
%{!?__pecl:      %global __pecl       %{_bindir}/pecl}
2b8996
%{!?__php:       %global __php        %{_bindir}/php}
2b8996
2b8996
%global pecl_name  memcache
2b8996
# Not ready, some failed UDP tests. Neded investigation.
2b8996
%global with_tests %{?_with_tests:1}%{!?_with_tests:0}
2b8996
%global with_zts   0%{?__ztsphp:1}
2b8996
%if "%{php_version}" < "5.6"
2b8996
%global ini_name  %{pecl_name}.ini
2b8996
%else
2b8996
%global ini_name  40-%{pecl_name}.ini
2b8996
%endif
2b8996
2b8996
Summary:      Extension to work with the Memcached caching daemon
2b8996
Name:         %{?scl_prefix}php-pecl-memcache
2b8996
Version:      3.0.8
2b8996
# even release (odd release reserved for base package)
2b8996
Release:      12%{?dist}
2b8996
License:      PHP
2b8996
Group:        Development/Languages
2b8996
URL:          http://pecl.php.net/package/%{pecl_name}
2b8996
2b8996
Source:       http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
2b8996
# Missing in official archive
2b8996
# http://svn.php.net/viewvc/pecl/memcache/branches/NON_BLOCKING_IO/tests/connect.inc?view=co
2b8996
Source3:      connect.inc
2b8996
2b8996
BuildRoot:    %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
2b8996
BuildRequires: %{?scl_prefix}php-devel
2b8996
BuildRequires: %{?scl_prefix}php-pear
2b8996
BuildRequires: zlib-devel
2b8996
%if %{with_tests}
2b8996
BuildRequires: memcached
2b8996
%endif
2b8996
2b8996
Requires:     %{?scl_prefix}php(zend-abi) = %{php_zend_api}
2b8996
Requires:     %{?scl_prefix}php(api) = %{php_core_api}
2b8996
2b8996
Provides:     %{?scl_prefix}php-pecl(%{pecl_name}) = %{version}
2b8996
Provides:     %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version}
2b8996
Provides:     %{?scl_prefix}php-%{pecl_name} = %{version}
2b8996
Provides:     %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version}
2b8996
2b8996
%if 0%{?fedora} < 20 && 0%{?rhel} < 7
2b8996
# Filter shared private
2b8996
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
2b8996
%{?filter_setup}
2b8996
%endif
2b8996
2b8996
2b8996
%description
2b8996
Memcached is a caching daemon designed especially for
2b8996
dynamic web applications to decrease database load by
2b8996
storing objects in memory.
2b8996
2b8996
This extension allows you to work with memcached through
2b8996
handy OO and procedural interfaces.
2b8996
2b8996
Memcache can be used as a PHP session handler.
2b8996
2b8996
2b8996
%prep 
2b8996
%setup -c -q
2b8996
2b8996
# Don't install/register tests
2b8996
sed -e 's/role="test"/role="src"/' -i package.xml
2b8996
2b8996
mv %{pecl_name}-%{version} NTS
2b8996
pushd NTS
2b8996
2b8996
# Chech version as upstream often forget to update this
2b8996
extver=$(sed -n '/#define PHP_MEMCACHE_VERSION/{s/.* "//;s/".*$//;p}' php_memcache.h)
2b8996
if test "x${extver}" != "x%{version}"; then
2b8996
   : Error: Upstream version is now ${extver}, expecting %{version}.
2b8996
   : Update the pdover macro and rebuild.
2b8996
   exit 1
2b8996
fi
2b8996
popd
2b8996
2b8996
cat << 'EOF' | tee %{ini_name}
2b8996
; ----- Enable %{pecl_name} extension module
2b8996
extension=%{pecl_name}.so
2b8996
2b8996
; ----- Options for the %{pecl_name} module
2b8996
; see http://www.php.net/manual/en/memcache.ini.php
2b8996
2b8996
;  Whether to transparently failover to other servers on errors
2b8996
;memcache.allow_failover=1
2b8996
;  Data will be transferred in chunks of this size
2b8996
;memcache.chunk_size=32768
2b8996
;  Autocompress large data
2b8996
;memcache.compress_threshold=20000
2b8996
;  The default TCP port number to use when connecting to the memcached server 
2b8996
;memcache.default_port=11211
2b8996
;  Hash function {crc32, fnv}
2b8996
;memcache.hash_function=crc32
2b8996
;  Hash strategy {standard, consistent}
2b8996
;memcache.hash_strategy=consistent
2b8996
;  Defines how many servers to try when setting and getting data.
2b8996
;memcache.max_failover_attempts=20
2b8996
;  The protocol {ascii, binary} : You need a memcached >= 1.3.0 to use the binary protocol
2b8996
;  The binary protocol results in less traffic and is more efficient
2b8996
;memcache.protocol=ascii
2b8996
;  Redundancy : When enabled the client sends requests to N servers in parallel
2b8996
;memcache.redundancy=1
2b8996
;memcache.session_redundancy=2
2b8996
;  Lock Timeout
2b8996
;memcache.lock_timeout = 15
2b8996
2b8996
; ----- Options to use the memcache session handler
2b8996
2b8996
; RPM note : save_handler and save_path are defined
2b8996
; for mod_php, in %{_sysconfdir}/httpd/conf.d/php.conf
2b8996
; for php-fpm, in %{_sysconfdir}/php-fpm.d/*conf
2b8996
2b8996
;  Use memcache as a session handler
2b8996
;session.save_handler=memcache
2b8996
;  Defines a comma separated of server urls to use for session storage
2b8996
;session.save_path="tcp://localhost:11211?persistent=1&weight=1&timeout=1&retry_interval=15"
2b8996
EOF
2b8996
2b8996
%if %{with_zts}
2b8996
cp -r NTS ZTS
2b8996
%endif
2b8996
2b8996
2b8996
%build
2b8996
cd NTS
2b8996
%{_bindir}/phpize
2b8996
%configure --with-php-config=%{_bindir}/php-config
2b8996
make %{?_smp_mflags}
2b8996
2b8996
%if %{with_zts}
2b8996
cd ../ZTS
2b8996
%{_bindir}/zts-phpize
2b8996
%configure --with-php-config=%{_bindir}/zts-php-config
2b8996
make %{?_smp_mflags}
2b8996
%endif
2b8996
2b8996
%install
2b8996
rm -rf %{buildroot}
2b8996
2b8996
make -C NTS install INSTALL_ROOT=%{buildroot}
2b8996
2b8996
# Drop in the bit of configuration
2b8996
install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name}
2b8996
%{?nfsmountable:install -D -m 644 %{ini_name} %{buildroot}%{_scl_scripts}/register.content%{php_inidir}/%{ini_name}}
2b8996
2b8996
%if %{with_zts}
2b8996
make -C ZTS install INSTALL_ROOT=%{buildroot}
2b8996
install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
2b8996
%{?nfsmountable:install -D -m 644 %{ini_name} %{buildroot}%{_scl_scripts}/register.content%{php_ztsinidir}/%{ini_name}}
2b8996
%endif
2b8996
2b8996
# Install XML package description
2b8996
install -Dpm 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
2b8996
2b8996
# Documentation
2b8996
for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//')
2b8996
do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
2b8996
done
2b8996
2b8996
2b8996
%check
2b8996
: Minimal load test for NTS extension
2b8996
%{__php} --no-php-ini \
2b8996
    --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
2b8996
    -m | grep %{pecl_name}
2b8996
2b8996
%if %{with_zts}
2b8996
: Minimal load test for ZTS extension
2b8996
%{__ztsphp} --no-php-ini \
2b8996
    --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
2b8996
    -m | grep %{pecl_name}
2b8996
%endif
2b8996
2b8996
%if %{with_tests}
2b8996
: Configuration for tests
2b8996
cd NTS
2b8996
cp %{SOURCE3} tests
2b8996
sed -e "s:/var/run/memcached/memcached.sock:$PWD/memcached.sock:" \
2b8996
    -i tests/connect.inc
2b8996
2b8996
: Launch the daemons
2b8996
memcached -p 11211 -U 11211      -d -P $PWD/memcached1.pid
2b8996
memcached -p 11212 -U 11212      -d -P $PWD/memcached2.pid
2b8996
memcached -s $PWD/memcached.sock -d -P $PWD/memcached3.pid
2b8996
2b8996
: Upstream test suite for NTS extension
2b8996
ret=0
2b8996
TEST_PHP_EXECUTABLE=%{_bindir}/php \
2b8996
TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \
2b8996
NO_INTERACTION=1 \
2b8996
REPORT_EXIT_STATUS=1 \
2b8996
%{_bindir}/php -n run-tests.php || ret=1
2b8996
2b8996
: Cleanup
2b8996
if [ -f memcached2.pid ]; then
2b8996
   kill $(cat memcached?.pid)
2b8996
fi
2b8996
2b8996
exit $ret
2b8996
%endif
2b8996
2b8996
2b8996
%clean
2b8996
rm -rf %{buildroot}
2b8996
2b8996
2b8996
# when pear installed alone, after us
2b8996
%triggerin -- %{?scl_prefix}php-pear
2b8996
if [ -x %{__pecl} ] ; then
2b8996
    %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
2b8996
fi
2b8996
2b8996
# posttrans as pear can be installed after us
2b8996
%posttrans
2b8996
if [ -x %{__pecl} ] ; then
2b8996
    %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
2b8996
fi
2b8996
2b8996
%postun
2b8996
if [ $1 -eq 0 -a -x %{__pecl} ] ; then
2b8996
    %{pecl_uninstall} %{pecl_name} >/dev/null || :
2b8996
fi
2b8996
2b8996
2b8996
%files
2b8996
%defattr(-, root, root, -)
2b8996
%doc %{pecl_docdir}/%{pecl_name}
2b8996
%{pecl_xmldir}/%{name}.xml
2b8996
2b8996
%config(noreplace) %{php_inidir}/%{ini_name}
2b8996
%{php_extdir}/%{pecl_name}.so
2b8996
%{?nfsmountable:%{_scl_scripts}/register.content/*}
2b8996
2b8996
%if %{with_zts}
2b8996
%config(noreplace) %{php_ztsinidir}/%{ini_name}
2b8996
%{php_ztsextdir}/%{pecl_name}.so
2b8996
%endif
2b8996
2b8996
2b8996
%changelog
2b8996
* Mon Mar 16 2015 Remi Collet <rcollet@redhat.com> 3.0.8-12
2b8996
- rebuild to remove scls directory #1200056
2b8996
2b8996
* Mon Jan 26 2015 Remi Collet <rcollet@redhat.com> 3.0.8-10
2b8996
- fix %%postun scriptlet
2b8996
2b8996
* Mon Jan 26 2015 Remi Collet <rcollet@redhat.com> 3.0.8-8
2b8996
- add register.content
2b8996
2b8996
* Thu Jan 15 2015 Remi Collet <rcollet@redhat.com> 3.0.8-6
2b8996
- initial package for rh-php56 in RHSCL-2.0
2b8996
- don't install tests
2b8996
- drop runtime dependency on pear
2b8996
2b8996
* Mon Aug 25 2014 Remi Collet <rcollet@redhat.com> - 3.0.8-5
2b8996
- allow SCL build
2b8996
2b8996
* Fri Apr 25 2014 Remi Collet <remi@fedoraproject.org> - 3.0.8-4
2b8996
- bump release (for EL-7)
2b8996
2b8996
* Thu Apr 10 2014 Remi Collet <remi@fedoraproject.org> - 3.0.8-3
2b8996
- add numerical prefix to extension configuration file
2b8996
2b8996
* Fri Mar  7 2014 Remi Collet <remi@fedoraproject.org> - 3.0.8-2
2b8996
- cleanups
2b8996
- install doc in pecl_docdir
2b8996
- install tests in pecl_testdir
2b8996
2b8996
* Mon Apr 08 2013 Remi Collet <remi@fedoraproject.org> - 3.0.8-1
2b8996
- Update to 3.0.8
2b8996
2b8996
* Sat Dec 29 2012 Remi Collet <remi@fedoraproject.org> - 3.0.7-5
2b8996
- add patch for https://bugs.php.net/59602
2b8996
  segfault in getExtendedStats
2b8996
2b8996
* Fri Nov 30 2012 Remi Collet <remi@fedoraproject.org> - 3.0.7-4.1
2b8996
- also provides php-memcache
2b8996
2b8996
* Fri Oct 19 2012 Remi Collet <remi@fedoraproject.org> - 3.0.7-4
2b8996
- improve comment in configuration about session.
2b8996
2b8996
* Mon Sep 24 2012 Remi Collet <remi@fedoraproject.org> - 3.0.7-3
2b8996
- switch back to previous patch (memleak better than segfault)
2b8996
2b8996
* Sun Sep 23 2012 Remi Collet <remi@fedoraproject.org> - 3.0.7-2
2b8996
- use upstream patch instead of our (memleak)
2b8996
2b8996
* Sun Sep 23 2012 Remi Collet <remi@fedoraproject.org> - 3.0.7-1
2b8996
- update to 3.0.7
2b8996
- drop patches merged upstream
2b8996
- cleanup spec
2b8996
2b8996
* Sat Sep  8 2012 Remi Collet <remi@fedoraproject.org> - 3.0.6-5
2b8996
- add LICENSE
2b8996
- Obsoletes php53*, php54* on EL
2b8996
2b8996
* Sat Jul  7 2012 Remi Collet <remi@fedoraproject.org> - 3.0.6-4
2b8996
- sync patch with rawhide
2b8996
2b8996
* Thu Jul  5 2012 Joe Orton <jorton@redhat.com> - 3.0.6-4
2b8996
- fix php_stream_cast() usage
2b8996
- fix memory corruption after unserialization (Paul Clifford)
2b8996
- package license
2b8996
2b8996
* Sun Nov 13 2011 Remi Collet <remi@fedoraproject.org> - 3.0.6-3
2b8996
- build against php 5.4
2b8996
- add patch for ZTS build, see https://bugs.php.net/60284
2b8996
2b8996
* Mon Oct 03 2011 Remi Collet <Fedora@FamilleCollet.com> 3.0.6-2
2b8996
- clean spec for latest macros
2b8996
- build zts extension
2b8996
2b8996
* Mon Apr 11 2011 Remi Collet <Fedora@FamilleCollet.com> 3.0.6-1
2b8996
- update to 3.0.6
2b8996
2b8996
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.5-3
2b8996
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
2b8996
2b8996
* Mon Dec 27 2010 Remi Collet <rpms@famillecollet.com> 3.0.5-3
2b8996
- relocate using phpname macro
2b8996
2b8996
* Sat Oct 23 2010  Remi Collet <Fedora@FamilleCollet.com> 3.0.5-2
2b8996
- add filter_provides to avoid private-shared-object-provides memcache.so
2b8996
2b8996
* Tue Oct 05 2010 Remi Collet <Fedora@FamilleCollet.com> 3.0.5-1
2b8996
- update to 3.0.5
2b8996
2b8996
* Thu Sep 30 2010 Remi Collet <Fedora@FamilleCollet.com> 3.0.4-4
2b8996
- patch for bug #599305 (upstream #17566)
2b8996
- add minimal load test in %%check
2b8996
2b8996
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.4-3
2b8996
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
2b8996
2b8996
* Sun Jul 12 2009 Remi Collet <Fedora@FamilleCollet.com> 3.0.4-2
2b8996
- rebuild for new PHP 5.3.0 ABI (20090626)
2b8996
2b8996
* Sat Feb 28 2009 Remi Collet <Fedora@FamilleCollet.com> 3.0.4-1
2b8996
- new version 3.0.4
2b8996
2b8996
* Tue Jan 13 2009 Remi Collet <Fedora@FamilleCollet.com> 3.0.3-1
2b8996
- new version 3.0.3
2b8996
2b8996
* Thu Sep 11 2008 Remi Collet <Fedora@FamilleCollet.com> 3.0.2-1
2b8996
- new version 3.0.2
2b8996
2b8996
* Thu Sep 11 2008 Remi Collet <Fedora@FamilleCollet.com> 2.2.4-1
2b8996
- new version 2.2.4 (bug fixes)
2b8996
2b8996
* Sat Feb  9 2008 Remi Collet <Fedora@FamilleCollet.com> 2.2.3-1
2b8996
- new version
2b8996
2b8996
* Thu Jan 10 2008 Remi Collet <Fedora@FamilleCollet.com> 2.2.2-1
2b8996
- new version
2b8996
2b8996
* Thu Nov 01 2007 Remi Collet <Fedora@FamilleCollet.com> 2.2.1-1
2b8996
- new version
2b8996
2b8996
* Sat Sep 22 2007 Remi Collet <Fedora@FamilleCollet.com> 2.2.0-1
2b8996
- new version
2b8996
- add new INI directives (hash_strategy + hash_function) to config
2b8996
- add BR on php-devel >= 4.3.11 
2b8996
2b8996
* Mon Aug 20 2007 Remi Collet <Fedora@FamilleCollet.com> 2.1.2-1
2b8996
- initial RPM