]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Conditional build: | |
3 | %bcond_without tests # build without tests | |
4 | ||
5 | %define php_name php%{?php_suffix} | |
6 | %define modname memcache | |
7 | %define php_min_version 5.0.0 | |
8 | %define commit e702b5f91 | |
9 | %include /usr/lib/rpm/macros.php | |
10 | Summary: %{modname} - a memcached extension | |
11 | Summary(pl.UTF-8): %{modname} - rozszerzenie memcached | |
12 | Name: %{php_name}-pecl-%{modname} | |
13 | Version: 4.0.3 | |
14 | Release: 1 | |
15 | License: PHP 3.01 | |
16 | Group: Development/Languages/PHP | |
17 | Source0: https://github.com/websupport-sk/pecl-memcache/archive/%{version}/%{modname}-%{version}.tar.gz | |
18 | # Source0-md5: 21a001ef690a1397a8b62990254cc8c2 | |
19 | Source1: %{modname}.ini | |
20 | Source2: %{modname}-apache.conf | |
21 | Source3: %{modname}-lighttpd.conf | |
22 | Source4: config.php | |
23 | Patch0: %{modname}-webapp.patch | |
24 | URL: https://github.com/websupport-sk/pecl-memcache/ | |
25 | BuildRequires: %{php_name}-devel >= 3:5.0.0 | |
26 | BuildRequires: %{php_name}-xml | |
27 | BuildRequires: php-packagexml2cl | |
28 | BuildRequires: rpm-php-pearprov >= 4.4.2-11 | |
29 | BuildRequires: rpmbuild(macros) >= 1.650 | |
30 | %if %{with tests} | |
31 | BuildRequires: %{php_name}-cli | |
32 | BuildRequires: %{php_name}-pcre | |
33 | BuildRequires: %{php_name}-session | |
34 | BuildRequires: %{php_name}-simplexml | |
35 | BuildRequires: %{php_name}-spl | |
36 | BuildRequires: memcached | |
37 | %endif | |
38 | %{?requires_php_extension} | |
39 | Requires: %{php_name}-session | |
40 | Requires: %{php_name}-zlib | |
41 | Suggests: memcached | |
42 | Provides: php(memcache) = %{version} | |
43 | Obsoletes: php-pecl-memcache < 3.0.8-5 | |
44 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
45 | ||
46 | %define _webapps /etc/webapps | |
47 | %define _webapp %{modname} | |
48 | %define _sysconfdir %{_webapps}/%{_webapp} | |
49 | %define _appdir %{_datadir}/%{_webapp} | |
50 | ||
51 | # bad depsolver | |
52 | %define _noautopear pear | |
53 | ||
54 | # put it together for rpmbuild | |
55 | %define _noautoreq %{?_noautophp} %{?_noautopear} | |
56 | ||
57 | %description | |
58 | Memcached is a caching daemon designed especially for dynamic web | |
59 | applications to decrease database load by storing objects in memory. | |
60 | ||
61 | This extension allows you to work with memcached through handy OO and | |
62 | procedural interfaces. | |
63 | ||
64 | %description -l pl.UTF-8 | |
65 | Memcached to zaprojektowany dla dynamicznych aplikacji internetowych | |
66 | daemon cachujący mający za zadanie zmniejszenie obciążenia bazy danych | |
67 | przez przechowywanie w pamięci obiektów. | |
68 | ||
69 | To rozszerzenie umożliwia pracę z memcached za pomocą poręcznego | |
70 | zorientowanego obiektowo (oraz przez procedury) interfejsu. | |
71 | ||
72 | %package web | |
73 | Summary: Web interface for memcache | |
74 | Group: Libraries | |
75 | # does not require extension itself | |
76 | Requires: php(core) >= %{php_min_version} | |
77 | Requires: php(date) | |
78 | Requires: php(gd) | |
79 | Requires: php(pcre) | |
80 | Requires: webapps | |
81 | Requires: webserver(php) >= 5.0 | |
82 | %if "%{_rpmversion}" >= "5" | |
83 | BuildArch: noarch | |
84 | %endif | |
85 | ||
86 | %description web | |
87 | Via this web interface script you can manage and view statistics of | |
88 | memcache. | |
89 | ||
90 | %prep | |
91 | %setup -qc | |
92 | mv pecl-%{modname}-*/{.??*,*} . | |
93 | %patch0 -p1 | |
94 | ||
95 | # skip failed tests | |
96 | xfail() { | |
97 | set +x | |
98 | while read s; do | |
99 | t=$(echo "$s" | sed -rne 's/.+\[(.+)\]/\1/p') | |
100 | ||
101 | test -f "$t" | |
102 | echo >&2 "XFAIL: $s" | |
103 | cat >> $t <<-EOF | |
104 | ||
105 | --XFAIL-- | |
106 | Skip | |
107 | EOF | |
108 | done | |
109 | } | |
110 | ||
111 | xfail <<'EOF' | |
112 | EOF | |
113 | ||
114 | %build | |
115 | packagexml2cl package.xml > ChangeLog | |
116 | phpize | |
117 | %configure \ | |
118 | --with-zlib-dir=/usr | |
119 | %{__make} | |
120 | ||
121 | %if %{with tests} | |
122 | # simple module load test | |
123 | %{__php} -n -q \ | |
124 | -d extension_dir=modules \ | |
125 | -d extension=%{php_extensiondir}/pcre.so \ | |
126 | -d extension=%{php_extensiondir}/simplexml.so \ | |
127 | -d extension=%{php_extensiondir}/spl.so \ | |
128 | -d extension=%{php_extensiondir}/session.so \ | |
129 | -d extension=%{modname}.so \ | |
130 | -m > modules.log | |
131 | grep %{modname} modules.log | |
132 | ||
133 | cat <<'EOF' > run-tests.sh | |
134 | #!/bin/sh | |
135 | export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2 | |
136 | exec %{__make} test \ | |
137 | PHP_EXECUTABLE=%{__php} \ | |
138 | PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre simplexml spl session" \ | |
139 | RUN_TESTS_SETTINGS="-q $*" | |
140 | EOF | |
141 | chmod +x run-tests.sh | |
142 | ||
143 | # Launch the Memcached service and stop it on exit | |
144 | %{_sbindir}/memcached -p 11211 -U 11211 -d -P $PWD/memcached.pid | |
145 | trap 'kill $(cat memcached.pid)' EXIT INT | |
146 | ||
147 | ./run-tests.sh | |
148 | %endif | |
149 | ||
150 | %install | |
151 | rm -rf $RPM_BUILD_ROOT | |
152 | install -d $RPM_BUILD_ROOT{%{php_sysconfdir}/conf.d,%{php_extensiondir},%{_examplesdir}/%{name}-%{version}} | |
153 | install -p modules/%{modname}.so $RPM_BUILD_ROOT%{php_extensiondir} | |
154 | # we use "session_" prefix in inifile to get loader *after* session extension | |
155 | cp -p %{SOURCE1} $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/session_%{modname}.ini | |
156 | cp -p example.php $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
157 | ||
158 | install -d $RPM_BUILD_ROOT{%{_sysconfdir},%{_appdir}} | |
159 | cp -p memcache.php $RPM_BUILD_ROOT%{_appdir} | |
160 | cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/config.php | |
161 | cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf | |
162 | cp -p $RPM_BUILD_ROOT%{_sysconfdir}/{apache,httpd}.conf | |
163 | cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf | |
164 | ||
165 | %clean | |
166 | rm -rf $RPM_BUILD_ROOT | |
167 | ||
168 | %post | |
169 | %php_webserver_restart | |
170 | ||
171 | %postun | |
172 | if [ "$1" = 0 ]; then | |
173 | %php_webserver_restart | |
174 | fi | |
175 | ||
176 | %triggerpostun -- %{name} < 3.0.4-2 | |
177 | if [ -f %{php_sysconfdir}/conf.d/%{modname}.ini.rpmsave ]; then | |
178 | echo >&2 "Restoring old config: %{modname}.ini.rpmsave -> session_%{modname}.ini in %{php_sysconfdir}/conf.d" | |
179 | cp -f %{php_sysconfdir}/conf.d/session_%{modname}.ini{,.rpmnew} | |
180 | mv -f %{php_sysconfdir}/conf.d/{%{modname}.ini.rpmsave,session_%{modname}.ini} | |
181 | %php_webserver_restart | |
182 | fi | |
183 | ||
184 | %triggerin web -- apache1 < 1.3.37-3, apache1-base | |
185 | %webapp_register apache %{_webapp} | |
186 | ||
187 | %triggerun web -- apache1 < 1.3.37-3, apache1-base | |
188 | %webapp_unregister apache %{_webapp} | |
189 | ||
190 | %triggerin web -- apache < 2.2.0, apache-base | |
191 | %webapp_register httpd %{_webapp} | |
192 | ||
193 | %triggerun web -- apache < 2.2.0, apache-base | |
194 | %webapp_unregister httpd %{_webapp} | |
195 | ||
196 | %triggerin web -- lighttpd | |
197 | %webapp_register lighttpd %{_webapp} | |
198 | ||
199 | %triggerun web -- lighttpd | |
200 | %webapp_unregister lighttpd %{_webapp} | |
201 | ||
202 | %files | |
203 | %defattr(644,root,root,755) | |
204 | %doc CREDITS README ChangeLog | |
205 | %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/session_%{modname}.ini | |
206 | %attr(755,root,root) %{php_extensiondir}/%{modname}.so | |
207 | %{_examplesdir}/%{name}-%{version} | |
208 | ||
209 | %files web | |
210 | %defattr(644,root,root,755) | |
211 | %dir %attr(750,root,http) %{_sysconfdir} | |
212 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf | |
213 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf | |
214 | %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf | |
215 | %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php | |
216 | %{_appdir} |