]> git.pld-linux.org Git - packages/nginx.git/blob - nginx.spec
e24dd62d767f910cca0690638b4eabc435ecb2be
[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  addition        # adds module
8 %bcond_without  dav             # WebDAV
9 %bcond_without  flv             # FLV stream
10 %bcond_without  imap            # imap proxy
11 %bcond_without  mail            # mail module
12 %bcond_without  perl            # perl module
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.31
25 Release:        4.1
26 License:        BSD-like
27 Group:          Networking/Daemons
28 Source0:        http://sysoev.ru/nginx/%{name}-%{version}.tar.gz
29 # Source0-md5:  d84ef8e624b8953faf9cee2b5da535c1
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 Patch1:         %{name}-autoindexDoS.patch
43 URL:            http://nginx.net/
44 BuildRequires:  mailcap
45 BuildRequires:  openssl-devel
46 BuildRequires:  pcre-devel
47 %{?with_perl:BuildRequires: perl-devel}
48 BuildRequires:  rpmbuild(macros) >= 1.268
49 BuildRequires:  zlib-devel
50 Requires(post,preun):   /sbin/chkconfig
51 Requires(postun):       /usr/sbin/groupdel
52 Requires(postun):       /usr/sbin/userdel
53 Requires(pre):  /bin/id
54 Requires(pre):  /usr/bin/getgid
55 Requires(pre):  /usr/sbin/groupadd
56 Requires(pre):  /usr/sbin/useradd
57 Requires:       openssl
58 Requires:       pcre
59 Requires:       rc-scripts >= 0.2.0
60 Requires:       zlib
61 Provides:       group(http)
62 Provides:       group(nginx)
63 Provides:       user(nginx)
64 Provides:       webserver
65 Conflicts:      logrotate < 3.7-4
66 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
67
68 %define         _sysconfdir     /etc/%{name}
69 %define         _nginxdir       /home/services/%{name}
70
71 %description
72 Nginx ("engine x") is a high-performance HTTP server and reverse
73 proxy, as well as an IMAP/POP3 proxy server. Nginx was written by Igor
74 Sysoev for Rambler.ru, Russia's second-most visited website, where it
75 has been running in production for over two and a half years. Igor has
76 released the source code under a BSD-like license. Although still in
77 beta, Nginx is known for its stability, rich feature set, simple
78 configuration, and low resource consumption.
79
80 %description -l pl.UTF-8
81 Serwer HTTP i odwrotne proxy o wysokiej wydajności.
82
83 #%package common
84 #Summary:       Configuration files and documentation for Nginx
85 #Summary(pl.UTF-8):     Pliki konfiguracyjne i dokumentacja dla Nginx
86 #Group:         Networking/Daemons
87
88 %package -n monit-rc-nginx
89 Summary:        Nginx  support for monit
90 Summary(pl.UTF-8):      Wsparcie nginx dla monit
91 Group:          Applications/System
92 Requires:       %{name} = %{version}-%{release}
93 Requires:       monit
94
95 %description -n monit-rc-nginx
96 monitrc file for monitoring nginx webserver server.
97
98 %description -n monit-rc-nginx -l pl.UTF-8
99 Plik monitrc do monitorowania serwera www nginx.
100
101
102 %prep
103 %setup -q
104 %patch0 -p0
105 %patch1 -p0
106
107 # build mime.types.conf
108 sh %{SOURCE2} /etc/mime.types
109
110 %build
111 # NB: not autoconf generated configure
112 ./configure \
113         --prefix=%{_prefix} \
114         --sbin-path=%{_sbindir}/%{name} \
115         --conf-path=%{_sysconfdir}/%{name}.conf \
116         --error-log-path=%{_localstatedir}/log/%{name}/error.log \
117         --pid-path=%{_localstatedir}/run/%{name}.pid \
118         --lock-path=%{_localstatedir}/lock/subsys/%{name} \
119         --user=nginx \
120         --group=nginx \
121         %{?with_addition:--with-http_addition_module} \
122         %{?with_dav:--with-http_dav_module} \
123         %{?with_flv:--with-http_flv_module} \
124         %{?with_imap:--with-imap} \
125         %{?with_mail:--with-mail} \
126         %{?with_mail:--with-mail_ssl_module} \
127         %{?with_perl:--with-http_perl_module} \
128         %{?with_poll:--with-poll_module} \
129         %{?with_realip:--with-http_realip_module} \
130         %{?with_rtsig:--with-rtsig_module} \
131         %{?with_select:--with-select_module} \
132         %{?with_status:--with-http_stub_status_module} \
133         %{?with_ssl:--with-http_ssl_module} \
134         %{!?with_http_browser:--without-http_browser_module} \
135         --http-log-path=%{_localstatedir}/log/%{name}/access.log \
136         --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_temp \
137         --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \
138         --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \
139         --with-cc="%{__cc}" \
140         --with-cc-opt="%{rpmcflags}" \
141         --with-ld-opt="%{rpmldflags}" \
142         %{?debug:--with-debug}
143 %{__make}
144
145 %install
146 rm -rf $RPM_BUILD_ROOT
147 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \
148         $RPM_BUILD_ROOT%{_nginxdir}/{cgi-bin,html,errors} \
149         $RPM_BUILD_ROOT{%{_localstatedir}/log/{%{name},archive/%{name}},%{_localstatedir}/cache/%{name}} \
150         $RPM_BUILD_ROOT%{_localstatedir}/lock/subsys/%{name} \
151         $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}} \
152         $RPM_BUILD_ROOT{%{perl_vendorarch},%{perl_vendorarch}/auto/%{name}} \
153         $RPM_BUILD_ROOT/etc/{logrotate.d,monit}
154
155 install conf/* $RPM_BUILD_ROOT%{_sysconfdir}
156 install mime.types $RPM_BUILD_ROOT%{_sysconfdir}/mime.types
157 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
158 install %{SOURCE3} $RPM_BUILD_ROOT%{_nginxdir}/html/favicon.ico
159 install html/index.html $RPM_BUILD_ROOT%{_nginxdir}/html
160 install html/50x.html $RPM_BUILD_ROOT%{_nginxdir}/errors
161 install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/proxy.conf
162 install %{SOURCE5} $RPM_BUILD_ROOT/etc/monit/%{name}.monitrc
163 install %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/nginx.conf
164 install %{SOURCE7} $RPM_BUILD_ROOT/etc/logrotate.d/%{name}
165 install objs/src/http/modules/perl/nginx.pm $RPM_BUILD_ROOT%{perl_vendorarch}/%{name}.pm
166 install objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.so $RPM_BUILD_ROOT%{perl_vendorarch}/auto/%{name}/%{name}.so
167 install objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.bs $RPM_BUILD_ROOT%{perl_vendorarch}/auto/%{name}/%{name}.bs
168 install objs/%{name} $RPM_BUILD_ROOT%{_sbindir}/%{name}
169
170 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/*.default
171 rm -rf $RPM_BUILD_ROOT%{_prefix}/html
172
173 %clean
174 rm -rf $RPM_BUILD_ROOT
175
176 %pre
177 %groupadd -r -g 213 %{name}
178 %groupadd -g 51 http
179 %useradd -r -u 213 -d /usr/share/empty -s /bin/false -c "Nginx HTTP User" -g %{name} %{name}
180 %addusertogroup %{name} http
181
182 %post
183 for a in access.log error.log; do
184         if [ ! -f /var/log/%{name}/$a ]; then
185                 touch /var/log/%{name}/$a
186                 chown nginx:nginx /var/log/%{name}/$a
187                 chmod 644 /var/log/%{name}/$a
188         fi
189 done
190 /sbin/chkconfig --add %{name}
191 %service %{name} restart
192
193 %preun
194 if [ "$1" = "0" ]; then
195         %service -q %{name} stop
196         /sbin/chkconfig --del %{name}
197 fi
198
199 %postun
200 if [ "$1" = "0" ]; then
201         %userremove %{name}
202         %groupremove %{name}
203 fi
204
205 %files
206 %defattr(644,root,root,755)
207 %doc CHANGES LICENSE README html/index.html conf/nginx.conf objs/src/http/modules/perl/blib/man3/nginx.3pm
208 %doc %lang(ru) CHANGES.ru
209 %attr(754,root,root) /etc/rc.d/init.d/%{name}
210 %dir %attr(754,root,root) %{_sysconfdir}
211 %dir %{_nginxdir}
212 %dir %{_nginxdir}/cgi-bin
213 %dir %{_nginxdir}/html
214 %dir %{_nginxdir}/errors
215 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.conf
216 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/logrotate.d/%{name}
217 %attr(640,root,root) %{_sysconfdir}/*[_-]*
218 %attr(640,root,root) %{_sysconfdir}/proxy.conf
219 %attr(640,root,root) %{_sysconfdir}/mime.types
220 %attr(755,root,root) %{_sbindir}/%{name}
221 %dir %{perl_vendorarch}/auto/%{name}
222 %attr(755,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.so
223 %attr(700,root,root) %{perl_vendorarch}/auto/%{name}/%{name}.bs
224 %attr(700,root,root) %{perl_vendorarch}/%{name}.pm
225 %attr(770,root,%{name}) /var/cache/%{name}
226 %attr(750,root,root) %dir /var/log/archive/%{name}
227 %attr(750,%{name},logs) /var/log/%{name}
228 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/*
229 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/errors/*
230
231 %files -n monit-rc-nginx
232 %defattr(644,root,root,755)
233 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{name}.monitrc
This page took 0.060295 seconds and 2 git commands to generate.