]> git.pld-linux.org Git - packages/php-pecl-redis.git/blame - php-pecl-redis.spec
Use numeric index for ini config
[packages/php-pecl-redis.git] / php-pecl-redis.spec
CommitLineData
2b82b6de
ER
1# TODO
2# - use external igbinary and make it's dependency optional
b91beefc
ER
3#
4# Conditional build:
303e815d 5%bcond_without phpdoc # build phpdoc package
24c6c494 6%bcond_with tests # build without tests
b91beefc 7
303e815d
ER
8# build "phpdoc" only for 7.3 version on pld builders
9%if 0%{?_pld_builder:1} && "%{?php_suffix}" != "73"
10%undefine with_phpdoc
11%endif
12
67fa4b41 13%define php_name php%{?php_suffix}
48db7d63
ER
14%define modname redis
15Summary: %{modname} A PHP extension for Redis
ff8be432 16Name: %{php_name}-pecl-%{modname}
8495acf6 17Version: 5.3.2
f2c23d87 18Release: 1
48db7d63
ER
19License: PHP 3.01
20Group: Development/Languages/PHP
8495acf6
ER
21Source0: https://pecl.php.net/get/%{modname}-%{version}.tgz
22# Source0-md5: 8531a792d43a60dd03f87eec7b65b381
7345c0d0
ER
23Source1: https://github.com/ukko/phpredis-phpdoc/archive/9ec1795bcd45ec83a19b46cf9a8b78b4e4d7ac80/%{modname}-phpdoc.tar.gz
24# Source1-md5: eaba2e5fad040e2f4526374c073ae5f7
ff8be432 25URL: https://pecl.php.net/package/redis
7345c0d0 26BuildRequires: %{php_name}-cli
07584202 27BuildRequires: %{php_name}-devel >= 4:7.0
f695dc29 28BuildRequires: %{php_name}-json
c61b27e4
AM
29BuildRequires: %{php_name}-pcre
30BuildRequires: %{php_name}-session
31BuildRequires: %{php_name}-simplexml
07584202 32BuildRequires: zstd-devel >= 1.3.0
a56ffbc5 33%if %{with tests}
24c6c494
ER
34BuildRequires: %{php_name}-pecl-igbinary
35BuildRequires: %{php_name}-zlib
c61b27e4 36%endif
48db7d63
ER
37BuildRequires: rpmbuild(macros) >= 1.519
38%{?requires_php_extension}
f695dc29 39Requires: %{php_name}-json
67fa4b41 40Requires: %{php_name}-session
54d79b38 41Provides: php(%{modname}) = %{version}
ff8be432 42Obsoletes: %{php_name}-redis <= 4.3.0-1
e15e2353 43Obsoletes: php-redis < 2.2.5-1
48db7d63
ER
44BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
45
46%description
47The phpredis extension provides an API for communicating with the
48Redis key-value store.
49
50This extension also provides session support.
51
303e815d
ER
52%package -n php-redis-phpdoc
53Summary: @phpdoc extension PHP for IDE autocomplete
54Group: Documentation
55URL: https://github.com/ukko/phpredis-phpdoc
56Requires: php-dirs
57BuildArch: noarch
58
59%description -n php-redis-phpdoc
60@phpdoc extension PHP for IDE autocomplete.
61
48db7d63 62%prep
2b82b6de 63%setup -qc -a1
8495acf6 64mv %{modname}-*/* .
7345c0d0 65mv phpredis-phpdoc-* phpdoc
48db7d63
ER
66
67%build
68phpize
07584202
ER
69%configure \
70 --enable-redis-zstd
48db7d63
ER
71%{__make}
72
24c6c494
ER
73export TEST_PHP_EXECUTABLE="%{__php}"
74export TEST_PHP_ARGS=" -n \
b91beefc 75 -dextension_dir=modules \
f695dc29 76%if "%php_major_version.%php_minor_version" < "7.4"
fd0294ec 77 -dextension=%{php_extensiondir}/pcre.so \
b91beefc 78 -dextension=%{php_extensiondir}/spl.so \
f695dc29 79%endif
fd0294ec 80 -dextension=%{php_extensiondir}/simplexml.so \
b91beefc 81 -dextension=%{php_extensiondir}/session.so \
f695dc29 82 -dextension=%{php_extensiondir}/json.so \
b91beefc 83 -dextension=%{modname}.so \
24c6c494
ER
84"
85
86# simple module load test
87$TEST_PHP_EXECUTABLE $TEST_PHP_ARGS -m > modules.log
b91beefc 88grep %{modname} modules.log
b91beefc 89
24c6c494
ER
90%if %{with tests}
91TEST_PHP_ARGS="
92 $TEST_PHP_ARGS
93 -dextension=%{php_extensiondir}/zlib.so \
94"
95
96# Run tests for Redis class (note this is the default)
97$TEST_PHP_EXECUTABLE $TEST_PHP_ARGS tests/TestRedis.php --class Redis
98
99# Run tests for RedisArray class
100tests/mkring.sh start
101$TEST_PHP_EXECUTABLE $TEST_PHP_ARGS tests/TestRedis.php --class RedisArray
102tests/mkring.sh stop
103
104# Run tests for the RedisCluster class
105tests/make-cluster.sh start
106$TEST_PHP_EXECUTABLE $TEST_PHP_ARGS tests/TestRedis.php --class RedisCluster
107tests/make-cluster.sh stop
108%endif
109
48db7d63
ER
110%install
111rm -rf $RPM_BUILD_ROOT
48db7d63
ER
112%{__make} install \
113 EXTENSION_DIR=%{php_extensiondir} \
114 INSTALL_ROOT=$RPM_BUILD_ROOT
115
116install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
baa14fb5
ER
117%if "%php_major_version.%php_minor_version" >= "7.4"
118# order after ext-json, ext-session
119cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/01_%{modname}.ini
120%else
48db7d63 121cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
baa14fb5 122%endif
48db7d63
ER
123; Enable %{modname} extension module
124extension=%{modname}.so
125EOF
126
303e815d
ER
127install -d $RPM_BUILD_ROOT%{_examplesdir}/php-%{modname}-%{version}
128cp -a phpdoc/src/*.php $RPM_BUILD_ROOT%{_examplesdir}/php-%{modname}-%{version}
7345c0d0 129
48db7d63
ER
130%clean
131rm -rf $RPM_BUILD_ROOT
132
133%post
134%php_webserver_restart
135
136%postun
137if [ "$1" = 0 ]; then
138 %php_webserver_restart
139fi
140
141%files
142%defattr(644,root,root,755)
7345c0d0 143%doc CREDITS README.markdown
baa14fb5 144%config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/*%{modname}.ini
48db7d63 145%attr(755,root,root) %{php_extensiondir}/%{modname}.so
303e815d
ER
146
147%if %{with phpdoc}
148%files -n php-redis-phpdoc
149%defattr(644,root,root,755)
150%{_examplesdir}/php-%{modname}-%{version}
151%endif
This page took 0.183608 seconds and 4 git commands to generate.