]> git.pld-linux.org Git - packages/nginx.git/blob - nginx.spec
drop -common, -standard, -light packages
[packages/nginx.git] / nginx.spec
1 # TODO
2 # - /etc/sysconfig/nginx file
3 # - missing perl build/install requires
4 #
5 # Conditional build for nginx:
6 %bcond_with     light           # don't build light version
7 %bcond_without  mail            # don't build imap/mail proxy
8 %bcond_without  perl            # don't build with perl module
9 %bcond_without  addition        # adds module
10 %bcond_without  dav             # WebDAV
11 %bcond_without  flv             # FLV stream
12 %bcond_without  ipv6            # build without ipv6 support
13 %bcond_without  sub             # ngx_http_sub_module
14 %bcond_without  poll            # poll
15 %bcond_without  realip          # real ip (behind proxy)
16 %bcond_without  select          # select
17 %bcond_without  http2           # HTTP/2 module
18 %bcond_without  status          # status module
19 %bcond_without  ssl             # ssl support
20 %bcond_without  threads         # thread pool support
21 %bcond_with     http_browser    # header "User-agent" parser
22 %bcond_with     rtmp            # rtmp support
23 %bcond_with     debug           # enable debug logging: http://nginx.org/en/docs/debugging_log.html
24 %bcond_without  auth_request    # auth_request module
25 %bcond_with     modsecurity     # modsecurity module
26
27 %ifarch x32
28 %undefine       with_rtsig
29 %endif
30
31 %define         ssl_version     1.0.2
32 %define         rtmp_version    1.1.7
33 %define         modsecurity_version     2.9.1
34 Summary:        High perfomance HTTP and reverse proxy server
35 Summary(pl.UTF-8):      Serwer HTTP i odwrotne proxy o wysokiej wydajności
36 # nginx lines:
37 # - stable: production quality with stable API
38 # - mainline: production quality but API can change
39 Name:           nginx
40 Version:        1.11.5
41 Release:        0.1
42 License:        BSD-like
43 Group:          Networking/Daemons/HTTP
44 Source0:        http://nginx.org/download/%{name}-%{version}.tar.gz
45 # Source0-md5:  db43f2b19746f6f47401c3afc3924dc6
46 Source1:        http://nginx.net/favicon.ico
47 # Source1-md5:  2aaf2115c752cbdbfb8a2f0b3c3189ab
48 Source2:        proxy.conf
49 Source3:        %{name}.logrotate
50 Source4:        %{name}.mime
51 Source6:        %{name}.monitrc
52 Source7:        %{name}.init
53 Source14:       %{name}.conf
54 Source17:       %{name}-mime.types.sh
55 Source18:       %{name}.service
56 Source22:       http://www.modsecurity.org/tarball/%{modsecurity_version}/modsecurity-%{modsecurity_version}.tar.gz
57 # Source22-md5: 0fa92b852abc857a20b9e24f83f814cf
58 Source101:      https://github.com/arut/nginx-rtmp-module/archive/v%{rtmp_version}/nginx-rtmp-module-%{rtmp_version}.tar.gz
59 # Source101-md5:        8006de2560db3e55bb15d110220076ac
60 Patch0:         %{name}-no-Werror.patch
61 Patch1:         %{name}-modsecurity-xheaders.patch
62 URL:            http://nginx.net/
63 %{?with_modsecurity:BuildRequires: lua-devel}
64 BuildRequires:  mailcap
65 %{?with_ssl:BuildRequires: openssl-devel >= %{ssl_version}}
66 BuildRequires:  pcre-devel
67 %{?with_perl:BuildRequires: perl-CGI}
68 %{?with_perl:BuildRequires: perl-devel}
69 %{?with_perl:BuildRequires: python}
70 %{?with_perl:BuildRequires: rpm-perlprov}
71 BuildRequires:  rpmbuild(macros) >= 1.644
72 BuildRequires:  zlib-devel
73 %{?with_ssl:Requires:   openssl >= %{ssl_version}}
74 Provides:       group(http)
75 Provides:       group(nginx)
76 Provides:       user(nginx)
77 Provides:       webserver
78 Provides:       webserver(access)
79 Provides:       webserver(alias)
80 Provides:       webserver(auth)
81 Provides:       webserver(expires)
82 Provides:       webserver(headers)
83 Provides:       webserver(indexfile)
84 Provides:       webserver(log)
85 Provides:       webserver(mime)
86 Provides:       webserver(reqtimeout)
87 Provides:       webserver(rewrite)
88 Provides:       webserver(setenv)
89 Conflicts:      logrotate < 3.8.0
90 Requires(post,preun):   /sbin/chkconfig
91 Requires(post,preun,postun):    systemd-units >= 38
92 Requires(postun):       /usr/sbin/groupdel
93 Requires(postun):       /usr/sbin/userdel
94 Requires(pre):  /bin/id
95 Requires(pre):  /usr/bin/getgid
96 Requires(pre):  /usr/sbin/groupadd
97 Requires(pre):  /usr/sbin/useradd
98 Requires:       rc-scripts >= 0.2.0
99 Requires:       systemd-units >= 38
100 Suggests:       vim-syntax-nginx
101 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
102
103 %define         _sysconfdir     /etc/%{name}
104 %define         _nginxdir       /home/services/%{name}
105
106 %description
107 nginx ("engine x") is a high-performance HTTP server and reverse
108 proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor
109 Sysoev for Rambler.ru, Russia's second-most visited website, where it
110 has been running in production for over two and a half years. Igor has
111 released the source code under a BSD-like license. Although still in
112 beta, nginx is known for its stability, rich feature set, simple
113 configuration, and low resource consumption.
114
115 %description -l pl.UTF-8
116 nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
117 a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva na
118 potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
119 odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
120 opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w
121 fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków,
122 prostej konfiguracji oraz małej "zasobożerności".
123
124 %package perl
125 Summary:        High perfomance HTTP and reverse proxy server
126 Summary(pl.UTF-8):      Serwer HTTP i odwrotne proxy o wysokiej wydajności
127 Group:          Networking/Daemons/HTTP
128 Requires:       %{name} = %{version}-%{release}
129
130 %description perl
131 nginx ("engine x") is a high-performance HTTP server and reverse
132 proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor
133 Sysoev for Rambler.ru, Russia's second-most visited website, where it
134 has been running in production for over two and a half years. Igor has
135 released the source code under a BSD-like license. Although still in
136 beta, nginx is known for its stability, rich feature set, simple
137 configuration, and low resource consumption.
138
139 nginx with Perl support. Mail modules not included.
140
141 %description perl -l pl.UTF-8
142 nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
143 a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva na
144 potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
145 odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
146 opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w
147 fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków,
148 prostej konfiguracji oraz małej "zasobożerności".
149
150 nginx z obsługą Perla. Bez wsparcia dla modułów poczty.
151
152 %package mail
153 Summary:        High perfomance IMAP, POP3, SMTP proxy server
154 Summary(pl.UTF-8):      IMAP, POP3, SMTP proxy o wysokiej wydajności
155 Group:          Networking/Daemons/HTTP
156 Requires:       %{name} = %{version}-%{release}
157
158 %description mail
159 nginx ("engine x") is a high-performance HTTP server and reverse
160 proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor
161 Sysoev for Rambler.ru, Russia's second-most visited website, where it
162 has been running in production for over two and a half years. Igor has
163 released the source code under a BSD-like license. Although still in
164 beta, nginx is known for its stability, rich feature set, simple
165 configuration, and low resource consumption.
166
167 nginx with mail support. Only mail modules included.
168
169 %description mail -l pl.UTF-8
170 nginx ("engine x") jest wysokowydajnym serwerem HTTP, odwrotnym proxy
171 a także IMAP/POP3 proxy. nginx został napisany przez Igora Sysoeva na
172 potrzeby serwisu Rambler.ru. Jest to drugi pod względem ilości
173 odwiedzin serwis w Rosji i działa od ponad dwóch i pół roku. Igor
174 opublikował źródła na licencji BSD. Mimo, że projekt jest ciągle w
175 fazie beta, już zasłynął dzięki stabilności, bogactwu dodatków,
176 prostej konfiguracji oraz małej "zasobożerności".
177
178 nginx ze wsparciem tylko dla modułów poczty.
179
180 %package -n monit-rc-nginx
181 Summary:        nginx support for monit
182 Summary(pl.UTF-8):      Wsparcie nginx dla monit
183 Group:          Applications/System
184 Requires:       %{name} = %{version}-%{release}
185 Requires:       monit
186
187 %description -n monit-rc-nginx
188 monitrc file for monitoring nginx webserver.
189
190 %description -n monit-rc-nginx -l pl.UTF-8
191 Plik monitrc do monitorowania serwera WWW nginx.
192
193 %prep
194 %setup -q %{?with_rtmp:-a101} %{?with_modsecurity:-a22}
195 %patch0 -p0
196 %{?with_modsecurity:%patch1 -p0}
197
198 %if %{with rtmp}
199 mv nginx-rtmp-module-%{rtmp_version} nginx-rtmp-module
200 %endif
201
202 # build mime.types.conf
203 #sh %{SOURCE17} /etc/mime.types
204
205 %build
206 # NB: not autoconf generated configure
207 cp -f configure auto/
208
209 install -d bin
210
211 # build with default options
212 build() {
213         local type=$1; shift
214 ./configure \
215         --prefix=%{_prefix} \
216         --modules-path=%{_libdir}/%{name}/modules \
217         --sbin-path=%{_sbindir}/%{name} \
218         --conf-path=%{_sysconfdir}/%{name}.conf \
219         --error-log-path=%{_localstatedir}/log/%{name}/error.log \
220         --http-log-path=%{_localstatedir}/log/%{name}/access.log \
221         --pid-path=%{_localstatedir}/run/%{name}.pid \
222         --lock-path=%{_localstatedir}/lock/subsys/%{name} \
223         --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_temp \
224         --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \
225         --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \
226         --user=nginx \
227         --group=nginx \
228         %{?with_ipv6:--with-ipv6} \
229         %{?with_select:--with-select_module} \
230         %{?with_poll:--with-poll_module} \
231         %{?with_rtsig:--with-rtsig_module} \
232 %if %{with perl}
233         --with-http_perl_module=dynamic \
234 %endif
235 %if %{with mail}
236         --with-mail=dynamic \
237         --with-mail_ssl_module \
238 %endif
239         --with-cc="%{__cc}" \
240         --with-cc-opt="%{rpmcflags}" \
241         --with-ld-opt="%{rpmldflags}" \
242         %{?with_debug:--with-debug} \
243         "$@"
244 %{__make}
245 }
246
247 %if %{with modsecurity}
248 cd modsecurity-%{modsecurity_version}
249 ./autogen.sh
250 %configure \
251         --enable-standalone-module \
252         --disable-mlogc \
253         --enable-alp2 \
254         --with-lua=/usr
255 %{__make}
256 cd ..
257 %endif
258
259 %if %{with perl} && 0
260 build perl \
261         --with-http_perl_module \
262         %{?with_addition:--with-http_addition_module} \
263         %{?with_dav:--with-http_dav_module} \
264         %{?with_flv:--with-http_flv_module} \
265         %{?with_sub:--with-http_sub_module} \
266         %{?with_realip:--with-http_realip_module} \
267         %{?with_status:--with-http_stub_status_module} \
268         %{?with_ssl:--with-http_ssl_module} \
269         %{!?with_http_browser:--without-http_browser_module} \
270         %{?with_rtmp:--add-module=./nginx-rtmp-module} \
271         %{?with_auth_request:--with-http_auth_request_module} \
272         %{?with_threads:--with-threads} \
273         %{?with_http2:--with-http_v2_module} \
274         --with-http_secure_link_module \
275         %{nil}
276
277 mv -f objs/nginx bin/nginx-perl
278 mv -f objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.so bin/nginx.so
279 mv -f objs/src/http/modules/perl/nginx.pm bin/nginx.pm
280 %endif
281
282 %if %{with mail} && 0
283 build mail \
284         --without-http \
285         --with-imap \
286         --with-mail \
287         --with-mail_ssl_module \
288         %{nil}
289
290 mv -f objs/nginx bin/nginx-mail
291 %endif
292
293 %if %{with light}
294 build light \
295         %{?with_realip:--with-http_realip_module} \
296         %{?with_status:--with-http_stub_status_module} \
297         %{?with_ssl:--with-http_ssl_module} \
298         %{?with_rtmp:--add-module=./nginx-rtmp-module} \
299         %{?with_auth_request:--with-http_auth_request_module} \
300         %{?with_threads:--with-threads} \
301         %{?with_http2:--with-http_v2_module} \
302         %{?with_modsecurity:--add-module=modsecurity-%{modsecurity_version}/nginx/modsecurity} \
303         --without-http_browser_module \
304         --with-http_secure_link_module \
305         %{nil}
306
307 mv -f objs/nginx bin/nginx-light
308 %endif
309
310 build standard \
311         %{?with_addition:--with-http_addition_module} \
312         %{?with_dav:--with-http_dav_module} \
313         %{?with_flv:--with-http_flv_module} \
314         %{?with_sub:--with-http_sub_module} \
315         %{?with_realip:--with-http_realip_module} \
316         %{?with_status:--with-http_stub_status_module} \
317         %{?with_ssl:--with-http_ssl_module} \
318         %{!?with_http_browser:--without-http_browser_module} \
319         %{?with_rtmp:--add-module=./nginx-rtmp-module} \
320         %{?with_auth_request:--with-http_auth_request_module} \
321         %{?with_threads:--with-threads} \
322         %{?with_http2:--with-http_v2_module} \
323         %{?with_modsecurity:--add-module=modsecurity-%{modsecurity_version}/nginx/modsecurity} \
324         --with-http_secure_link_module \
325         %{nil}
326
327 %install
328 rm -rf $RPM_BUILD_ROOT
329 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \
330         $RPM_BUILD_ROOT%{_nginxdir}/{cgi-bin,html,errors} \
331         $RPM_BUILD_ROOT%{_localstatedir}/log/{%{name},archive/%{name}} \
332         $RPM_BUILD_ROOT%{_localstatedir}/cache/%{name} \
333         $RPM_BUILD_ROOT%{_localstatedir}/lock/subsys/%{name} \
334         $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}/{vhosts,webapps}.d} \
335         $RPM_BUILD_ROOT/etc/{logrotate.d,monit} \
336         $RPM_BUILD_ROOT{%{systemdunitdir},/etc/systemd/system}
337
338 %{__make} install \
339         INSTALLDIRS=vendor \
340         DESTDIR=$RPM_BUILD_ROOT
341
342 %{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/*.default
343
344 cp -p %{_sourcedir}/%{name}.conf $RPM_BUILD_ROOT%{_sysconfdir}
345 cp -p %{_sourcedir}/%{name}.service $RPM_BUILD_ROOT%{systemdunitdir}
346 cp -p %{_sourcedir}/%{name}.monitrc $RPM_BUILD_ROOT/etc/monit
347 install -p %{SOURCE7} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
348
349 cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
350 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/proxy.conf
351 cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/mime.types
352 rm -r $RPM_BUILD_ROOT%{_prefix}/html
353 cp -p html/index.html $RPM_BUILD_ROOT%{_nginxdir}/html
354 cp -p html/50x.html $RPM_BUILD_ROOT%{_nginxdir}/errors
355 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_nginxdir}/html/favicon.ico
356
357 %if %{with perl}
358 %{__rm} $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod
359 %{__rm} $RPM_BUILD_ROOT%{perl_vendorarch}/auto/nginx/.packlist
360 %endif
361
362 # only touch these for ghost packaging
363 touch $RPM_BUILD_ROOT%{_sysconfdir}/{fastcgi,scgi,uwsgi}.params
364
365 %clean
366 rm -rf $RPM_BUILD_ROOT
367
368 %pre
369 %groupadd -r -g 213 %{name}
370 %groupadd -g 51 http
371 %useradd -r -u 213 -d /usr/share/empty -s /bin/false -c "Nginx HTTP User" -g %{name} %{name}
372 %addusertogroup %{name} http
373
374 %post
375 for a in access.log error.log; do
376         if [ ! -f /var/log/%{name}/$a ]; then
377                 umask 022
378                 touch /var/log/%{name}/$a
379                 chown nginx:nginx /var/log/%{name}/$a
380                 chmod 644 /var/log/%{name}/$a
381         fi
382 done
383 /sbin/chkconfig --add %{name}
384 %systemd_post %{name}.service
385 %service %{name} force-reload
386
387 %preun
388 if [ "$1" = "0" ];then
389         %service %{name} stop
390         /sbin/chkconfig --del %{name}
391 fi
392 %systemd_preun %{name}.service
393
394 %postun
395 if [ "$1" = "0" ]; then
396         %userremove %{name}
397         %groupremove %{name}
398 fi
399 %systemd_reload
400
401 %triggerpostun -- %{name}-standard < 1.4.1-4
402 %systemd_trigger %{name}-standard.service
403
404 %triggerpostun -- %{name}-light < 1.4.1-4
405 %systemd_trigger %{name}-light.service
406
407 %triggerpostun -- %{name}-perl < 1.4.1-4
408 %systemd_trigger %{name}-perl.service
409
410 %triggerpostun -- %{name}-mail < 1.4.1-4
411 %systemd_trigger %{name}-mail.service
412
413 %triggerpostun -- %{name} < 1.8.0-2
414 # skip *this* trigger on downgrade
415 [ $1 -le 1 ] && exit 0
416 ln -sf fastcgi_params %{_sysconfdir}/fastcgi.params
417 ln -sf scgi_params %{_sysconfdir}/scgi.params
418 ln -sf uwsgi_params %{_sysconfdir}/uwsgi.params
419 exit 0
420
421 %files
422 %defattr(644,root,root,755)
423 %doc CHANGES LICENSE README html/index.html conf/nginx.conf
424 %doc %lang(ru) CHANGES.ru
425 %dir %attr(750,root,nginx) %{_sysconfdir}
426 %dir %{_nginxdir}
427 %dir %{_nginxdir}/cgi-bin
428 %dir %{_nginxdir}/html
429 %dir %{_nginxdir}/errors
430 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
431 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/proxy.conf
432 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/fastcgi_params
433 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/scgi_params
434 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/uwsgi_params
435 %ghost %{_sysconfdir}/fastcgi.params
436 %ghost %{_sysconfdir}/scgi.params
437 %ghost %{_sysconfdir}/uwsgi.params
438 %attr(640,root,root) %{_sysconfdir}/mime.types
439 %attr(640,root,root) %{_sysconfdir}/koi-utf
440 %attr(640,root,root) %{_sysconfdir}/koi-win
441 %attr(640,root,root) %{_sysconfdir}/win-utf
442 %dir %{_sysconfdir}/webapps.d
443 %dir %{_sysconfdir}/vhosts.d
444 %attr(750,nginx,logs) %dir /var/log/archive/%{name}
445 %attr(750,nginx,logs) /var/log/%{name}
446 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/*
447 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/errors/*
448
449 %defattr(644,root,root,755)
450 %attr(755,root,root) %{_sbindir}/%{name}
451 %attr(770,root,%{name}) /var/cache/%{name}
452 %attr(754,root,root) /etc/rc.d/init.d/%{name}
453 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.conf
454 %{systemdunitdir}/%{name}.service
455
456 %if %{with mail}
457 %files mail
458 %defattr(644,root,root,755)
459 %attr(755,root,root) %{_libdir}/%{name}/modules/ngx_mail_module.so
460 %endif
461
462 %if %{with perl}
463 %files perl
464 %defattr(644,root,root,755)
465 %attr(755,root,root) %{_libdir}/%{name}/modules/ngx_http_perl_module.so
466 %dir %{perl_vendorarch}/auto/%{name}
467 %attr(755,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.so
468 %{perl_vendorarch}/%{name}.pm
469 %{_mandir}/man3/nginx.3pm*
470 %endif
471
472 %files -n monit-rc-nginx
473 %defattr(644,root,root,755)
474 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}.monitrc
This page took 0.151936 seconds and 3 git commands to generate.