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