2 # - use external igbinary and make it's dependency optional
5 %bcond_without phpdoc # build phpdoc package
6 %bcond_with tests # build without tests
8 # build "phpdoc" only for 7.3 version on pld builders
9 %if 0%{?_pld_builder:1} && "%{?php_suffix}" != "73"
13 %define php_name php%{?php_suffix}
15 Summary: %{modname} A PHP extension for Redis
16 Name: %{php_name}-%{modname}
20 Group: Development/Languages/PHP
21 Source0: https://github.com/phpredis/phpredis/tarball/%{version}/%{modname}-%{version}.tar.gz
22 # Source0-md5: a038194807474611cf76dd727098b986
23 Source1: https://github.com/ukko/phpredis-phpdoc/archive/9ec1795bcd45ec83a19b46cf9a8b78b4e4d7ac80/%{modname}-phpdoc.tar.gz
24 # Source1-md5: eaba2e5fad040e2f4526374c073ae5f7
25 URL: https://github.com/phpredis/phpredis
26 BuildRequires: %{php_name}-cli
27 BuildRequires: %{php_name}-devel >= 4:5.0.4
28 BuildRequires: %{php_name}-pcre
29 BuildRequires: %{php_name}-session
30 BuildRequires: %{php_name}-simplexml
32 BuildRequires: %{php_name}-pecl-igbinary
33 BuildRequires: %{php_name}-zlib
35 BuildRequires: rpmbuild(macros) >= 1.519
36 %{?requires_php_extension}
37 Requires: %{php_name}-session
38 Provides: php(%{modname}) = %{version}
39 Obsoletes: php-redis < 2.2.5-1
40 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
43 The phpredis extension provides an API for communicating with the
44 Redis key-value store.
46 This extension also provides session support.
48 %package -n php-redis-phpdoc
49 Summary: @phpdoc extension PHP for IDE autocomplete
51 URL: https://github.com/ukko/phpredis-phpdoc
55 %description -n php-redis-phpdoc
56 @phpdoc extension PHP for IDE autocomplete.
60 mv phpredis-phpredis-*/* .
61 mv phpredis-phpdoc-* phpdoc
68 export TEST_PHP_EXECUTABLE="%{__php}"
69 export TEST_PHP_ARGS=" -n \
70 -dextension_dir=modules \
71 -dextension=%{php_extensiondir}/pcre.so \
72 -dextension=%{php_extensiondir}/spl.so \
73 -dextension=%{php_extensiondir}/simplexml.so \
74 -dextension=%{php_extensiondir}/session.so \
75 -dextension=%{modname}.so \
78 # simple module load test
79 $TEST_PHP_EXECUTABLE $TEST_PHP_ARGS -m > modules.log
80 grep %{modname} modules.log
85 -dextension=%{php_extensiondir}/zlib.so \
88 # Run tests for Redis class (note this is the default)
89 $TEST_PHP_EXECUTABLE $TEST_PHP_ARGS tests/TestRedis.php --class Redis
91 # Run tests for RedisArray class
93 $TEST_PHP_EXECUTABLE $TEST_PHP_ARGS tests/TestRedis.php --class RedisArray
96 # Run tests for the RedisCluster class
97 tests/make-cluster.sh start
98 $TEST_PHP_EXECUTABLE $TEST_PHP_ARGS tests/TestRedis.php --class RedisCluster
99 tests/make-cluster.sh stop
103 rm -rf $RPM_BUILD_ROOT
105 EXTENSION_DIR=%{php_extensiondir} \
106 INSTALL_ROOT=$RPM_BUILD_ROOT
108 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
109 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
110 ; Enable %{modname} extension module
111 extension=%{modname}.so
114 install -d $RPM_BUILD_ROOT%{_examplesdir}/php-%{modname}-%{version}
115 cp -a phpdoc/src/*.php $RPM_BUILD_ROOT%{_examplesdir}/php-%{modname}-%{version}
118 rm -rf $RPM_BUILD_ROOT
121 %php_webserver_restart
124 if [ "$1" = 0 ]; then
125 %php_webserver_restart
129 %defattr(644,root,root,755)
130 %doc CREDITS README.markdown
131 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
132 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
135 %files -n php-redis-phpdoc
136 %defattr(644,root,root,755)
137 %{_examplesdir}/php-%{modname}-%{version}