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