Blame SPECS/php-pecl-memcache.spec

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