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