]> git.pld-linux.org Git - packages/nginx.git/blob - nginx.spec
- config macro
[packages/nginx.git] / nginx.spec
1 # TODO
2 # - logrotate script
3 # - more bconds (??)
4 # - subpackage with error pages
5 # Conditional build for nginx:
6 %bcond_with     stub_status             # stats module
7 %bcond_with     rtsig
8 %bcond_with     select
9 %bcond_with     poll
10 %bcond_with     ssl                     # ssl support
11 %bcond_with     imap                    # imap proxy
12 %bcond_without  http_browser            # parse header "User-agent"
13 #
14 Summary:        High perfomance HTTP and reverse proxy server
15 Summary(pl.UTF-8):      Serwer HTTP i odwrotne proxy o wysokiej wydajności
16 Name:           nginx
17 Version:        0.5.31
18 Release:        0.1
19 License:        BSD-like
20 Group:          Networking/Daemons
21 Source0:        http://sysoev.ru/nginx/%{name}-%{version}.tar.gz
22 # Source0-md5:  d84ef8e624b8953faf9cee2b5da535c1
23 Source1:        %{name}.init
24 Source2:        %{name}-mime.types.sh
25 Source3:        http://www.nginx.eu/favicon.ico
26 # Source3-md5:  2aaf2115c752cbdbfb8a2f0b3c3189ab
27 Source4:        http://www.nginx.eu/download/proxy.conf
28 # Source4-md5:  f5263ae01c2edb18f46d5d1df2d3a5cd
29 Source5:        http://www.nginx.eu/download/nginx.monitrc
30 # Source5-md5:  1d3f5eedfd34fe95213f9e0fc19daa88
31 Source6:        http://www.nginx.eu/download/nginx.conf
32 # Source6-md5:  1c112d6f03d0f365e4acc98c1d96261a
33 Patch0:         %{name}-config.patch
34 URL:            http://nginx.net/
35 BuildRequires:  mailcap
36 BuildRequires:  openssl-devel
37 BuildRequires:  pcre-devel
38 BuildRequires:  rpmbuild(macros) >= 1.268
39 BuildRequires:  zlib-devel
40 Requires(post,preun):   /sbin/chkconfig
41 Requires(postun):       /usr/sbin/groupdel
42 Requires(postun):       /usr/sbin/userdel
43 Requires(pre):  /bin/id
44 Requires(pre):  /usr/bin/getgid
45 Requires(pre):  /usr/sbin/groupadd
46 Requires(pre):  /usr/sbin/useradd
47 Requires:       rc-scripts
48 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
49
50 %define         _sysconfdir     /etc/%{name}
51 %define         _nginxdir       /home/services/%{name}
52
53 %description
54 High perfomance HTTP and reverse proxy server.
55
56 %description -l pl.UTF-8
57 Serwer HTTP i odwrotne proxy o wysokiej wydajności.
58
59 %prep
60 %setup -q
61 %patch0 -p0
62
63 # build mime.types.conf
64 sh %{SOURCE2} /etc/mime.types
65
66 %build
67 # NB: not autoconf generated configure
68 ./configure \
69         --prefix=%{_prefix} \
70         --sbin-path=%{_sbindir}/%{name} \
71         --conf-path=%{_sysconfdir}/%{name}.conf \
72         --error-log-path=%{_localstatedir}/log/%{name}/error.log \
73         --pid-path=%{_localstatedir}/run/%{name}.pid \
74         --user=nginx \
75         --group=nginx \
76         %{?with_stub_status:--with-http_stub_status_module} \
77         %{?with_rtsig:--with-rtsig_module} \
78         %{?with_select:--with-select_module} \
79         %{?with_poll:--with-poll_module} \
80         %{?with_ssl:--with-http_ssl_module} \
81         %{?with_imap:--with-imap} \
82         %{?with_http_browser:--without-http_browser_module} \
83         --http-log-path=%{_localstatedir}/log/%{name}/access.log \
84         --http-client-body-temp-path=%{_localstatedir}/cache/%{name}/client_body_temp \
85         --http-proxy-temp-path=%{_localstatedir}/cache/%{name}/proxy_temp \
86         --http-fastcgi-temp-path=%{_localstatedir}/cache/%{name}/fastcgi_temp \
87         --with-cc="%{__cc}" \
88         --with-cc-opt="%{rpmcflags}" \
89         --with-ld-opt="%{rpmldflags}" \
90         %{?debug:--with-debug}
91
92 %{__make}
93
94 %install
95 rm -rf $RPM_BUILD_ROOT
96 install -d $RPM_BUILD_ROOT/etc/rc.d/init.d \
97         $RPM_BUILD_ROOT%{_nginxdir}/{cgi-bin,html,errors} \
98         $RPM_BUILD_ROOT{%{_localstatedir}/log/{%{name},archive/%{name}},%{_localstatedir}/cache/%{name}} \
99         $RPM_BUILD_ROOT{%{_sbindir},%{_sysconfdir}}
100
101 install conf/* $RPM_BUILD_ROOT%{_sysconfdir}
102 install mime.types $RPM_BUILD_ROOT%{_sysconfdir}/mime.types
103 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
104 install %{SOURCE3} $RPM_BUILD_ROOT%{_nginxdir}/html/favicon.ico
105 install %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/proxy.conf
106 install %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/nginx.monitrc
107 install %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/nginx.conf
108
109 install objs/%{name} $RPM_BUILD_ROOT%{_sbindir}/%{name}
110
111 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/*.default
112 rm -rf $RPM_BUILD_ROOT%{_prefix}/html
113
114 %clean
115 rm -rf $RPM_BUILD_ROOT
116
117 %pre
118 %groupadd -r -g 213 %{name}
119 %groupadd -g 51 http
120 %useradd -r -u 213 -d /usr/share/empty -s /bin/false -c "Nginx HTTP User" -g %{name} %{name}
121 %addusertogroup %{name} http
122
123 %post
124 for a in access.log error.log; do
125         if [ ! -f /var/log/%{name}/$a ]; then
126                 touch /var/log/%{name}/$a
127                 chown nginx:nginx /var/log/%{name}/$a
128                 chmod 644 /var/log/%{name}/$a
129         fi
130 done
131 /sbin/chkconfig --add %{name}
132 %service %{name} restart
133
134 %preun
135 if [ "$1" = "0" ]; then
136         %service -q %{name} stop
137         /sbin/chkconfig --del %{name}
138 fi
139
140 %postun
141 if [ "$1" = "0" ]; then
142         %userremove %{name}
143         %groupremove %{name}
144 fi
145
146 %files
147 %defattr(644,root,root,755)
148 %doc CHANGES LICENSE README html/index.html conf/nginx.conf
149 %doc %lang(ru) CHANGES.ru
150 %attr(754,root,root) /etc/rc.d/init.d/%{name}
151 %dir %attr(754,root,root) %{_sysconfdir}
152 %dir %{_nginxdir}
153 %dir %{_nginxdir}/cgi-bin
154 %dir %{_nginxdir}/html
155 %dir %{_nginxdir}/errors
156 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}.conf
157 %attr(640,root,root) %{_sysconfdir}/*[_-]*
158 %attr(640,root,root) %{_sysconfdir}/proxy.conf
159 %attr(640,root,root) %{_sysconfdir}/nginx.monitrc
160 %attr(640,root,root) %{_sysconfdir}/mime.types
161 %attr(755,root,root) %{_sbindir}/%{name}
162 %attr(770,root,%{name}) /var/cache/%{name}
163 %attr(750,%{name},logs) /var/log/%{name}
164 %config(noreplace,missingok) %verify(not md5 mtime size) %{_nginxdir}/html/*
165 #%attr(755,%{name},%{name}) %{_nginxdir}/html/favicon.ico
This page took 0.178674 seconds and 3 git commands to generate.