Blame SPECS/php-pecl-memcache.spec

86f50e
%{!?php_inidir: %{expand: %%global php_inidir %{_sysconfdir}/php.d}}
86f50e
%{!?__php:      %{expand: %%global __php      %{_bindir}/php}}
86f50e
%{!?__pecl:     %{expand: %%global __pecl     %{_bindir}/pecl}}
86f50e
86f50e
%global with_zts  0%{?__ztsphp:1}
86f50e
%global pecl_name memcache
86f50e
# Not ready, some failed UDP tests. Neded investigation.
86f50e
%global with_tests %{?_with_tests:1}%{!?_with_tests:0}
86f50e
86f50e
Summary:      Extension to work with the Memcached caching daemon
86f50e
Name:         php-pecl-memcache
86f50e
Version:      3.0.8
86f50e
Release:      4%{?dist}
86f50e
License:      PHP
86f50e
Group:        Development/Languages
86f50e
URL:          http://pecl.php.net/package/%{pecl_name}
86f50e
86f50e
Source:       http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
86f50e
Source2:      xml2changelog
86f50e
# Missing in official archive
86f50e
# http://svn.php.net/viewvc/pecl/memcache/branches/NON_BLOCKING_IO/tests/connect.inc?view=co
86f50e
Source3:      connect.inc
86f50e
86f50e
BuildRequires: php-devel
86f50e
BuildRequires: php-pear
86f50e
BuildRequires: zlib-devel
86f50e
%if %{with_tests}
86f50e
BuildRequires: memcached
86f50e
%endif
86f50e
86f50e
Requires(post): %{__pecl}
86f50e
Requires(postun): %{__pecl}
86f50e
Requires:     php(zend-abi) = %{php_zend_api}
86f50e
Requires:     php(api) = %{php_core_api}
86f50e
86f50e
Provides:     php-pecl(%{pecl_name}) = %{version}
86f50e
Provides:     php-pecl(%{pecl_name})%{?_isa} = %{version}
86f50e
Provides:     php-%{pecl_name} = %{version}
86f50e
Provides:     php-%{pecl_name}%{?_isa} = %{version}
86f50e
86f50e
# Filter private shared
86f50e
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
86f50e
%{?filter_setup}
86f50e
86f50e
86f50e
%description
86f50e
Memcached is a caching daemon designed especially for
86f50e
dynamic web applications to decrease database load by
86f50e
storing objects in memory.
86f50e
86f50e
This extension allows you to work with memcached through
86f50e
handy OO and procedural interfaces.
86f50e
86f50e
Memcache can be used as a PHP session handler.
86f50e
86f50e
86f50e
%prep 
86f50e
%setup -c -q
86f50e
86f50e
pushd %{pecl_name}-%{version}
86f50e
86f50e
# Chech version as upstream often forget to update this
86f50e
extver=$(sed -n '/#define PHP_MEMCACHE_VERSION/{s/.* "//;s/".*$//;p}' php_memcache.h)
86f50e
if test "x${extver}" != "x%{version}"; then
86f50e
   : Error: Upstream version is now ${extver}, expecting %{version}.
86f50e
   : Update the pdover macro and rebuild.
86f50e
   exit 1
86f50e
fi
86f50e
popd
86f50e
86f50e
%{__php} %{SOURCE2} package.xml | tee CHANGELOG | head -n 8
86f50e
86f50e
cat >%{pecl_name}.ini << 'EOF'
86f50e
; ----- Enable %{pecl_name} extension module
86f50e
extension=%{pecl_name}.so
86f50e
86f50e
; ----- Options for the %{pecl_name} module
86f50e
; see http://www.php.net/manual/en/memcache.ini.php
86f50e
86f50e
;  Whether to transparently failover to other servers on errors
86f50e
;memcache.allow_failover=1
86f50e
;  Data will be transferred in chunks of this size
86f50e
;memcache.chunk_size=32768
86f50e
;  Autocompress large data
86f50e
;memcache.compress_threshold=20000
86f50e
;  The default TCP port number to use when connecting to the memcached server 
86f50e
;memcache.default_port=11211
86f50e
;  Hash function {crc32, fnv}
86f50e
;memcache.hash_function=crc32
86f50e
;  Hash strategy {standard, consistent}
86f50e
;memcache.hash_strategy=consistent
86f50e
;  Defines how many servers to try when setting and getting data.
86f50e
;memcache.max_failover_attempts=20
86f50e
;  The protocol {ascii, binary} : You need a memcached >= 1.3.0 to use the binary protocol
86f50e
;  The binary protocol results in less traffic and is more efficient
86f50e
;memcache.protocol=ascii
86f50e
;  Redundancy : When enabled the client sends requests to N servers in parallel
86f50e
;memcache.redundancy=1
86f50e
;memcache.session_redundancy=2
86f50e
;  Lock Timeout
86f50e
;memcache.lock_timeout = 15
86f50e
86f50e
; ----- Options to use the memcache session handler
86f50e
86f50e
; RPM note : save_handler and save_path are defined
86f50e
; for mod_php, in /etc/httpd/conf.d/php.conf
86f50e
; for php-fpm, in /etc/php-fpm.d/*conf
86f50e
86f50e
;  Use memcache as a session handler
86f50e
;session.save_handler=memcache
86f50e
;  Defines a comma separated of server urls to use for session storage
86f50e
;session.save_path="tcp://localhost:11211?persistent=1&weight=1&timeout=1&retry_interval=15"
86f50e
EOF
86f50e
86f50e
%if %{with_zts}
86f50e
cp -r %{pecl_name}-%{version} %{pecl_name}-%{version}-zts
86f50e
%endif
86f50e
86f50e
86f50e
%build
86f50e
cd %{pecl_name}-%{version}
86f50e
%{_bindir}/phpize
86f50e
%configure --with-php-config=%{_bindir}/php-config
86f50e
make %{?_smp_mflags}
86f50e
86f50e
%if %{with_zts}
86f50e
cd ../%{pecl_name}-%{version}-zts
86f50e
%{_bindir}/zts-phpize
86f50e
%configure --with-php-config=%{_bindir}/zts-php-config
86f50e
make %{?_smp_mflags}
86f50e
%endif
86f50e
86f50e
86f50e
%install
86f50e
make -C %{pecl_name}-%{version} \
86f50e
     install INSTALL_ROOT=%{buildroot}
86f50e
86f50e
# Drop in the bit of configuration
86f50e
install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini
86f50e
86f50e
%if %{with_zts}
86f50e
make -C %{pecl_name}-%{version}-zts \
86f50e
     install INSTALL_ROOT=%{buildroot}
86f50e
86f50e
install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini
86f50e
%endif
86f50e
86f50e
# Install XML package description
86f50e
install -Dpm 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
86f50e
86f50e
86f50e
%check
86f50e
# simple module load test
86f50e
%{__php} --no-php-ini \
86f50e
    --define extension_dir=%{pecl_name}-%{version}/modules \
86f50e
    --define extension=%{pecl_name}.so \
86f50e
    --modules | grep %{pecl_name}
86f50e
86f50e
%if %{with_zts}
86f50e
%{__ztsphp} --no-php-ini \
86f50e
    --define extension_dir=%{pecl_name}-%{version}-zts/modules \
86f50e
    --define extension=%{pecl_name}.so \
86f50e
    --modules | grep %{pecl_name}
86f50e
%endif
86f50e
86f50e
%if %{with_tests}
86f50e
cd %{pecl_name}-%{version}
86f50e
cp %{SOURCE3} tests
86f50e
sed -e "s:/var/run/memcached/memcached.sock:$PWD/memcached.sock:" \
86f50e
    -i tests/connect.inc
86f50e
86f50e
# Launch the daemons
86f50e
memcached -p 11211 -U 11211      -d -P $PWD/memcached1.pid
86f50e
memcached -p 11212 -U 11212      -d -P $PWD/memcached2.pid
86f50e
memcached -s $PWD/memcached.sock -d -P $PWD/memcached3.pid
86f50e
86f50e
# Run the test Suite
86f50e
ret=0
86f50e
TEST_PHP_EXECUTABLE=%{_bindir}/php \
86f50e
TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \
86f50e
NO_INTERACTION=1 \
86f50e
REPORT_EXIT_STATUS=1 \
86f50e
%{_bindir}/php -n run-tests.php || ret=1
86f50e
86f50e
# Cleanup
86f50e
if [ -f memcached2.pid ]; then
86f50e
   kill $(cat memcached?.pid)
86f50e
fi
86f50e
86f50e
exit $ret
86f50e
%endif
86f50e
86f50e
86f50e
%post
86f50e
%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
86f50e
86f50e
86f50e
%postun
86f50e
if [ $1 -eq 0 ] ; then
86f50e
    %{pecl_uninstall} %{pecl_name} >/dev/null || :
86f50e
fi
86f50e
86f50e
86f50e
%files
86f50e
%doc CHANGELOG %{pecl_name}-%{version}/{CREDITS,README,LICENSE}
86f50e
%doc %{pecl_name}-%{version}/example.php %{pecl_name}-%{version}/memcache.php
86f50e
%{pecl_xmldir}/%{name}.xml
86f50e
%config(noreplace) %{php_inidir}/%{pecl_name}.ini
86f50e
%{php_extdir}/%{pecl_name}.so
86f50e
86f50e
%if %{with_zts}
86f50e
%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini
86f50e
%{php_ztsextdir}/%{pecl_name}.so
86f50e
%endif
86f50e
86f50e
86f50e
86f50e
%changelog
86f50e
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 3.0.8-4
86f50e
- Mass rebuild 2014-01-24
86f50e
86f50e
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 3.0.8-3
86f50e
- Mass rebuild 2013-12-27
86f50e
86f50e
* Thu Jul 18 2013 Remi Collet <rcollet@redhat.com> - 3.0.8-2
86f50e
- rebuild for new value of php(zend-abi) and php(api)
86f50e
86f50e
* Mon Apr 08 2013 Remi Collet <remi@fedoraproject.org> - 3.0.8-1
86f50e
- Update to 3.0.8
86f50e
- enable conditional ZTS extension build
86f50e
86f50e
* Fri Mar 22 2013 Remi Collet <rcollet@redhat.com> - 3.0.7-7
86f50e
- rebuild for http://fedoraproject.org/wiki/Features/Php55
86f50e
86f50e
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.7-6
86f50e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
86f50e
86f50e
* Fri Dec 29 2012 Remi Collet <remi@fedoraproject.org> - 3.0.7-5
86f50e
- add patch for https://bugs.php.net/59602
86f50e
  segfault in getExtendedStats
86f50e
- also provides php-memcache
86f50e
86f50e
* Fri Oct 19 2012 Remi Collet <remi@fedoraproject.org> - 3.0.7-4
86f50e
- improve comment in configuration about session.
86f50e
86f50e
* Tue Sep 25 2012 Remi Collet <remi@fedoraproject.org> - 3.0.7-3
86f50e
- switch back to previous patch as possible memleak
86f50e
  more acceptable than certain segfault
86f50e
86f50e
* Sun Sep 23 2012 Remi Collet <remi@fedoraproject.org> - 3.0.7-2
86f50e
- use upstream patch instead of our (memleak)
86f50e
86f50e
* Sun Sep 23 2012 Remi Collet <remi@fedoraproject.org> - 3.0.7-1
86f50e
- update to 3.0.7
86f50e
- drop patches merged upstream
86f50e
- cleanup spec
86f50e
86f50e
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.6-5
86f50e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
86f50e
86f50e
* Thu Jul  5 2012 Joe Orton <jorton@redhat.com> - 3.0.6-4
86f50e
- fix php_stream_cast() usage
86f50e
- fix memory corruption after unserialization (Paul Clifford)
86f50e
- package license
86f50e
86f50e
* Thu Jan 19 2012 Remi Collet <remi@fedoraproject.org> - 3.0.6-3
86f50e
- rebuild against PHP 5.4, with patch
86f50e
- fix filters
86f50e
86f50e
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.6-2
86f50e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
86f50e
86f50e
* Mon Apr 11 2011 Remi Collet <Fedora@FamilleCollet.com> 3.0.6-1
86f50e
- update to 3.0.6
86f50e
86f50e
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.5-3
86f50e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
86f50e
86f50e
* Sat Oct 23 2010  Remi Collet <Fedora@FamilleCollet.com> 3.0.5-2
86f50e
- add filter_provides to avoid private-shared-object-provides memcache.so
86f50e
86f50e
* Tue Oct 05 2010 Remi Collet <Fedora@FamilleCollet.com> 3.0.5-1
86f50e
- update to 3.0.5
86f50e
86f50e
* Thu Sep 30 2010 Remi Collet <Fedora@FamilleCollet.com> 3.0.4-4
86f50e
- patch for bug #599305 (upstream #17566)
86f50e
- add minimal load test in %%check
86f50e
86f50e
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.4-3
86f50e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
86f50e
86f50e
* Sun Jul 12 2009 Remi Collet <Fedora@FamilleCollet.com> 3.0.4-2
86f50e
- rebuild for new PHP 5.3.0 ABI (20090626)
86f50e
86f50e
* Sat Feb 28 2009 Remi Collet <Fedora@FamilleCollet.com> 3.0.4-1
86f50e
- new version 3.0.4
86f50e
86f50e
* Tue Jan 13 2009 Remi Collet <Fedora@FamilleCollet.com> 3.0.3-1
86f50e
- new version 3.0.3
86f50e
86f50e
* Fri Sep 11 2008 Remi Collet <Fedora@FamilleCollet.com> 3.0.2-1
86f50e
- new version 3.0.2
86f50e
86f50e
* Fri Sep 11 2008 Remi Collet <Fedora@FamilleCollet.com> 2.2.4-1
86f50e
- new version 2.2.4 (bug fixes)
86f50e
86f50e
* Sat Feb  9 2008 Remi Collet <Fedora@FamilleCollet.com> 2.2.3-1
86f50e
- new version
86f50e
86f50e
* Thu Jan 10 2008 Remi Collet <Fedora@FamilleCollet.com> 2.2.2-1
86f50e
- new version
86f50e
86f50e
* Thu Nov 01 2007 Remi Collet <Fedora@FamilleCollet.com> 2.2.1-1
86f50e
- new version
86f50e
86f50e
* Sat Sep 22 2007 Remi Collet <Fedora@FamilleCollet.com> 2.2.0-1
86f50e
- new version
86f50e
- add new INI directives (hash_strategy + hash_function) to config
86f50e
- add BR on php-devel >= 4.3.11 
86f50e
86f50e
* Mon Aug 20 2007 Remi Collet <Fedora@FamilleCollet.com> 2.1.2-1
86f50e
- initial RPM
86f50e