]> git.pld-linux.org Git - packages/php-xcache.git/blob - php-xcache.spec
fix undefine web bcond
[packages/php-xcache.git] / php-xcache.spec
1 # TODO
2 # - verify %lang codes
3 #
4 # Conditional build:
5 %bcond_without  web             # make web package
6
7 # don't build for php53
8 %if 0%{?_pld_builder:1} && "%{?php_suffix}" != "55"
9 %undefine       with_web
10 %endif
11
12 %define         php_name        php%{?php_suffix}
13 %define         modname xcache
14 Summary:        %{modname} - PHP opcode cacher
15 Summary(pl.UTF-8):      %{modname} - buforowanie opcodów PHP
16 Name:           %{php_name}-%{modname}
17 Version:        3.1.0
18 Release:        4
19 License:        BSD
20 Group:          Development/Languages/PHP
21 Source0:        http://xcache.lighttpd.net/pub/Releases/%{version}/xcache-%{version}.tar.bz2
22 # Source0-md5:  e5816d47d52be200b959bf69a673ff74
23 Source1:        %{modname}-apache.conf
24 Source2:        %{modname}-lighttpd.conf
25 Patch0:         config.patch
26 Patch1:         ini-settings.patch
27 URL:            http://xcache.lighttpd.net/
28 BuildRequires:  %{php_name}-devel >= 4:5.2.17-8
29 BuildRequires:  rpmbuild(macros) >= 1.344
30 BuildRequires:  sed >= 4.0
31 %{?requires_zend_extension}
32 Requires:       php(core) >= 5.0.4
33 Requires(triggerpostun):        sed >= 4.0
34 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
35
36 %define         _webapps        /etc/webapps
37 %define         _webapp         %{modname}
38 %define         _sysconfdir     %{_webapps}/%{_webapp}
39 %define         _appdir         %{_datadir}/%{_webapp}
40
41 %description
42 XCache is a fast, stable PHP opcode cacher that has been tested and is
43 now running on production servers under high load.
44
45 %description -l pl.UTF-8
46 XCache to szybkie, stabilne buforowanie opcodów PHP, przetestowane i
47 działające na produkcyjnych serwerach o dużym obciążeniu.
48
49 %package web
50 Summary:        WEB interface for xCache
51 Group:          Libraries
52 Requires:       %{name} = %{version}-%{release}
53 Requires:       webapps
54 Requires:       webserver(access)
55 Requires:       webserver(php) >= 5.0
56 %if "%{_rpmversion}" >= "5"
57 BuildArch:      noarch
58 %endif
59
60 %description web
61 Via this web interface script you can manage and view statistics of
62 xCache.
63
64 More information you can find at %{url}.
65
66 %prep
67 %setup -q -n %{modname}-%{version}
68 %patch0 -p1
69 %patch1 -p1
70 %{__sed} -i.bak -e '
71         s,@extensiondir@,%{php_extensiondir},
72 ' xcache.ini
73
74 mv htdocs/config{.default,}.php
75 mv htdocs/config.example.php config.example.php
76 mv htdocs/cacher/config{.default,}.php
77 mv htdocs/cacher/config.example.php cacher.config.example.php
78 mv htdocs/coverager/config{.default,}.php
79 mv htdocs/coverager/config.example.php coverager.config.example.php
80
81 %{__rm} htdocs/common/lang/*.po
82 %{__rm} htdocs/coverager/lang/*.po
83 %{__rm} htdocs/cacher/lang/*.po
84
85 # wtf?
86 %{__rm} htdocs/diagnosis/lang/zh-tranditional.php
87
88 %build
89 phpize
90 %configure \
91         --enable-xcache \
92         --enable-xcache-optimizer \
93         --enable-xcache-coverager
94 %{__make}
95
96 %install
97 rm -rf $RPM_BUILD_ROOT
98 %{__make} install \
99         INSTALL_ROOT=$RPM_BUILD_ROOT
100
101 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
102 cp -p xcache.ini $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
103
104 # The cache directory where pre-compiled files will reside
105 install -d $RPM_BUILD_ROOT/var/cache/php-%{modname}
106
107 %if %{with web}
108 install -d $RPM_BUILD_ROOT{%{_appdir},%{_sysconfdir}}
109 cp -a htdocs/* $RPM_BUILD_ROOT%{_appdir}
110 %{__rm} $RPM_BUILD_ROOT%{_appdir}/diagnosis/lang/*.po
111
112 mv $RPM_BUILD_ROOT{%{_appdir},%{_sysconfdir}}/config.php
113 mv $RPM_BUILD_ROOT{%{_appdir}/cacher/config.php,%{_sysconfdir}/cacher.config.php}
114 mv $RPM_BUILD_ROOT{%{_appdir}/coverager/config.php,%{_sysconfdir}/coverager.config.php}
115 ln -s %{_sysconfdir}/config.php $RPM_BUILD_ROOT%{_appdir}/config.php
116 ln -s %{_sysconfdir}/cacher.config.php $RPM_BUILD_ROOT%{_appdir}/cacher/config.php
117 ln -s %{_sysconfdir}/coverager.config.php $RPM_BUILD_ROOT%{_appdir}/coverager/config.php
118 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/apache.conf
119 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
120 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/lighttpd.conf
121 %endif
122
123 %clean
124 rm -rf $RPM_BUILD_ROOT
125
126 %post
127 %php_webserver_restart
128
129 %postun
130 if [ "$1" = 0 ]; then
131         %php_webserver_restart
132 fi
133
134 %triggerpostun -- %{name} < 3.0.0-0.8
135 %{__sed} -i -e 's,zend_extension,extension,' %{php_sysconfdir}/conf.d/%{modname}.ini
136
137 %triggerin web -- apache1 < 1.3.37-3, apache1-base
138 %webapp_register apache %{_webapp}
139
140 %triggerun web -- apache1 < 1.3.37-3, apache1-base
141 %webapp_unregister apache %{_webapp}
142
143 %triggerin web -- apache < 2.2.0, apache-base
144 %webapp_register httpd %{_webapp}
145
146 %triggerun web -- apache < 2.2.0, apache-base
147 %webapp_unregister httpd %{_webapp}
148
149 %triggerin web -- lighttpd
150 %webapp_register lighttpd %{_webapp}
151
152 %triggerun web -- lighttpd
153 %webapp_unregister lighttpd %{_webapp}
154
155 %files
156 %defattr(644,root,root,755)
157 %doc AUTHORS README THANKS
158 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
159 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
160
161 # XXX: what for this dir is used?
162 %dir %attr(775,root,http) /var/cache/php-xcache
163
164 %if %{with web}
165 %files web
166 %defattr(644,root,root,755)
167 %doc config*.example.php
168 %dir %attr(750,root,http) %{_sysconfdir}
169 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/apache.conf
170 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf
171 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lighttpd.conf
172 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/config.php
173 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/cacher.config.php
174 %attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/coverager.config.php
175 %dir %{_appdir}
176 %{_appdir}/*.php
177
178 %dir %{_appdir}/common
179 %{_appdir}/common/*.css
180 %{_appdir}/common/*.js
181 %{_appdir}/common/*.php
182 %{_appdir}/common/*.png
183 %dir %{_appdir}/common/lang
184 %{_appdir}/common/lang/en.php
185 %lang(cn) %{_appdir}/common/lang/zh-simplified.php
186 %lang(cn) %{_appdir}/common/lang/zh-traditional.php
187
188 %dir %{_appdir}/cacher
189 %{_appdir}/cacher/*.css
190 %{_appdir}/cacher/*.php
191 %{_appdir}/cacher/sub
192 %dir %{_appdir}/cacher/lang
193 %{_appdir}/cacher/lang/en.php
194 %lang(zh_CN) %{_appdir}/cacher/lang/zh-simplified.php
195 %lang(zh_CN) %{_appdir}/cacher/lang/zh-traditional.php
196
197 %dir %{_appdir}/coverager
198 %{_appdir}/coverager/*.css
199 %{_appdir}/coverager/*.php
200 %dir %{_appdir}/coverager/lang
201 %{_appdir}/coverager/lang/en.php
202 %lang(zh_CN) %{_appdir}/coverager/lang/zh-simplified.php
203 %lang(zh_CN) %{_appdir}/coverager/lang/zh-traditional.php
204
205 %dir %{_appdir}/diagnosis
206 %{_appdir}/diagnosis/*.css
207 %{_appdir}/diagnosis/*.php
208 %dir %{_appdir}/diagnosis/lang
209 %{_appdir}/diagnosis/lang/en.php
210 %lang(zh_CN) %{_appdir}/diagnosis/lang/zh-simplified.php
211 %lang(zh_CN) %{_appdir}/diagnosis/lang/zh-traditional.php
212 %endif
This page took 0.05038 seconds and 4 git commands to generate.