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