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