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