Gentoo Archives: gentoo-commits

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