Gentoo Archives: gentoo-commits

From: "Tiziano Mueller (dev-zero)" <dev-zero@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in www-servers/nginx: nginx-1.4.2-r1.ebuild ChangeLog
Date: Tue, 01 Oct 2013 10:21:16
Message-Id: 20131001102110.24F222004C@flycatcher.gentoo.org
1 dev-zero 13/10/01 10:21:10
2
3 Modified: ChangeLog
4 Added: nginx-1.4.2-r1.ebuild
5 Log:
6 Add push_stream module (bug #471754), warn only about permissions if the nginx user can not access it (refinement for bug #473036), do not install config files/keepdir for unused modules (bug #473864, thanks to jbergstroem).
7
8 (Portage version: 2.1.11.63/cvs/Linux x86_64, signed Manifest commit with key 0x1E0CA85F!)
9
10 Revision Changes Path
11 1.367 www-servers/nginx/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/nginx/ChangeLog?rev=1.367&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/nginx/ChangeLog?rev=1.367&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/nginx/ChangeLog?r1=1.366&r2=1.367
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/www-servers/nginx/ChangeLog,v
20 retrieving revision 1.366
21 retrieving revision 1.367
22 diff -u -r1.366 -r1.367
23 --- ChangeLog 27 Sep 2013 13:38:50 -0000 1.366
24 +++ ChangeLog 1 Oct 2013 10:21:09 -0000 1.367
25 @@ -1,6 +1,13 @@
26 # ChangeLog for www-servers/nginx
27 # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/ChangeLog,v 1.366 2013/09/27 13:38:50 dev-zero Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/ChangeLog,v 1.367 2013/10/01 10:21:09 dev-zero Exp $
30 +
31 +*nginx-1.4.2-r1 (01 Oct 2013)
32 +
33 + 01 Oct 2013; Tiziano Müller <dev-zero@g.o> +nginx-1.4.2-r1.ebuild:
34 + Add push_stream module (bug #471754), warn only about permissions if the nginx
35 + user can not access it (refinement for bug #473036), do not install config
36 + files/keepdir for unused modules (bug #473864, thanks to jbergstroem).
37
38 *nginx-1.4.2 (27 Sep 2013)
39
40
41
42
43 1.1 www-servers/nginx/nginx-1.4.2-r1.ebuild
44
45 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/nginx/nginx-1.4.2-r1.ebuild?rev=1.1&view=markup
46 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/nginx/nginx-1.4.2-r1.ebuild?rev=1.1&content-type=text/plain
47
48 Index: nginx-1.4.2-r1.ebuild
49 ===================================================================
50 # Copyright 1999-2013 Gentoo Foundation
51 # Distributed under the terms of the GNU General Public License v2
52 # $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/nginx-1.4.2-r1.ebuild,v 1.1 2013/10/01 10:21:09 dev-zero Exp $
53
54 EAPI="5"
55
56 # Maintainer notes:
57 # - http_rewrite-independent pcre-support makes sense for matching locations without an actual rewrite
58 # - any http-module activates the main http-functionality and overrides USE=-http
59 # - keep the following requirements in mind before adding external modules:
60 # * alive upstream
61 # * sane packaging
62 # * builds cleanly
63 # * does not need a patch for nginx core
64 # - TODO: test the google-perftools module (included in vanilla tarball)
65
66 # prevent perl-module from adding automagic perl DEPENDs
67 GENTOO_DEPEND_ON_PERL="no"
68
69 # syslog
70 SYSLOG_MODULE_PV="0.25"
71 SYSLOG_MODULE_NGINX_PV="1.3.14"
72 SYSLOG_MODULE_P="ngx_syslog-${SYSLOG_MODULE_PV}"
73 SYSLOG_MODULE_URI="https://github.com/yaoweibin/nginx_syslog_patch/archive/v${SYSLOG_MODULE_PV}.tar.gz"
74 SYSLOG_MODULE_WD="${WORKDIR}/nginx_syslog_patch-${SYSLOG_MODULE_PV}"
75
76 # devel_kit (https://github.com/simpl/ngx_devel_kit, BSD license)
77 DEVEL_KIT_MODULE_PV="0.2.18"
78 DEVEL_KIT_MODULE_P="ngx_devel_kit-${DEVEL_KIT_MODULE_PV}-r1"
79 DEVEL_KIT_MODULE_URI="https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KIT_MODULE_PV}.tar.gz"
80 DEVEL_KIT_MODULE_WD="${WORKDIR}/ngx_devel_kit-${DEVEL_KIT_MODULE_PV}"
81
82 # http_uploadprogress (https://github.com/masterzen/nginx-upload-progress-module, BSD-2 license)
83 HTTP_UPLOAD_PROGRESS_MODULE_PV="0.9.0"
84 HTTP_UPLOAD_PROGRESS_MODULE_P="ngx_http_upload_progress-${HTTP_UPLOAD_PROGRESS_MODULE_PV}-r1"
85 HTTP_UPLOAD_PROGRESS_MODULE_URI="https://github.com/masterzen/nginx-upload-progress-module/archive/v${HTTP_UPLOAD_PROGRESS_MODULE_PV}.tar.gz"
86 HTTP_UPLOAD_PROGRESS_MODULE_WD="${WORKDIR}/nginx-upload-progress-module-${HTTP_UPLOAD_PROGRESS_MODULE_PV}"
87
88 # http_headers_more (http://github.com/agentzh/headers-more-nginx-module, BSD license)
89 HTTP_HEADERS_MORE_MODULE_PV="0.22"
90 HTTP_HEADERS_MORE_MODULE_P="ngx_http_headers_more-${HTTP_HEADERS_MORE_MODULE_PV}-r1"
91 HTTP_HEADERS_MORE_MODULE_URI="https://github.com/agentzh/headers-more-nginx-module/archive/v${HTTP_HEADERS_MORE_MODULE_PV}.tar.gz"
92 HTTP_HEADERS_MORE_MODULE_WD="${WORKDIR}/headers-more-nginx-module-${HTTP_HEADERS_MORE_MODULE_PV}"
93
94 # http_push (http://pushmodule.slact.net/, MIT license)
95 HTTP_PUSH_MODULE_PV="0.692"
96 HTTP_PUSH_MODULE_P="ngx_http_push-${HTTP_PUSH_MODULE_PV}"
97 HTTP_PUSH_MODULE_URI="http://pushmodule.slact.net/downloads/nginx_http_push_module-${HTTP_PUSH_MODULE_PV}.tar.gz"
98 HTTP_PUSH_MODULE_WD="${WORKDIR}/nginx_http_push_module-${HTTP_PUSH_MODULE_PV}"
99
100 # http_cache_purge (http://labs.frickle.com/nginx_ngx_cache_purge/, BSD-2 license)
101 HTTP_CACHE_PURGE_MODULE_PV="2.1"
102 HTTP_CACHE_PURGE_MODULE_P="ngx_http_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}"
103 HTTP_CACHE_PURGE_MODULE_URI="http://labs.frickle.com/files/ngx_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}.tar.gz"
104 HTTP_CACHE_PURGE_MODULE_WD="${WORKDIR}/ngx_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}"
105
106 # http_slowfs_cache (http://labs.frickle.com/nginx_ngx_slowfs_cache/, BSD-2 license)
107 HTTP_SLOWFS_CACHE_MODULE_PV="1.10"
108 HTTP_SLOWFS_CACHE_MODULE_P="ngx_http_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}"
109 HTTP_SLOWFS_CACHE_MODULE_URI="http://labs.frickle.com/files/ngx_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}.tar.gz"
110 HTTP_SLOWFS_CACHE_MODULE_WD="${WORKDIR}/ngx_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}"
111
112 # http_fancyindex (http://wiki.nginx.org/NgxFancyIndex, BSD license)
113 HTTP_FANCYINDEX_MODULE_PV="0.3.2"
114 HTTP_FANCYINDEX_MODULE_P="ngx_http_fancyindex-${HTTP_FANCYINDEX_MODULE_PV}"
115 HTTP_FANCYINDEX_MODULE_URI="https://github.com/aperezdc/ngx-fancyindex/archive/v${HTTP_FANCYINDEX_MODULE_PV}.tar.gz"
116 HTTP_FANCYINDEX_MODULE_WD="${WORKDIR}/ngx-fancyindex-${HTTP_FANCYINDEX_MODULE_PV}"
117
118 # http_lua (https://github.com/chaoslawful/lua-nginx-module, BSD license)
119 HTTP_LUA_MODULE_PV="0.8.10"
120 HTTP_LUA_MODULE_P="ngx_http_lua-${HTTP_LUA_MODULE_PV}"
121 HTTP_LUA_MODULE_URI="https://github.com/chaoslawful/lua-nginx-module/archive/v${HTTP_LUA_MODULE_PV}.tar.gz"
122 HTTP_LUA_MODULE_WD="${WORKDIR}/lua-nginx-module-${HTTP_LUA_MODULE_PV}"
123
124 # http_auth_pam (http://web.iti.upv.es/~sto/nginx/, BSD-2 license)
125 HTTP_AUTH_PAM_MODULE_PV="1.3"
126 HTTP_AUTH_PAM_MODULE_P="ngx_http_auth_pam-${HTTP_AUTH_PAM_MODULE_PV}"
127 HTTP_AUTH_PAM_MODULE_URI="http://web.iti.upv.es/~sto/nginx/ngx_http_auth_pam_module-${HTTP_AUTH_PAM_MODULE_PV}.tgz"
128 HTTP_AUTH_PAM_MODULE_WD="${WORKDIR}/ngx_http_auth_pam_module-${HTTP_AUTH_PAM_MODULE_PV}"
129
130 # http_upstream_check (https://github.com/yaoweibin/nginx_upstream_check_module, BSD license)
131 HTTP_UPSTREAM_CHECK_MODULE_PV="0.1.9"
132 HTTP_UPSTREAM_CHECK_MODULE_P="ngx_http_upstream_check-${HTTP_UPSTREAM_CHECK_MODULE_PV}"
133 HTTP_UPSTREAM_CHECK_MODULE_URI="https://github.com/yaoweibin/nginx_upstream_check_module/archive/v${HTTP_UPSTREAM_CHECK_MODULE_PV}.tar.gz"
134 HTTP_UPSTREAM_CHECK_MODULE_WD="${WORKDIR}/nginx_upstream_check_module-${HTTP_UPSTREAM_CHECK_MODULE_PV}"
135
136 # http_metrics (https://github.com/madvertise/ngx_metrics, BSD license)
137 HTTP_METRICS_MODULE_PV="0.1.1"
138 HTTP_METRICS_MODULE_P="ngx_metrics-${HTTP_METRICS_MODULE_PV}"
139 HTTP_METRICS_MODULE_URI="https://github.com/madvertise/ngx_metrics/archive/v${HTTP_METRICS_MODULE_PV}.tar.gz"
140 HTTP_METRICS_MODULE_WD="${WORKDIR}/ngx_metrics-${HTTP_METRICS_MODULE_PV}"
141
142 # naxsi-core (https://github.com/nbs-system/naxsi, GPLv2+)
143 HTTP_NAXSI_MODULE_PV="0.52-1"
144 HTTP_NAXSI_MODULE_P="ngx_http_naxsi-${HTTP_NAXSI_MODULE_PV}"
145 HTTP_NAXSI_MODULE_URI="https://github.com/nbs-system/naxsi/archive/${HTTP_NAXSI_MODULE_PV}.tar.gz"
146 HTTP_NAXSI_MODULE_WD="${WORKDIR}/naxsi-${HTTP_NAXSI_MODULE_PV}/naxsi_src"
147
148 # nginx-rtmp-module (http://github.com/arut/nginx-rtmp-module, BSD license)
149 RTMP_MODULE_PV="1.0.4"
150 RTMP_MODULE_P="ngx_rtmp-${RTMP_MODULE_PV}"
151 RTMP_MODULE_URI="http://github.com/arut/nginx-rtmp-module/archive/v${RTMP_MODULE_PV}.tar.gz"
152 RTMP_MODULE_WD="${WORKDIR}/nginx-rtmp-module-${RTMP_MODULE_PV}"
153
154 # nginx-dav-ext-module (http://github.com/arut/nginx-dav-ext-module, BSD license)
155 HTTP_DAV_EXT_MODULE_PV="0.0.2"
156 HTTP_DAV_EXT_MODULE_P="ngx_http_dav_ext-${HTTP_DAV_EXT_MODULE_PV}"
157 HTTP_DAV_EXT_MODULE_URI="http://github.com/arut/nginx-dav-ext-module/archive/v${HTTP_DAV_EXT_MODULE_PV}.tar.gz"
158 HTTP_DAV_EXT_MODULE_WD="${WORKDIR}/nginx-dav-ext-module-${HTTP_DAV_EXT_MODULE_PV}"
159
160 # echo-nginx-module (https://github.com/agentzh/echo-nginx-module, BSD license)
161 HTTP_ECHO_MODULE_PV="0.48"
162 HTTP_ECHO_MODULE_P="ngx_http_echo-${HTTP_ECHO_MODULE_PV}"
163 HTTP_ECHO_MODULE_URI="https://github.com/agentzh/echo-nginx-module/archive/v${HTTP_ECHO_MODULE_PV}.tar.gz"
164 HTTP_ECHO_MODULE_WD="${WORKDIR}/echo-nginx-module-${HTTP_ECHO_MODULE_PV}"
165
166 # mod_security for nginx (https://modsecurity.org/, Apache-2.0)
167 # keep the MODULE_P here consistent with upstream to avoid tarball duplication
168 HTTP_SECURITY_MODULE_PV="2.7.5"
169 HTTP_SECURITY_MODULE_P="modsecurity-apache_${HTTP_SECURITY_MODULE_PV}"
170 HTTP_SECURITY_MODULE_URI="https://www.modsecurity.org/tarball/${HTTP_SECURITY_MODULE_PV}/${HTTP_SECURITY_MODULE_P}.tar.gz"
171 HTTP_SECURITY_MODULE_WD="${WORKDIR}/${HTTP_SECURITY_MODULE_P}"
172
173 # push-stream-module (https://github.com/wandenberg/nginx-push-stream-module,GPL-3)
174 HTTP_PUSH_STREAM_MODULE_PV="0.3.5"
175 HTTP_PUSH_STREAM_MODULE_P="ngx_http_push_stream-${HTTP_PUSH_STREAM_MODULE_PV}"
176 HTTP_PUSH_STREAM_MODULE_URI="https://github.com/wandenberg/nginx-push-stream-module/archive/${HTTP_PUSH_STREAM_MODULE_PV}.tar.gz"
177 HTTP_PUSH_STREAM_MODULE_WD="${WORKDIR}/nginx-push-stream-module-${HTTP_PUSH_STREAM_MODULE_PV}"
178
179 inherit eutils ssl-cert toolchain-funcs perl-module flag-o-matic user systemd versionator
180
181 DESCRIPTION="Robust, small and high performance http and reverse proxy server"
182 HOMEPAGE="http://nginx.org"
183 SRC_URI="http://nginx.org/download/${P}.tar.gz
184 syslog? ( ${SYSLOG_MODULE_URI} -> ${SYSLOG_MODULE_P}.tar.gz )
185 ${DEVEL_KIT_MODULE_URI} -> ${DEVEL_KIT_MODULE_P}.tar.gz
186 nginx_modules_http_upload_progress? ( ${HTTP_UPLOAD_PROGRESS_MODULE_URI} -> ${HTTP_UPLOAD_PROGRESS_MODULE_P}.tar.gz )
187 nginx_modules_http_headers_more? ( ${HTTP_HEADERS_MORE_MODULE_URI} -> ${HTTP_HEADERS_MORE_MODULE_P}.tar.gz )
188 nginx_modules_http_push? ( ${HTTP_PUSH_MODULE_URI} -> ${HTTP_PUSH_MODULE_P}.tar.gz )
189 nginx_modules_http_cache_purge? ( ${HTTP_CACHE_PURGE_MODULE_URI} -> ${HTTP_CACHE_PURGE_MODULE_P}.tar.gz )
190 nginx_modules_http_slowfs_cache? ( ${HTTP_SLOWFS_CACHE_MODULE_URI} -> ${HTTP_SLOWFS_CACHE_MODULE_P}.tar.gz )
191 nginx_modules_http_fancyindex? ( ${HTTP_FANCYINDEX_MODULE_URI} -> ${HTTP_FANCYINDEX_MODULE_P}.tar.gz )
192 nginx_modules_http_lua? ( ${HTTP_LUA_MODULE_URI} -> ${HTTP_LUA_MODULE_P}.tar.gz )
193 nginx_modules_http_auth_pam? ( ${HTTP_AUTH_PAM_MODULE_URI} -> ${HTTP_AUTH_PAM_MODULE_P}.tar.gz )
194 nginx_modules_http_upstream_check? ( ${HTTP_UPSTREAM_CHECK_MODULE_URI} -> ${HTTP_UPSTREAM_CHECK_MODULE_P}.tar.gz )
195 nginx_modules_http_metrics? ( ${HTTP_METRICS_MODULE_URI} -> ${HTTP_METRICS_MODULE_P}.tar.gz )
196 nginx_modules_http_naxsi? ( ${HTTP_NAXSI_MODULE_URI} -> ${HTTP_NAXSI_MODULE_P}.tar.gz )
197 rtmp? ( ${RTMP_MODULE_URI} -> ${RTMP_MODULE_P}.tar.gz )
198 nginx_modules_http_dav_ext? ( ${HTTP_DAV_EXT_MODULE_URI} -> ${HTTP_DAV_EXT_MODULE_P}.tar.gz )
199 nginx_modules_http_echo? ( ${HTTP_ECHO_MODULE_URI} -> ${HTTP_ECHO_MODULE_P}.tar.gz )
200 nginx_modules_http_security? ( ${HTTP_SECURITY_MODULE_URI} -> ${HTTP_SECURITY_MODULE_P}.tar.gz )
201 nginx_modules_http_push_stream? ( ${HTTP_PUSH_STREAM_MODULE_URI} -> ${HTTP_PUSH_STREAM_MODULE_P}.tar.gz )"
202
203 LICENSE="BSD-2 BSD SSLeay MIT GPL-2 GPL-2+
204 nginx_modules_http_security? ( Apache-2.0 )
205 nginx_modules_http_push_stream? ( GPL-3 )"
206
207 SLOT="0"
208 KEYWORDS="~amd64 ~arm ~ppc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
209
210 NGINX_MODULES_STD="access auth_basic autoindex browser charset empty_gif fastcgi
211 geo gzip limit_req limit_conn map memcached proxy referer rewrite scgi ssi
212 split_clients upstream_ip_hash userid uwsgi"
213 NGINX_MODULES_OPT="addition dav degradation flv geoip gunzip gzip_static image_filter
214 mp4 perl random_index realip secure_link spdy stub_status sub xslt"
215 NGINX_MODULES_MAIL="imap pop3 smtp"
216 NGINX_MODULES_3RD="
217 http_upload_progress
218 http_headers_more
219 http_push
220 http_cache_purge
221 http_slowfs_cache
222 http_fancyindex
223 http_lua
224 http_auth_pam
225 http_upstream_check
226 http_metrics
227 http_naxsi
228 http_dav_ext
229 http_echo
230 http_security
231 http_push_stream"
232
233 IUSE="aio debug +http +http-cache ipv6 libatomic +pcre pcre-jit rtmp selinux ssl
234 syslog userland_GNU vim-syntax"
235
236 for mod in $NGINX_MODULES_STD; do
237 IUSE="${IUSE} +nginx_modules_http_${mod}"
238 done
239
240 for mod in $NGINX_MODULES_OPT; do
241 IUSE="${IUSE} nginx_modules_http_${mod}"
242 done
243
244 for mod in $NGINX_MODULES_MAIL; do
245 IUSE="${IUSE} nginx_modules_mail_${mod}"
246 done
247
248 for mod in $NGINX_MODULES_3RD; do
249 IUSE="${IUSE} nginx_modules_${mod}"
250 done
251
252 CDEPEND="
253 pcre? ( >=dev-libs/libpcre-4.2 )
254 pcre-jit? ( >=dev-libs/libpcre-8.20[jit] )
255 selinux? ( sec-policy/selinux-nginx )
256 ssl? ( dev-libs/openssl )
257 http-cache? ( userland_GNU? ( dev-libs/openssl ) )
258 nginx_modules_http_geoip? ( dev-libs/geoip )
259 nginx_modules_http_gunzip? ( sys-libs/zlib )
260 nginx_modules_http_gzip? ( sys-libs/zlib )
261 nginx_modules_http_gzip_static? ( sys-libs/zlib )
262 nginx_modules_http_image_filter? ( media-libs/gd[jpeg,png] )
263 nginx_modules_http_perl? ( >=dev-lang/perl-5.8 )
264 nginx_modules_http_rewrite? ( >=dev-libs/libpcre-4.2 )
265 nginx_modules_http_secure_link? ( userland_GNU? ( dev-libs/openssl ) )
266 nginx_modules_http_spdy? ( >=dev-libs/openssl-1.0.1c )
267 nginx_modules_http_xslt? ( dev-libs/libxml2 dev-libs/libxslt )
268 nginx_modules_http_lua? ( || ( dev-lang/lua dev-lang/luajit ) )
269 nginx_modules_http_auth_pam? ( virtual/pam )
270 nginx_modules_http_metrics? ( dev-libs/yajl )
271 nginx_modules_http_dav_ext? ( dev-libs/expat )
272 nginx_modules_http_security? ( >=dev-libs/libxml2-2.7.8 dev-libs/apr-util www-servers/apache )"
273 RDEPEND="${CDEPEND}"
274 DEPEND="${CDEPEND}
275 arm? ( dev-libs/libatomic_ops )
276 libatomic? ( dev-libs/libatomic_ops )"
277 PDEPEND="vim-syntax? ( app-vim/nginx-syntax )"
278
279 REQUIRED_USE="pcre-jit? ( pcre )
280 nginx_modules_http_lua? ( nginx_modules_http_rewrite )
281 nginx_modules_http_naxsi? ( pcre )
282 nginx_modules_http_dav_ext? ( nginx_modules_http_dav )
283 nginx_modules_http_metrics? ( nginx_modules_http_stub_status )
284 nginx_modules_http_security? ( pcre )
285 nginx_modules_http_push_stream? ( ssl )"
286
287 pkg_setup() {
288 NGINX_HOME="/var/lib/nginx"
289 NGINX_HOME_TMP="${NGINX_HOME}/tmp"
290
291 ebegin "Creating nginx user and group"
292 enewgroup ${PN}
293 enewuser ${PN} -1 -1 "${NGINX_HOME}" ${PN}
294 eend $?
295
296 if use libatomic; then
297 ewarn "GCC 4.1+ features built-in atomic operations."
298 ewarn "Using libatomic_ops is only needed if using"
299 ewarn "a different compiler or a GCC prior to 4.1"
300 fi
301
302 if [[ -n $NGINX_ADD_MODULES ]]; then
303 ewarn "You are building custom modules via \$NGINX_ADD_MODULES!"
304 ewarn "This nginx installation is not supported!"
305 ewarn "Make sure you can reproduce the bug without those modules"
306 ewarn "_before_ reporting bugs."
307 fi
308
309 if use !http; then
310 ewarn "To actually disable all http-functionality you also have to disable"
311 ewarn "all nginx http modules."
312 fi
313 }
314
315 src_prepare() {
316 epatch "${FILESDIR}/${PN}-1.4.1-fix-perl-install-path.patch"
317
318 if use syslog; then
319 epatch "${SYSLOG_MODULE_WD}"/syslog_${SYSLOG_MODULE_NGINX_PV}.patch
320 fi
321
322 if use nginx_modules_http_upstream_check; then
323 epatch "${HTTP_UPSTREAM_CHECK_MODULE_WD}"/check_1.2.6+.patch
324 fi
325
326 if use nginx_modules_http_security; then
327 cd "${HTTP_SECURITY_MODULE_WD}/nginx/modsecurity"
328 epatch "${FILESDIR}/modsecurity-${HTTP_SECURITY_MODULE_PV}-include-paths.patch"
329 cd -
330 fi
331
332 find auto/ -type f -print0 | xargs -0 sed -i 's:\&\& make:\&\& \\$(MAKE):' || die
333 # We have config protection, don't rename etc files
334 sed -i 's:.default::' auto/install || die
335 # remove useless files
336 sed -i -e '/koi-/d' -e '/win-/d' auto/install || die
337
338 # don't install to /etc/nginx/ if not in use
339 local module
340 for module in fastcgi scgi uwsgi ; do
341 if ! use nginx_modules_http_${module}; then
342 sed -i -e "/${module}/d" auto/install || die
343 fi
344 done
345
346 epatch_user
347 }
348
349 src_configure() {
350 local myconf= http_enabled= mail_enabled=
351
352 use aio && myconf+=" --with-file-aio --with-aio_module"
353 use debug && myconf+=" --with-debug"
354 use ipv6 && myconf+=" --with-ipv6"
355 use libatomic && myconf+=" --with-libatomic"
356 use pcre && myconf+=" --with-pcre"
357 use pcre-jit && myconf+=" --with-pcre-jit"
358
359 # syslog support
360 if use syslog; then
361 myconf+=" --add-module=${SYSLOG_MODULE_WD}"
362 fi
363
364 # HTTP modules
365 for mod in $NGINX_MODULES_STD; do
366 if use nginx_modules_http_${mod}; then
367 http_enabled=1
368 else
369 myconf+=" --without-http_${mod}_module"
370 fi
371 done
372
373 for mod in $NGINX_MODULES_OPT; do
374 if use nginx_modules_http_${mod}; then
375 http_enabled=1
376 myconf+=" --with-http_${mod}_module"
377 fi
378 done
379
380 if use nginx_modules_http_fastcgi; then
381 myconf+=" --with-http_realip_module"
382 fi
383
384 # third-party modules
385 if use nginx_modules_http_upload_progress; then
386 http_enabled=1
387 myconf+=" --add-module=${HTTP_UPLOAD_PROGRESS_MODULE_WD}"
388 fi
389
390 if use nginx_modules_http_headers_more; then
391 http_enabled=1
392 myconf+=" --add-module=${HTTP_HEADERS_MORE_MODULE_WD}"
393 fi
394
395 if use nginx_modules_http_push; then
396 http_enabled=1
397 myconf+=" --add-module=${HTTP_PUSH_MODULE_WD}"
398 fi
399
400 if use nginx_modules_http_cache_purge; then
401 http_enabled=1
402 myconf+=" --add-module=${HTTP_CACHE_PURGE_MODULE_WD}"
403 fi
404
405 if use nginx_modules_http_slowfs_cache; then
406 http_enabled=1
407 myconf+=" --add-module=${HTTP_SLOWFS_CACHE_MODULE_WD}"
408 fi
409
410 if use nginx_modules_http_fancyindex; then
411 http_enabled=1
412 myconf+=" --add-module=${HTTP_FANCYINDEX_MODULE_WD}"
413 fi
414
415 if use nginx_modules_http_lua; then
416 http_enabled=1
417 myconf+=" --add-module=${DEVEL_KIT_MODULE_WD}"
418 myconf+=" --add-module=${HTTP_LUA_MODULE_WD}"
419 fi
420
421 if use nginx_modules_http_auth_pam; then
422 http_enabled=1
423 myconf+=" --add-module=${HTTP_AUTH_PAM_MODULE_WD}"
424 fi
425
426 if use nginx_modules_http_upstream_check; then
427 http_enabled=1
428 myconf+=" --add-module=${HTTP_UPSTREAM_CHECK_MODULE_WD}"
429 fi
430
431 if use nginx_modules_http_metrics; then
432 http_enabled=1
433 myconf+=" --add-module=${HTTP_METRICS_MODULE_WD}"
434 fi
435
436 if use nginx_modules_http_naxsi ; then
437 http_enabled=1
438 myconf+=" --add-module=${HTTP_NAXSI_MODULE_WD}"
439 fi
440
441 if use rtmp ; then
442 http_enabled=1
443 myconf+=" --add-module=${RTMP_MODULE_WD}"
444 fi
445
446 if use nginx_modules_http_dav_ext ; then
447 http_enabled=1
448 myconf+=" --add-module=${HTTP_DAV_EXT_MODULE_WD}"
449 fi
450
451 if use nginx_modules_http_echo ; then
452 http_enabled=1
453 myconf+=" --add-module=${HTTP_ECHO_MODULE_WD}"
454 fi
455
456 if use nginx_modules_http_security ; then
457 http_enabled=1
458 myconf+=" --add-module=${HTTP_SECURITY_MODULE_WD}/nginx/modsecurity"
459 fi
460
461 if use nginx_modules_http_push_stream ; then
462 http_enabled=1
463 myconf+=" --add-module=${HTTP_PUSH_STREAM_MODULE_WD}"
464 fi
465
466 if use http || use http-cache; then
467 http_enabled=1
468 fi
469
470 if [ $http_enabled ]; then
471 use http-cache || myconf+=" --without-http-cache"
472 use ssl && myconf+=" --with-http_ssl_module"
473 else
474 myconf+=" --without-http --without-http-cache"
475 fi
476
477 # MAIL modules
478 for mod in $NGINX_MODULES_MAIL; do
479 if use nginx_modules_mail_${mod}; then
480 mail_enabled=1
481 else
482 myconf+=" --without-mail_${mod}_module"
483 fi
484 done
485
486 if [ $mail_enabled ]; then
487 myconf+=" --with-mail"
488 use ssl && myconf+=" --with-mail_ssl_module"
489 fi
490
491 # custom modules
492 for mod in $NGINX_ADD_MODULES; do
493 myconf+=" --add-module=${mod}"
494 done
495
496 # https://bugs.gentoo.org/286772
497 export LANG=C LC_ALL=C
498 tc-export CC
499
500 if ! use prefix; then
501 myconf+=" --user=${PN} --group=${PN}"
502 fi
503
504 ./configure \
505 --prefix="${EPREFIX}"/usr \
506 --conf-path="${EPREFIX}"/etc/${PN}/${PN}.conf \
507 --error-log-path="${EPREFIX}"/var/log/${PN}/error_log \
508 --pid-path="${EPREFIX}"/run/${PN}.pid \
509 --lock-path="${EPREFIX}"/run/lock/${PN}.lock \
510 --with-cc-opt="-I${EROOT}usr/include" \
511 --with-ld-opt="-L${EROOT}usr/lib" \
512 --http-log-path="${EPREFIX}"/var/log/${PN}/access_log \
513 --http-client-body-temp-path="${EPREFIX}/${NGINX_HOME_TMP}"/client \
514 --http-proxy-temp-path="${EPREFIX}/${NGINX_HOME_TMP}"/proxy \
515 --http-fastcgi-temp-path="${EPREFIX}/${NGINX_HOME_TMP}"/fastcgi \
516 --http-scgi-temp-path="${EPREFIX}/${NGINX_HOME_TMP}"/scgi \
517 --http-uwsgi-temp-path="${EPREFIX}/${NGINX_HOME_TMP}"/uwsgi \
518 ${myconf} || die "configure failed"
519
520 if use nginx_modules_http_security; then
521 cd "${HTTP_SECURITY_MODULE_WD}"
522 ./configure --enable-standalone-module || die "configure failed for mod_security"
523 fi
524 }
525
526 src_compile() {
527 use nginx_modules_http_security && emake -C "${HTTP_SECURITY_MODULE_WD}"
528
529 # https://bugs.gentoo.org/286772
530 export LANG=C LC_ALL=C
531 emake LINK="${CC} ${LDFLAGS}" OTHERLDFLAGS="${LDFLAGS}"
532 }
533
534 src_install() {
535 emake DESTDIR="${D}" install
536
537 cp "${FILESDIR}"/nginx.conf "${ED}"/etc/nginx/nginx.conf || die
538
539 newinitd "${FILESDIR}"/nginx.initd-r2 nginx
540
541 systemd_newunit "${FILESDIR}"/nginx.service-r1 nginx.service
542
543 doman man/nginx.8
544 dodoc CHANGES* README
545
546 # just keepdir. do not copy the default htdocs files (bug #449136)
547 keepdir /var/www/localhost
548 rm -rf "${D}"/usr/html || die
549
550 # set up a list of directories to keep
551 local keepdir_list="${NGINX_HOME_TMP}"/client
552 local module
553 for module in proxy fastcgi scgi uwsgi; do
554 use nginx_modules_http_${module} && keepdir_list+=" ${NGINX_HOME_TMP}/${module}"
555 done
556
557 keepdir /var/log/nginx ${keepdir_list}
558
559 # this solves a problem with SELinux where nginx doesn't see the directories
560 # as root and tries to create them as nginx
561 fperms 0750 "${NGINX_HOME_TMP}"
562 fowners ${PN}:0 "${NGINX_HOME_TMP}"
563
564 fperms 0700 /var/log/nginx ${keepdir_list}
565 fowners ${PN}:${PN} /var/log/nginx ${keepdir_list}
566
567 # logrotate
568 insinto /etc/logrotate.d
569 newins "${FILESDIR}"/nginx.logrotate nginx
570
571 if use nginx_modules_http_perl; then
572 cd "${S}"/objs/src/http/modules/perl/
573 einstall DESTDIR="${D}" INSTALLDIRS=vendor
574 fixlocalpod
575 fi
576
577 if use syslog; then
578 docinto ${SYSLOG_MODULE_P}
579 dodoc "${SYSLOG_MODULE_WD}"/README
580 fi
581
582 if use nginx_modules_http_push; then
583 docinto ${HTTP_PUSH_MODULE_P}
584 dodoc "${HTTP_PUSH_MODULE_WD}"/{changelog.txt,protocol.txt,README}
585 fi
586
587 if use nginx_modules_http_cache_purge; then
588 docinto ${HTTP_CACHE_PURGE_MODULE_P}
589 dodoc "${HTTP_CACHE_PURGE_MODULE_WD}"/{CHANGES,README.md,TODO.md}
590 fi
591
592 if use nginx_modules_http_slowfs_cache; then
593 docinto ${HTTP_SLOWFS_CACHE_MODULE_P}
594 dodoc "${HTTP_SLOWFS_CACHE_MODULE_WD}"/{CHANGES,README.md}
595 fi
596
597 if use nginx_modules_http_fancyindex; then
598 docinto ${HTTP_FANCYINDEX_MODULE_P}
599 dodoc "${HTTP_FANCYINDEX_MODULE_WD}"/README.rst
600 fi
601
602 if use nginx_modules_http_lua; then
603 docinto ${HTTP_LUA_MODULE_P}
604 dodoc "${HTTP_LUA_MODULE_WD}"/{Changes,README.markdown}
605 fi
606
607 if use nginx_modules_http_auth_pam; then
608 docinto ${HTTP_AUTH_PAM_MODULE_P}
609 dodoc "${HTTP_AUTH_PAM_MODULE_WD}"/{README,ChangeLog}
610 fi
611
612 if use nginx_modules_http_upstream_check; then
613 docinto ${HTTP_UPSTREAM_CHECK_MODULE_P}
614 dodoc "${HTTP_UPSTREAM_CHECK_MODULE_WD}"/{README,CHANGES}
615 fi
616
617 # README.md is still empty
618 # if use nginx_modules_http_metrics; then
619 # docinto ${HTTP_METRICS_MODULE_P}
620 # dodoc "${HTTP_METRICS_MODULE_WD}"/README.md
621 # fi
622
623 if use nginx_modules_http_naxsi; then
624 insinto /etc/nginx
625 doins "${HTTP_NAXSI_MODULE_WD}"/../naxsi_config/naxsi_core.rules
626 fi
627
628 if use rtmp; then
629 docinto ${RTMP_MODULE_P}
630 dodoc "${RTMP_MODULE_WD}"/{AUTHORS,README.md,TODO,stat.xsl}
631 fi
632
633 if use nginx_modules_http_dav_ext; then
634 docinto ${HTTP_DAV_EXT_MODULE_P}
635 dodoc "${HTTP_DAV_EXT_MODULE_WD}"/README
636 fi
637
638 if use nginx_modules_http_echo; then
639 docinto ${HTTP_ECHO_MODULE_P}
640 dodoc "${HTTP_ECHO_MODULE_WD}"/{README,README.markdown,doc/HttpEchoModule.wiki}
641 fi
642
643 if use nginx_modules_http_security; then
644 docinto ${HTTP_SECURITY_MODULE_P}
645 dodoc "${HTTP_SECURITY_MODULE_WD}"/{CHANGES,README.TXT,authors.txt}
646 fi
647
648 if use nginx_modules_http_push_stream; then
649 docinto ${HTTP_PUSH_STREAM_MODULE_P}
650 dodoc "${HTTP_PUSH_STREAM_MODULE_WD}"/{AUTHORS,CHANGELOG.textile,README.textile}
651 fi
652 }
653
654 pkg_postinst() {
655 if use ssl; then
656 if [ ! -f "${EROOT}"/etc/ssl/${PN}/${PN}.key ]; then
657 install_cert /etc/ssl/${PN}/${PN}
658 use prefix || chown ${PN}:${PN} "${EROOT}"/etc/ssl/${PN}/${PN}.{crt,csr,key,pem}
659 fi
660 fi
661
662 if use nginx_modules_http_lua && use nginx_modules_http_spdy; then
663 ewarn "Lua 3rd party module author warns against using ${P} with"
664 ewarn "NGINX_MODULES_HTTP=\"lua spdy\". For more info, see http://git.io/OldLsg"
665 fi
666
667 # This is the proper fix for bug #458726/#469094, resp. CVE-2013-0337 for
668 # existing installations
669 local fix_perms=0
670
671 for rv in ${REPLACING_VERSIONS} ; do
672 version_compare ${rv} 1.4.1-r2
673 [[ $? -eq 1 ]] && fix_perms=1
674 done
675
676 if [[ $fix_perms -eq 1 ]] ; then
677 ewarn "To fix a security bug (CVE-2013-0337, bug #458726) had the following"
678 ewarn "directories the world-readable bit removed (if set):"
679 ewarn " ${EPREFIX}/var/log/nginx"
680 ewarn " ${EPREFIX}${NGINX_HOME_TMP}/{,client,proxy,fastcgi,scgi,uwsgi}"
681 ewarn "Check if this is correct for your setup before restarting nginx!"
682 ewarn "This is a one-time change and will not happen on subsequent updates."
683 ewarn "Furthermore nginx' temp directories got moved to ${NGINX_HOME_TMP}"
684 chmod -f o-rwx "${EPREFIX}"/var/log/nginx "${EPREFIX}/${NGINX_HOME_TMP}"/{,client,proxy,fastcgi,scgi,uwsgi}
685 fi
686
687 # If the nginx user can't change into or read the dir, display a warning.
688 # If su is not available we display the warning nevertheless since we can't check properly
689 su -s /bin/sh -c 'cd /var/log/nginx/ && ls' nginx >&/dev/null
690 if [ $? -ne 0 ] ; then
691 ewarn "Please make sure that the nginx user or group has"
692 ewarn "'rx' permissions on /var/log/nginx (default on a fresh install)"
693 ewarn "Otherwise you end up with empty log files after a logrotate."
694 fi
695 }