]> git.pld-linux.org Git - packages/nginx.git/blob - nginx.spec
- splited into separate packages
[packages/nginx.git] / nginx.spec
1 # TODO
2 # - /etc/sysconfig/nginx file
3 # - prepare pld style like nginx.conf
4 # - split into nginx-common, nginx, nginx-perl packages
5 #
6 # Conditional build for nginx:
7 %bcond_without  light           # don't build light version
8 %bcond_without  mail            # don't build imap/mail proxy
9 %bcond_without  perl            # don't build with perl module
10 %bcond_without  addition        # adds module
11 %bcond_without  dav             # WebDAV
12 %bcond_without  flv             # FLV stream
13 %bcond_without  poll            # poll
14 %bcond_without  realip          # real ip (behind proxy)
15 %bcond_without  rtsig           # rtsig
16 %bcond_without  select          # select
17 %bcond_without  status          # stats module
18 %bcond_without  ssl             # ssl support
19 %bcond_with     http_browser    # header "User-agent" parser
20 #
21 Summary:        High perfomance HTTP and reverse proxy server
22 Summary(pl.UTF-8):      Serwer HTTP i odwrotne proxy o wysokiej wydajności
23 Name:           nginx
24 Version:        0.5.32
25 Release:        0.1
26 License:        BSD-like
27 Group:          Networking/Daemons
28 Source0:        http://sysoev.ru/nginx/%{name}-%{version}.tar.gz
29 # Source0-md5:  0088269b8a59a146b0ba9c9ee29853bb
30 Source1:        %{name}.init
31 Source2:        %{name}-mime.types.sh
32 Source3:        http://www.nginx.eu/favicon.ico
33 # Source3-md5:  2aaf2115c752cbdbfb8a2f0b3c3189ab
34 Source4:        http://www.nginx.eu/download/proxy.conf
35 # Source4-md5:  f5263ae01c2edb18f46d5d1df2d3a5cd
36 Source5:        http://www.nginx.eu/download/%{name}.monitrc
37 # Source5-md5:  1d3f5eedfd34fe95213f9e0fc19daa88
38 Source6:        http://www.nginx.eu/download/%{name}.conf
39 # Source6-md5:  1c112d6f03d0f365e4acc98c1d96261a
40 Source7:        %{name}.logrotate
41 Patch0:         %{name}-config.patch
42 URL:            http://nginx.net/
43 BuildRequires:  mailcap
44 BuildRequires:  openssl-devel
45 BuildRequires:  pcre-devel
46 %{?with_perl:BuildRequires: perl-devel}
47 BuildRequires:  rpmbuild(macros) >= 1.268
48 BuildRequires:  zlib-devel
49 Requires(post,preun):   /sbin/chkconfig
50 Requires(postun):       /usr/sbin/groupdel
51 Requires(postun):       /usr/sbin/userdel
52 Requires(pre):  /bin/id
53 Requires(pre):  /usr/bin/getgid
54 Requires(pre):  /usr/sbin/groupadd
55 Requires(pre):  /usr/sbin/useradd
56 Requires:       openssl
57 Requires:       pcre
58 Requires:       rc-scripts >= 0.2.0
59 Requires:       zlib
60 Provides:       group(http)
61 Provides:       group(nginx)
62 Provides:       user(nginx)
63 Provides:       webserver
64 Conflicts:      logrotate < 3.7-4
65 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
66
67 %define         _sysconfdir     /etc/%{name}
68 %define         _nginxdir       /home/services/%{name}
69
70 %description
71 Nginx ("engine x") is a high-performance HTTP server and reverse
72 proxy, as well as an IMAP/POP3 proxy server. Nginx was written by Igor
73 Sysoev for Rambler.ru, Russia's second-most visited website, where it
74 has been running in production for over two and a half years. Igor has
75 released the source code under a BSD-like license. Although still in
76 beta, Nginx is known for its stability, rich feature set, simple
77 configuration, and low resource consumption.
78
79 %description -l pl.UTF-8
80 Nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
81 a także IMAP/POP3 proxy. Nginx został napisany przez Igora Sysoev'a
82 na potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
83 odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
84 opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle
85 w fazie beta, już zasłynął dzieki stabilności, bogactwu dodatków,
86 prostej konfiguracji oraz małej "zasobożerności".
87
88 %package light
89 Summary:        High perfomance HTTP and reverse proxy server
90 Summary(pl.UTF-8):      Serwer HTTP i odwrotne proxy o wysokiej wydajno�~[ci
91 Group:          Applications/System
92 Requires:       nginx-common
93 Provides:       group(http)
94 Provides:       group(nginx)
95 Provides:       user(nginx)
96 Provides:       webserver
97
98 %description light
99 The smallest, but also the fastest nginx edition. No additional
100 modules, no perl support, no imap proxy
101
102 %description light -l pl.UTF-8
103 Najmniejsza i najszybsza wersja nginx. Bez wsparcia dla perla,
104 dodatkowych modulow oraz imap proxy
105
106 %package perl
107 Summary:        High perfomance HTTP and reverse proxy server
108 Summary(pl.UTF-8):      Serwer HTTP i odwrotne proxy o wysokiej wydajno�~[ci
109 Group:          Applications/System
110 Requires:       nginx-common
111 Provides:       group(http)
112 Provides:       group(nginx)
113 Provides:       user(nginx)
114 Provides:       webserver
115
116 %description perl
117 Nginx with perl support. Mail modules not included.
118
119 %description perl -l pl.UTF-8
120 Nignx z obsluga perla. Bez wsparcia dla modulow poczty.
121
122 %package mail
123 Summary:        High perfomance HTTP and reverse proxy server
124 Summary(pl.UTF-8):      Serwer HTTP i odwrotne proxy o wysokiej wydajno�~[ci
125 Group:          Applications/System
126 Requires:       nginx-common
127 Provides:       group(http)
128 Provides:       group(nginx)
129 Provides:       user(nginx)
130 Provides:       webserver
131
132 %description mail
133 Nginx with mail support. Only mail modules included.
134
135 %description mail -l pl.UTF-8
136 Nignx ze wsparciem tylko dla modulow poczty.
137
138
139 #%package common
140 #Summary:       Configuration files and documentation for Nginx
141 #Summary(pl.UTF-8):     Pliki konfiguracyjne i dokumentacja dla Nginx
142 #Group:         Networking/Daemons
143
144 %package -n monit-rc-nginx
145 Summary:        Nginx  support for monit
146 Summary(pl.UTF-8):      Wsparcie nginx dla monit
147 Group:          Applications/System
148 Requires:       %{name} = %{version}-%{release}
149 Requires:       monit
150
151 %description -n monit-rc-nginx
152 monitrc file for monitoring nginx webserver server.
153
154 %description -n monit-rc-nginx -l pl.UTF-8
155 Plik monitrc do monitorowania serwera www nginx.
156
157
158 %prep
159 %setup -q
160 %patch0 -p0
161
162 # build mime.types.conf
163 sh %{SOURCE2} /etc/mime.types
164
165 %build
166 # NB: not autoconf generated configure
167 cp -f configure auto/
168 #
169 %if %{with perl}
170 ./configure \
171         --prefix=%{_prefix} \
172         --sbin-path=%{_sbindir}/%{name} \
173         --conf-path=%{_sysconfdir}/%{name}.conf \
174         --error-log-path=%{_localstatedir}/log/%{name}/error.log \
175         --pid-path=%{_localstatedir}/run/%{name}.pid \
176         --lock-path=%{_localstatedir}/lock/subsys/%{name} \
177         --user=nginx \
178         --group=nginx \
179         --with-http_perl_module \
180         %{?with_addition:--with-http_addition_module} \
181         %{?with_dav:--with-http_dav_module} \
182         %{?with_flv:--with-http_flv_module} \
183         %{?with_poll:--with-poll_module} \
184         %{?with_realip:--with-http_realip_module} \
185         %{?with_rtsig:--with-rtsig_module} \
186         %{?with_select:--with-select_module} \
187         %{?with_status:--with-http_stub_status_module} \
188         %{?with_ssl:--with-http_ssl_module} \
189         %{!?with_http_browser:--without-http_browser_module} \
190         --http-log-path=%{_localstatedir}/log/%{name}/access.log \
191         --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_temp \
192         --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \
193         --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \
194         --with-cc="%{__cc}" \
195         --with-cc-opt="%{rpmcflags}" \
196         --with-ld-opt="%{rpmldflags}"
197 %{__make}
198 mv -f objs/nginx contrib/nginx.perl
199 %endif
200
201 %if %{with mail}
202 %{__make} clean
203 ./configure \
204         --prefix=%{_prefix} \
205         --sbin-path=%{_sbindir}/%{name} \
206         --conf-path=%{_sysconfdir}/%{name}.conf \
207         --error-log-path=%{_localstatedir}/log/%{name}/error.log \
208         --pid-path=%{_localstatedir}/run/%{name}.pid \
209         --lock-path=%{_localstatedir}/lock/subsys/%{name} \
210         --user=nginx \
211         --group=nginx \
212         --with-imap \
213         --with-mail \
214         --with-mail_ssl_module \
215         %{?with_addition:--with-http_addition_module} \
216         %{?with_poll:--with-poll_module} \
217         %{?with_realip:--with-http_realip_module} \
218         %{?with_rtsig:--with-rtsig_module} \
219         %{?with_select:--with-select_module} \
220         %{!?with_http_browser:--without-http_browser_module} \
221         --http-log-path=%{_localstatedir}/log/%{name}/access.log \
222         --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_temp \
223         --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \
224         --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \
225         --with-cc="%{__cc}" \
226         --with-cc-opt="%{rpmcflags}" \
227         --with-ld-opt="%{rpmldflags}" \
228         %{?debug:--with-debug}
229 %{__make}
230 mv -f objs/nginx contrib/nginx.mail
231 %endif
232
233 %if %{with light}
234 %{__make} clean
235 ./configure \
236         --prefix=%{_prefix} \
237         --sbin-path=%{_sbindir}/%{name} \
238         --conf-path=%{_sysconfdir}/%{name}.conf \
239         --error-log-path=%{_localstatedir}/log/%{name}/error.log \
240         --pid-path=%{_localstatedir}/run/%{name}.pid \
241         --lock-path=%{_localstatedir}/lock/subsys/%{name} \
242         --user=nginx \
243         --group=nginx \
244         %{?with_poll:--with-poll_module} \
245         %{?with_realip:--with-http_realip_module} \
246         %{?with_rtsig:--with-rtsig_module} \
247         %{?with_select:--with-select_module} \
248         %{?with_status:--with-http_stub_status_module} \
249         %{?with_ssl:--with-http_ssl_module} \
250         --without-http_browser_module \
251         --http-log-path=%{_localstatedir}/log/%{name}/access.log \
252         --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_temp \
253         --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \
254         --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \
255         --with-cc="%{__cc}" \
256         --with-cc-opt="%{rpmcflags}" \
257         --with-ld-opt="%{rpmldflags}" \
258         %{?debug:--with-debug}
259 %{__make}
260 mv -f objs/nginx contrib/nginx.light
261 %endif
262
263 %{__make} clean
264 ./configure \
265         --prefix=%{_prefix} \
266         --sbin-path=%{_sbindir}/%{name} \
267         --conf-path=%{_sysconfdir}/%{name}.conf \
268         --error-log-path=%{_localstatedir}/log/%{name}/error.log \
269         --pid-path=%{_localstatedir}/run/%{name}.pid \
270         --lock-path=%{_localstatedir}/lock/subsys/%{name} \
271         --user=nginx \
272         --group=nginx \
273         %{?with_addition:--with-http_addition_module} \
274         %{?with_dav:--with-http_dav_module} \
275         %{?with_flv:--with-http_flv_module} \
276         %{?with_imap:--with-imap} \
277         %{?with_mail:--with-mail} \
278         %{?with_mail:--with-mail_ssl_module} \
279         %{?with_perl:--with-http_perl_module} \
280         %{?with_poll:--with-poll_module} \
281         %{?with_realip:--with-http_realip_module} \
282         %{?with_rtsig:--with-rtsig_module} \
283         %{?with_select:--with-select_module} \
284         %{?with_status:--with-http_stub_status_module} \
285         %{?with_ssl:--with-http_ssl_module} \
286         %{!?with_http_browser:--without-http_browser_module} \
287         --http-log-path=%{_localstatedir}/log/%{name}/access.log \
288         --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_temp \
289         --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \
290         --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \
291         --with-cc="%{__cc}" \
292         --with-cc-opt="%{rpmcflags}" \
293         --with-ld-opt="%{rpmldflags}" \
294         %{?debug:--with-debug}
295 %{__make}
296
297
298 %install
299 rm -rf $RPM_BUILD_ROOT
300 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \
301         $RPM_BUILD_ROOT%{_nginxdir}/{cgi-bin,html,errors} \
302         $RPM_BUILD_ROOT{%{_localstatedir}/log/{%{name},archive/%{name}},%{_localstatedir}/cache/%{name}} \
303         $RPM_BUILD_ROOT%{_localstatedir}/lock/subsys/%{name} \
304         $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}} \
305         $RPM_BUILD_ROOT{%{perl_vendorarch},%{perl_vendorarch}/auto/%{name}} \
306         $RPM_BUILD_ROOT/etc/{logrotate.d,monit}
307
308 install conf/* $RPM_BUILD_ROOT%{_sysconfdir}
309 install mime.types $RPM_BUILD_ROOT%{_sysconfdir}/mime.types
310 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
311 install %{SOURCE3} $RPM_BUILD_ROOT%{_nginxdir}/html/favicon.ico
312 install html/index.html $RPM_BUILD_ROOT%{_nginxdir}/html
313 install html/50x.html $RPM_BUILD_ROOT%{_nginxdir}/errors
314 install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/proxy.conf
315 install %{SOURCE5} $RPM_BUILD_ROOT/etc/monit/%{name}.monitrc
316 install %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/nginx.conf
317 install %{SOURCE7} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
318 install objs/src/http/modules/perl/nginx.pm $RPM_BUILD_ROOT%{perl_vendorarch}/%{name}.pm
319 install objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.so $RPM_BUILD_ROOT%{perl_vendorarch}/auto/%{name}/%{name}.so
320 install objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.bs $RPM_BUILD_ROOT%{perl_vendorarch}/auto/%{name}/%{name}.bs
321 install objs/%{name} $RPM_BUILD_ROOT%{_sbindir}/%{name}
322
323 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/*.default
324 rm -rf $RPM_BUILD_ROOT%{_prefix}/html
325
326 %clean
327 rm -rf $RPM_BUILD_ROOT
328
329 %pre
330 %groupadd -r -g 213 %{name}
331 %groupadd -g 51 http
332 %useradd -r -u 213 -d /usr/share/empty -s /bin/false -c "Nginx HTTP User" -g %{name} %{name}
333 %addusertogroup %{name} http
334
335 %post
336 for a in access.log error.log; do
337         if [ ! -f /var/log/%{name}/$a ]; then
338                 touch /var/log/%{name}/$a
339                 chown nginx:nginx /var/log/%{name}/$a
340                 chmod 644 /var/log/%{name}/$a
341         fi
342 done
343 /sbin/chkconfig --add %{name}
344 %service %{name} restart
345
346 %preun
347 if [ "$1" = "0" ]; then
348         %service -q %{name} stop
349         /sbin/chkconfig --del %{name}
350 fi
351
352 %postun
353 if [ "$1" = "0" ]; then
354         %userremove %{name}
355         %groupremove %{name}
356 fi
357
358 %files
359 %defattr(644,root,root,755)
360 %doc CHANGES LICENSE README html/index.html conf/nginx.conf objs/src/http/modules/perl/blib/man3/nginx.3pm
361 %doc %lang(ru) CHANGES.ru
362 %attr(754,root,root) /etc/rc.d/init.d/%{name}
363 %dir %attr(754,root,root) %{_sysconfdir}
364 %dir %{_nginxdir}
365 %dir %{_nginxdir}/cgi-bin
366 %dir %{_nginxdir}/html
367 %dir %{_nginxdir}/errors
368 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.conf
369 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
370 %attr(640,root,root) %{_sysconfdir}/*[_-]*
371 %attr(640,root,root) %{_sysconfdir}/proxy.conf
372 %attr(640,root,root) %{_sysconfdir}/mime.types
373 %attr(755,root,root) %{_sbindir}/%{name}
374 %dir %{perl_vendorarch}/auto/%{name}
375 %attr(755,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.so
376 %attr(700,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.bs
377 %attr(700,root,root) %{perl_vendorarch}/%{name}.pm
378 %attr(770,root,%{name}) /var/cache/%{name}
379 %attr(750,root,root) %dir /var/log/archive/%{name}
380 %attr(750,%{name},logs) /var/log/%{name}
381 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/*
382 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/errors/*
383
384 %files -n monit-rc-nginx
385 %defattr(644,root,root,755)
386 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}.monitrc
This page took 0.058981 seconds and 4 git commands to generate.