Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-servers/nginx/
Date: Tue, 30 Mar 2021 17:45:19
Message-Id: 1617126312.e202e2b0086f8aace8d5699dc8046cf814c205e0.whissi@gentoo
1 commit: e202e2b0086f8aace8d5699dc8046cf814c205e0
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Tue Mar 30 17:44:38 2021 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Tue Mar 30 17:45:12 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e202e2b0
7
8 www-servers/nginx: bump to v1.19.9 mainline
9
10 - nginScript module bumped to v0.5.3
11
12 Package-Manager: Portage-3.0.17, Repoman-3.0.2
13 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
14
15 www-servers/nginx/Manifest | 2 +
16 www-servers/nginx/nginx-1.19.9.ebuild | 1090 +++++++++++++++++++++++++++++++++
17 2 files changed, 1092 insertions(+)
18
19 diff --git a/www-servers/nginx/Manifest b/www-servers/nginx/Manifest
20 index cfe278aa643..7aec1428e51 100644
21 --- a/www-servers/nginx/Manifest
22 +++ b/www-servers/nginx/Manifest
23 @@ -7,6 +7,7 @@ DIST nginx-1.19.5.tar.gz 1055590 BLAKE2B dc838848829553205886f1d538009ecccfd4b0d
24 DIST nginx-1.19.6.tar.gz 1055982 BLAKE2B 6d818122b3bdf46b6c9ecb83a00d470b3db0f26f05140340c033d1d0851d679d077ce1853f8d0a1c0140bfdac2764e5702913e87149dccefda2c6f7bf8ac8845 SHA512 1249c56b124a8de71f5d722e53d599f3b0cb14dc0f95b1eb905a6a8019b2d33f8e76874de2a88d49c4c82ee4fa7aabd42e5044a0a110892c23b50f71cb632148
25 DIST nginx-1.19.7.tar.gz 1056631 BLAKE2B f7a62a2b7c1a8c91a01e54954323cddc7a948ab5b65f51594549b8b67e50ea954c4cd5b740f538472c6de7c4041b39b22a48beac37083900e6f0a015408316bc SHA512 660f03533581f350bbfe9a519fd0ee59c543c78be98aa5287df20a89653545b29fc98282548eab1741fb1d5c26da140166b6712ee06e498ba518019588f9b747
26 DIST nginx-1.19.8.tar.gz 1060155 BLAKE2B c540cfb86886ad60beefcaffa7c9ad4f79807bdff3fed9f6c2f23d38d46aaba4f0489ada289f14881f206de290a37b58934254e9690a707ac639204602530218 SHA512 da548dc459f7a921e2f6ea54f543496244e820acbdf3effc4db331717f69b710181fbfdac3be101cd7d1c39e3ca37a94f9a9c4017f11da843ed85a34acf26bc2
27 +DIST nginx-1.19.9.tar.gz 1060580 BLAKE2B 896f58de8051dcf76fc65b9e8263099e7d4c797832b5f9c354fe2440ff4a3155c0d9139a4022e4d828d17f11259be6853b264e22e43a986d249b5dc53a075d35 SHA512 a418aa22046f641afd95ee661c77c469d21c9957aa5ab74c4186526fcd18e0d701ee933a76ab143081b4b3f8815484074c2609aa257646218bf6b4b739b3cb88
28 DIST nginx-auth-ldap-42d195d7a7575ebab1c369ad3fc5d78dc2c2669c.tar.gz 18457 BLAKE2B 22225ca9e5299b20ab5a93a001cac48e446bd86b3a24ac49e716bc975b128890bdb4b0dbbf5730fbaaeadfd958160093c7a6af798dd0e6de27062f149a760333 SHA512 ec59637fda5acac053e815cb1d04b545fc6b765e5ec63d8c2c9c301abad87afaa2698145acac08e9e14c91e1423ebff7aff0cca2b940b19ccccbf4cf53973269
29 DIST nginx_http_sticky_module_ng-1.2.6-10-g08a395c66e42.tar.bz2 124047 BLAKE2B d37ef9a15c91abe3c6258e420d1f99fa452f9d9966a0e13102174973314a3bac5413957a5fe632a9dcb1163b3be5df8116e05cc053ee061e19319ec25f341570 SHA512 6c1bfdcf89884b2855d51ae7da0f6e53a4ca3629e1aaf58433b70c07dcb2af797ba6e87d9b3eb4fe2fb6d4d697e862f2b4c2f8d8b3fdaea201740c97ec936529
30 DIST ngx_brotli-1.0.0rc.tar.gz 16207 BLAKE2B 450d0ea693bd98d4a1b615f2cdcaad41ccd28266f6d80beec7fe77fe750ab8c5d1bb55aabe15161b9b6d819d2b4d99a7774f2706f2f6fd084b52a7c7dddbc00c SHA512 05a880d5e48ac83be84498ed41fb4750211b827a9d7541acfd6ef494e5205a6e853d5594bfec3ab4ae668ea3f803e4f4b0ba550c76811971c8e266e42663c56d
31 @@ -35,3 +36,4 @@ DIST njs-0.4.4.tar.gz 486870 BLAKE2B 9390bfe35249ea34b9edd4b7c2360a25c9ecb232e10
32 DIST njs-0.5.0.tar.gz 505568 BLAKE2B 5dc2a91bffa4eb2364d96e26def0959b111cc8bf88841f581e3c0d43fcb88ba1ea24b24339cb1f51b8290c08dd930dc18a274a7ab6a21ee4ba8b0e6c4f5a1ba0 SHA512 182a64ba519b1a1d29ac71ffe2c9ef8e5a6f9aaf3db9f327ac926114db73b339a424801b558068fc7ae06ae88a4dea0a601c749db4b6f2b579e427181e41d11b
33 DIST njs-0.5.1.tar.gz 516345 BLAKE2B b861ff1e62eddeb8aabf6908253dba1393a32a04636a082dee979a52d320a7ecb12f961213652886a210ee9569460a3214d823cb5f7c3b025378b7cf6d64659f SHA512 bbc06e57a152a5dc5c71305a4bec80d6d3d6f886a82d6c39d82aa8f52add56029b7f38199f11789648539bcbba2a488dc6e64874fef0222479775708559f4da9
34 DIST njs-0.5.2.tar.gz 519331 BLAKE2B d2315ce563650a3985c1e40e3fcf17cdd69de5379f4213674db39bb2c7fb3f62df710e3bfccc0391e4bba2c19362f69d6574b4691e858c60af398c1131e3b79a SHA512 47ac82edd63059a38753371deafb5efe8e1c71f2533f1bf78e8ed56d6e7bfea801cb4a1213597bd73fc3e51263b394750efa29c5f1f3581c62f99c935fdfec99
35 +DIST njs-0.5.3.tar.gz 519938 BLAKE2B 1d06f8a20f6c37977e3b4b9afa0f136761a6998b85739a9853bb41d70ea6af42f49541035961fd0251eda2e10579f7bf983eaec2f9e19460138e53f44b9e6788 SHA512 b1d2e7498c37cc1df18e0f65866391637bf75d3d251fc7d7ad1ef5c76457697f49eaea088e1d157c94a6e779e9b8cc07b3f5aaac965666624506f517f6878c23
36
37 diff --git a/www-servers/nginx/nginx-1.19.9.ebuild b/www-servers/nginx/nginx-1.19.9.ebuild
38 new file mode 100644
39 index 00000000000..951ed700dca
40 --- /dev/null
41 +++ b/www-servers/nginx/nginx-1.19.9.ebuild
42 @@ -0,0 +1,1090 @@
43 +# Copyright 1999-2021 Gentoo Authors
44 +# Distributed under the terms of the GNU General Public License v2
45 +
46 +EAPI=7
47 +
48 +# Maintainer notes:
49 +# - http_rewrite-independent pcre-support makes sense for matching locations without an actual rewrite
50 +# - any http-module activates the main http-functionality and overrides USE=-http
51 +# - keep the following requirements in mind before adding external modules:
52 +# * alive upstream
53 +# * sane packaging
54 +# * builds cleanly
55 +# * does not need a patch for nginx core
56 +# - TODO: test the google-perftools module (included in vanilla tarball)
57 +
58 +# prevent perl-module from adding automagic perl DEPENDs
59 +GENTOO_DEPEND_ON_PERL="no"
60 +
61 +# devel_kit (https://github.com/simpl/ngx_devel_kit, BSD license)
62 +DEVEL_KIT_MODULE_PV="0.3.1"
63 +DEVEL_KIT_MODULE_P="ngx_devel_kit-${DEVEL_KIT_MODULE_PV}"
64 +DEVEL_KIT_MODULE_URI="https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KIT_MODULE_PV}.tar.gz"
65 +DEVEL_KIT_MODULE_WD="${WORKDIR}/ngx_devel_kit-${DEVEL_KIT_MODULE_PV}"
66 +
67 +# ngx_brotli (https://github.com/google/ngx_brotli, BSD-2)
68 +HTTP_BROTLI_MODULE_PV="1.0.0rc"
69 +HTTP_BROTLI_MODULE_P="ngx_brotli-${HTTP_BROTLI_MODULE_PV}"
70 +HTTP_BROTLI_MODULE_URI="https://github.com/google/ngx_brotli/archive/v${HTTP_BROTLI_MODULE_PV}.tar.gz"
71 +HTTP_BROTLI_MODULE_WD="${WORKDIR}/ngx_brotli-${HTTP_BROTLI_MODULE_PV}"
72 +
73 +# http_uploadprogress (https://github.com/masterzen/nginx-upload-progress-module, BSD-2 license)
74 +HTTP_UPLOAD_PROGRESS_MODULE_PV="0.9.2"
75 +HTTP_UPLOAD_PROGRESS_MODULE_P="ngx_http_upload_progress-${HTTP_UPLOAD_PROGRESS_MODULE_PV}-r1"
76 +HTTP_UPLOAD_PROGRESS_MODULE_URI="https://github.com/masterzen/nginx-upload-progress-module/archive/v${HTTP_UPLOAD_PROGRESS_MODULE_PV}.tar.gz"
77 +HTTP_UPLOAD_PROGRESS_MODULE_WD="${WORKDIR}/nginx-upload-progress-module-${HTTP_UPLOAD_PROGRESS_MODULE_PV}"
78 +
79 +# http_headers_more (https://github.com/agentzh/headers-more-nginx-module, BSD license)
80 +HTTP_HEADERS_MORE_MODULE_PV="0.33"
81 +HTTP_HEADERS_MORE_MODULE_P="ngx_http_headers_more-${HTTP_HEADERS_MORE_MODULE_PV}"
82 +HTTP_HEADERS_MORE_MODULE_URI="https://github.com/agentzh/headers-more-nginx-module/archive/v${HTTP_HEADERS_MORE_MODULE_PV}.tar.gz"
83 +HTTP_HEADERS_MORE_MODULE_WD="${WORKDIR}/headers-more-nginx-module-${HTTP_HEADERS_MORE_MODULE_PV}"
84 +
85 +# http_cache_purge (http://labs.frickle.com/nginx_ngx_cache_purge/, https://github.com/FRiCKLE/ngx_cache_purge, BSD-2 license)
86 +HTTP_CACHE_PURGE_MODULE_PV="2.3"
87 +HTTP_CACHE_PURGE_MODULE_P="ngx_http_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}"
88 +HTTP_CACHE_PURGE_MODULE_URI="http://labs.frickle.com/files/ngx_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}.tar.gz"
89 +HTTP_CACHE_PURGE_MODULE_WD="${WORKDIR}/ngx_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}"
90 +
91 +# http_slowfs_cache (http://labs.frickle.com/nginx_ngx_slowfs_cache/, BSD-2 license)
92 +HTTP_SLOWFS_CACHE_MODULE_PV="1.10"
93 +HTTP_SLOWFS_CACHE_MODULE_P="ngx_http_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}"
94 +HTTP_SLOWFS_CACHE_MODULE_URI="http://labs.frickle.com/files/ngx_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}.tar.gz"
95 +HTTP_SLOWFS_CACHE_MODULE_WD="${WORKDIR}/ngx_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}"
96 +
97 +# http_fancyindex (https://github.com/aperezdc/ngx-fancyindex, BSD license)
98 +HTTP_FANCYINDEX_MODULE_PV="0.4.4"
99 +HTTP_FANCYINDEX_MODULE_P="ngx_http_fancyindex-${HTTP_FANCYINDEX_MODULE_PV}"
100 +HTTP_FANCYINDEX_MODULE_URI="https://github.com/aperezdc/ngx-fancyindex/archive/v${HTTP_FANCYINDEX_MODULE_PV}.tar.gz"
101 +HTTP_FANCYINDEX_MODULE_WD="${WORKDIR}/ngx-fancyindex-${HTTP_FANCYINDEX_MODULE_PV}"
102 +
103 +# http_lua (https://github.com/openresty/lua-nginx-module, BSD license)
104 +HTTP_LUA_MODULE_PV="0.10.15"
105 +HTTP_LUA_MODULE_P="ngx_http_lua-${HTTP_LUA_MODULE_PV}"
106 +HTTP_LUA_MODULE_URI="https://github.com/openresty/lua-nginx-module/archive/v${HTTP_LUA_MODULE_PV}.tar.gz"
107 +HTTP_LUA_MODULE_WD="${WORKDIR}/lua-nginx-module-${HTTP_LUA_MODULE_PV}"
108 +LUA_COMPAT=( luajit )
109 +
110 +# http_auth_pam (https://github.com/stogh/ngx_http_auth_pam_module/, http://web.iti.upv.es/~sto/nginx/, BSD-2 license)
111 +HTTP_AUTH_PAM_MODULE_PV="1.5.2"
112 +HTTP_AUTH_PAM_MODULE_P="ngx_http_auth_pam-${HTTP_AUTH_PAM_MODULE_PV}"
113 +HTTP_AUTH_PAM_MODULE_URI="https://github.com/stogh/ngx_http_auth_pam_module/archive/v${HTTP_AUTH_PAM_MODULE_PV}.tar.gz"
114 +HTTP_AUTH_PAM_MODULE_WD="${WORKDIR}/ngx_http_auth_pam_module-${HTTP_AUTH_PAM_MODULE_PV}"
115 +
116 +# http_upstream_check (https://github.com/yaoweibin/nginx_upstream_check_module, BSD license)
117 +HTTP_UPSTREAM_CHECK_MODULE_PV="9aecf15ec379fe98f62355c57b60c0bc83296f04"
118 +HTTP_UPSTREAM_CHECK_MODULE_P="ngx_http_upstream_check-${HTTP_UPSTREAM_CHECK_MODULE_PV}"
119 +HTTP_UPSTREAM_CHECK_MODULE_URI="https://github.com/yaoweibin/nginx_upstream_check_module/archive/${HTTP_UPSTREAM_CHECK_MODULE_PV}.tar.gz"
120 +HTTP_UPSTREAM_CHECK_MODULE_WD="${WORKDIR}/nginx_upstream_check_module-${HTTP_UPSTREAM_CHECK_MODULE_PV}"
121 +
122 +# http_metrics (https://github.com/zenops/ngx_metrics, BSD license)
123 +HTTP_METRICS_MODULE_PV="0.1.1"
124 +HTTP_METRICS_MODULE_P="ngx_metrics-${HTTP_METRICS_MODULE_PV}"
125 +HTTP_METRICS_MODULE_URI="https://github.com/madvertise/ngx_metrics/archive/v${HTTP_METRICS_MODULE_PV}.tar.gz"
126 +HTTP_METRICS_MODULE_WD="${WORKDIR}/ngx_metrics-${HTTP_METRICS_MODULE_PV}"
127 +
128 +# http_vhost_traffic_status (https://github.com/vozlt/nginx-module-vts, BSD license)
129 +HTTP_VHOST_TRAFFIC_STATUS_MODULE_PV="46d85558e344dfe2b078ce757fd36c69a1ec2dd3"
130 +HTTP_VHOST_TRAFFIC_STATUS_MODULE_P="ngx_http_vhost_traffic_status-${HTTP_VHOST_TRAFFIC_STATUS_MODULE_PV}"
131 +HTTP_VHOST_TRAFFIC_STATUS_MODULE_URI="https://github.com/vozlt/nginx-module-vts/archive/${HTTP_VHOST_TRAFFIC_STATUS_MODULE_PV}.tar.gz"
132 +HTTP_VHOST_TRAFFIC_STATUS_MODULE_WD="${WORKDIR}/nginx-module-vts-${HTTP_VHOST_TRAFFIC_STATUS_MODULE_PV}"
133 +
134 +# naxsi-core (https://github.com/nbs-system/naxsi, GPLv2+)
135 +HTTP_NAXSI_MODULE_PV="0.56"
136 +HTTP_NAXSI_MODULE_P="ngx_http_naxsi-${HTTP_NAXSI_MODULE_PV}"
137 +HTTP_NAXSI_MODULE_URI="https://github.com/nbs-system/naxsi/archive/${HTTP_NAXSI_MODULE_PV}.tar.gz"
138 +HTTP_NAXSI_MODULE_WD="${WORKDIR}/naxsi-${HTTP_NAXSI_MODULE_PV}/naxsi_src"
139 +
140 +# nginx-rtmp-module (https://github.com/arut/nginx-rtmp-module, BSD license)
141 +RTMP_MODULE_PV="1.2.1"
142 +RTMP_MODULE_P="ngx_rtmp-${RTMP_MODULE_PV}"
143 +RTMP_MODULE_URI="https://github.com/arut/nginx-rtmp-module/archive/v${RTMP_MODULE_PV}.tar.gz"
144 +RTMP_MODULE_WD="${WORKDIR}/nginx-rtmp-module-${RTMP_MODULE_PV}"
145 +
146 +# nginx-dav-ext-module (https://github.com/arut/nginx-dav-ext-module, BSD license)
147 +HTTP_DAV_EXT_MODULE_PV="3.0.0"
148 +HTTP_DAV_EXT_MODULE_P="ngx_http_dav_ext-${HTTP_DAV_EXT_MODULE_PV}"
149 +HTTP_DAV_EXT_MODULE_URI="https://github.com/arut/nginx-dav-ext-module/archive/v${HTTP_DAV_EXT_MODULE_PV}.tar.gz"
150 +HTTP_DAV_EXT_MODULE_WD="${WORKDIR}/nginx-dav-ext-module-${HTTP_DAV_EXT_MODULE_PV}"
151 +
152 +# echo-nginx-module (https://github.com/openresty/echo-nginx-module, BSD license)
153 +HTTP_ECHO_MODULE_PV="0.62"
154 +HTTP_ECHO_MODULE_P="ngx_http_echo-${HTTP_ECHO_MODULE_PV}"
155 +HTTP_ECHO_MODULE_URI="https://github.com/openresty/echo-nginx-module/archive/v${HTTP_ECHO_MODULE_PV}.tar.gz"
156 +HTTP_ECHO_MODULE_WD="${WORKDIR}/echo-nginx-module-${HTTP_ECHO_MODULE_PV}"
157 +
158 +# mod_security for nginx (https://modsecurity.org/, Apache-2.0)
159 +# keep the MODULE_P here consistent with upstream to avoid tarball duplication
160 +HTTP_SECURITY_MODULE_PV="2.9.3"
161 +HTTP_SECURITY_MODULE_P="modsecurity-${HTTP_SECURITY_MODULE_PV}"
162 +HTTP_SECURITY_MODULE_URI="https://www.modsecurity.org/tarball/${HTTP_SECURITY_MODULE_PV}/${HTTP_SECURITY_MODULE_P}.tar.gz"
163 +HTTP_SECURITY_MODULE_WD="${WORKDIR}/${HTTP_SECURITY_MODULE_P}"
164 +
165 +# push-stream-module (http://www.nginxpushstream.com, https://github.com/wandenberg/nginx-push-stream-module, GPL-3)
166 +HTTP_PUSH_STREAM_MODULE_PV="0.5.4"
167 +HTTP_PUSH_STREAM_MODULE_P="ngx_http_push_stream-${HTTP_PUSH_STREAM_MODULE_PV}"
168 +HTTP_PUSH_STREAM_MODULE_URI="https://github.com/wandenberg/nginx-push-stream-module/archive/${HTTP_PUSH_STREAM_MODULE_PV}.tar.gz"
169 +HTTP_PUSH_STREAM_MODULE_WD="${WORKDIR}/nginx-push-stream-module-${HTTP_PUSH_STREAM_MODULE_PV}"
170 +
171 +# sticky-module (https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng, BSD-2)
172 +HTTP_STICKY_MODULE_PV="1.2.6-10-g08a395c66e42"
173 +HTTP_STICKY_MODULE_P="nginx_http_sticky_module_ng-${HTTP_STICKY_MODULE_PV}"
174 +HTTP_STICKY_MODULE_URI="https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/${HTTP_STICKY_MODULE_PV}.tar.bz2"
175 +HTTP_STICKY_MODULE_WD="${WORKDIR}/nginx-goodies-nginx-sticky-module-ng-08a395c66e42"
176 +
177 +# mogilefs-module (https://github.com/vkholodkov/nginx-mogilefs-module, BSD-2)
178 +HTTP_MOGILEFS_MODULE_PV="1.0.4"
179 +HTTP_MOGILEFS_MODULE_P="ngx_mogilefs_module-${HTTP_MOGILEFS_MODULE_PV}"
180 +HTTP_MOGILEFS_MODULE_URI="https://github.com/vkholodkov/nginx-mogilefs-module/archive/${HTTP_MOGILEFS_MODULE_PV}.tar.gz"
181 +HTTP_MOGILEFS_MODULE_WD="${WORKDIR}/nginx_mogilefs_module-${HTTP_MOGILEFS_MODULE_PV}"
182 +
183 +# memc-module (https://github.com/openresty/memc-nginx-module, BSD-2)
184 +HTTP_MEMC_MODULE_PV="0.19"
185 +HTTP_MEMC_MODULE_P="ngx_memc_module-${HTTP_MEMC_MODULE_PV}"
186 +HTTP_MEMC_MODULE_URI="https://github.com/openresty/memc-nginx-module/archive/v${HTTP_MEMC_MODULE_PV}.tar.gz"
187 +HTTP_MEMC_MODULE_WD="${WORKDIR}/memc-nginx-module-${HTTP_MEMC_MODULE_PV}"
188 +
189 +# nginx-ldap-auth-module (https://github.com/kvspb/nginx-auth-ldap, BSD-2)
190 +HTTP_LDAP_MODULE_PV="42d195d7a7575ebab1c369ad3fc5d78dc2c2669c"
191 +HTTP_LDAP_MODULE_P="nginx-auth-ldap-${HTTP_LDAP_MODULE_PV}"
192 +HTTP_LDAP_MODULE_URI="https://github.com/kvspb/nginx-auth-ldap/archive/${HTTP_LDAP_MODULE_PV}.tar.gz"
193 +HTTP_LDAP_MODULE_WD="${WORKDIR}/nginx-auth-ldap-${HTTP_LDAP_MODULE_PV}"
194 +
195 +# geoip2 (https://github.com/leev/ngx_http_geoip2_module, BSD-2)
196 +GEOIP2_MODULE_PV="3.3"
197 +GEOIP2_MODULE_P="ngx_http_geoip2_module-${GEOIP2_MODULE_PV}"
198 +GEOIP2_MODULE_URI="https://github.com/leev/ngx_http_geoip2_module/archive/${GEOIP2_MODULE_PV}.tar.gz"
199 +GEOIP2_MODULE_WD="${WORKDIR}/ngx_http_geoip2_module-${GEOIP2_MODULE_PV}"
200 +
201 +# njs-module (https://github.com/nginx/njs, as-is)
202 +NJS_MODULE_PV="0.5.3"
203 +NJS_MODULE_P="njs-${NJS_MODULE_PV}"
204 +NJS_MODULE_URI="https://github.com/nginx/njs/archive/${NJS_MODULE_PV}.tar.gz"
205 +NJS_MODULE_WD="${WORKDIR}/njs-${NJS_MODULE_PV}"
206 +
207 +# We handle deps below ourselves
208 +SSL_DEPS_SKIP=1
209 +AUTOTOOLS_AUTO_DEPEND="no"
210 +
211 +inherit autotools lua-single ssl-cert toolchain-funcs perl-module flag-o-matic user systemd multilib pax-utils
212 +
213 +DESCRIPTION="Robust, small and high performance http and reverse proxy server"
214 +HOMEPAGE="https://nginx.org"
215 +SRC_URI="https://nginx.org/download/${P}.tar.gz
216 + ${DEVEL_KIT_MODULE_URI} -> ${DEVEL_KIT_MODULE_P}.tar.gz
217 + nginx_modules_http_auth_ldap? ( ${HTTP_LDAP_MODULE_URI} -> ${HTTP_LDAP_MODULE_P}.tar.gz )
218 + nginx_modules_http_auth_pam? ( ${HTTP_AUTH_PAM_MODULE_URI} -> ${HTTP_AUTH_PAM_MODULE_P}.tar.gz )
219 + nginx_modules_http_brotli? ( ${HTTP_BROTLI_MODULE_URI} -> ${HTTP_BROTLI_MODULE_P}.tar.gz )
220 + nginx_modules_http_cache_purge? ( ${HTTP_CACHE_PURGE_MODULE_URI} -> ${HTTP_CACHE_PURGE_MODULE_P}.tar.gz )
221 + nginx_modules_http_dav_ext? ( ${HTTP_DAV_EXT_MODULE_URI} -> ${HTTP_DAV_EXT_MODULE_P}.tar.gz )
222 + nginx_modules_http_echo? ( ${HTTP_ECHO_MODULE_URI} -> ${HTTP_ECHO_MODULE_P}.tar.gz )
223 + nginx_modules_http_fancyindex? ( ${HTTP_FANCYINDEX_MODULE_URI} -> ${HTTP_FANCYINDEX_MODULE_P}.tar.gz )
224 + nginx_modules_http_geoip2? ( ${GEOIP2_MODULE_URI} -> ${GEOIP2_MODULE_P}.tar.gz )
225 + nginx_modules_http_headers_more? ( ${HTTP_HEADERS_MORE_MODULE_URI} -> ${HTTP_HEADERS_MORE_MODULE_P}.tar.gz )
226 + nginx_modules_http_javascript? ( ${NJS_MODULE_URI} -> ${NJS_MODULE_P}.tar.gz )
227 + nginx_modules_http_lua? ( ${HTTP_LUA_MODULE_URI} -> ${HTTP_LUA_MODULE_P}.tar.gz )
228 + nginx_modules_http_memc? ( ${HTTP_MEMC_MODULE_URI} -> ${HTTP_MEMC_MODULE_P}.tar.gz )
229 + nginx_modules_http_metrics? ( ${HTTP_METRICS_MODULE_URI} -> ${HTTP_METRICS_MODULE_P}.tar.gz )
230 + nginx_modules_http_mogilefs? ( ${HTTP_MOGILEFS_MODULE_URI} -> ${HTTP_MOGILEFS_MODULE_P}.tar.gz )
231 + nginx_modules_http_naxsi? ( ${HTTP_NAXSI_MODULE_URI} -> ${HTTP_NAXSI_MODULE_P}.tar.gz )
232 + nginx_modules_http_push_stream? ( ${HTTP_PUSH_STREAM_MODULE_URI} -> ${HTTP_PUSH_STREAM_MODULE_P}.tar.gz )
233 + nginx_modules_http_security? ( ${HTTP_SECURITY_MODULE_URI} -> ${HTTP_SECURITY_MODULE_P}.tar.gz )
234 + nginx_modules_http_slowfs_cache? ( ${HTTP_SLOWFS_CACHE_MODULE_URI} -> ${HTTP_SLOWFS_CACHE_MODULE_P}.tar.gz )
235 + nginx_modules_http_sticky? ( ${HTTP_STICKY_MODULE_URI} -> ${HTTP_STICKY_MODULE_P}.tar.bz2 )
236 + nginx_modules_http_upload_progress? ( ${HTTP_UPLOAD_PROGRESS_MODULE_URI} -> ${HTTP_UPLOAD_PROGRESS_MODULE_P}.tar.gz )
237 + nginx_modules_http_upstream_check? ( ${HTTP_UPSTREAM_CHECK_MODULE_URI} -> ${HTTP_UPSTREAM_CHECK_MODULE_P}.tar.gz )
238 + nginx_modules_http_vhost_traffic_status? ( ${HTTP_VHOST_TRAFFIC_STATUS_MODULE_URI} -> ${HTTP_VHOST_TRAFFIC_STATUS_MODULE_P}.tar.gz )
239 + nginx_modules_stream_geoip2? ( ${GEOIP2_MODULE_URI} -> ${GEOIP2_MODULE_P}.tar.gz )
240 + nginx_modules_stream_javascript? ( ${NJS_MODULE_URI} -> ${NJS_MODULE_P}.tar.gz )
241 + rtmp? ( ${RTMP_MODULE_URI} -> ${RTMP_MODULE_P}.tar.gz )"
242 +
243 +LICENSE="BSD-2 BSD SSLeay MIT GPL-2 GPL-2+
244 + nginx_modules_http_security? ( Apache-2.0 )
245 + nginx_modules_http_push_stream? ( GPL-3 )"
246 +
247 +SLOT="mainline"
248 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
249 +
250 +# Package doesn't provide a real test suite
251 +RESTRICT="test"
252 +
253 +NGINX_MODULES_STD="access auth_basic autoindex browser charset empty_gif
254 + fastcgi geo grpc gzip limit_req limit_conn map memcached mirror
255 + proxy referer rewrite scgi ssi split_clients upstream_hash
256 + upstream_ip_hash upstream_keepalive upstream_least_conn
257 + upstream_zone userid uwsgi"
258 +NGINX_MODULES_OPT="addition auth_request dav degradation flv geoip gunzip
259 + gzip_static image_filter mp4 perl random_index realip secure_link
260 + slice stub_status sub xslt"
261 +NGINX_MODULES_STREAM_STD="access geo limit_conn map return split_clients
262 + upstream_hash upstream_least_conn upstream_zone"
263 +NGINX_MODULES_STREAM_OPT="geoip realip ssl_preread"
264 +NGINX_MODULES_MAIL="imap pop3 smtp"
265 +NGINX_MODULES_3RD="
266 + http_auth_ldap
267 + http_auth_pam
268 + http_brotli
269 + http_cache_purge
270 + http_dav_ext
271 + http_echo
272 + http_fancyindex
273 + http_geoip2
274 + http_headers_more
275 + http_javascript
276 + http_lua
277 + http_memc
278 + http_metrics
279 + http_mogilefs
280 + http_naxsi
281 + http_push_stream
282 + http_security
283 + http_slowfs_cache
284 + http_sticky
285 + http_upload_progress
286 + http_upstream_check
287 + http_vhost_traffic_status
288 + stream_geoip2
289 + stream_javascript
290 +"
291 +
292 +IUSE="aio debug +http +http2 +http-cache +ipv6 libatomic libressl +pcre
293 + pcre-jit rtmp selinux ssl threads userland_GNU vim-syntax"
294 +
295 +for mod in $NGINX_MODULES_STD; do
296 + IUSE="${IUSE} +nginx_modules_http_${mod}"
297 +done
298 +
299 +for mod in $NGINX_MODULES_OPT; do
300 + IUSE="${IUSE} nginx_modules_http_${mod}"
301 +done
302 +
303 +for mod in $NGINX_MODULES_STREAM_STD; do
304 + IUSE="${IUSE} nginx_modules_stream_${mod}"
305 +done
306 +
307 +for mod in $NGINX_MODULES_STREAM_OPT; do
308 + IUSE="${IUSE} nginx_modules_stream_${mod}"
309 +done
310 +
311 +for mod in $NGINX_MODULES_MAIL; do
312 + IUSE="${IUSE} nginx_modules_mail_${mod}"
313 +done
314 +
315 +for mod in $NGINX_MODULES_3RD; do
316 + IUSE="${IUSE} nginx_modules_${mod}"
317 +done
318 +
319 +# Add so we can warn users updating about config changes
320 +# @TODO: jbergstroem: remove on next release series
321 +IUSE="${IUSE} nginx_modules_http_spdy"
322 +
323 +CDEPEND="
324 + pcre? ( dev-libs/libpcre:= )
325 + pcre-jit? ( dev-libs/libpcre:=[jit] )
326 + ssl? (
327 + !libressl? ( dev-libs/openssl:0= )
328 + libressl? ( dev-libs/libressl:= )
329 + )
330 + http2? (
331 + !libressl? ( >=dev-libs/openssl-1.0.1c:0= )
332 + libressl? ( dev-libs/libressl:= )
333 + )
334 + http-cache? (
335 + userland_GNU? (
336 + !libressl? ( dev-libs/openssl:0= )
337 + libressl? ( dev-libs/libressl:= )
338 + )
339 + )
340 + nginx_modules_http_brotli? ( app-arch/brotli:= )
341 + nginx_modules_http_geoip? ( dev-libs/geoip )
342 + nginx_modules_http_geoip2? ( dev-libs/libmaxminddb:= )
343 + nginx_modules_http_gunzip? ( sys-libs/zlib )
344 + nginx_modules_http_gzip? ( sys-libs/zlib )
345 + nginx_modules_http_gzip_static? ( sys-libs/zlib )
346 + nginx_modules_http_image_filter? ( media-libs/gd:=[jpeg,png] )
347 + nginx_modules_http_perl? ( >=dev-lang/perl-5.8:= )
348 + nginx_modules_http_rewrite? ( dev-libs/libpcre:= )
349 + nginx_modules_http_secure_link? (
350 + userland_GNU? (
351 + !libressl? ( dev-libs/openssl:0= )
352 + libressl? ( dev-libs/libressl:= )
353 + )
354 + )
355 + nginx_modules_http_xslt? ( dev-libs/libxml2:= dev-libs/libxslt )
356 + nginx_modules_http_lua? ( ${LUA_DEPS} )
357 + nginx_modules_http_auth_pam? ( sys-libs/pam )
358 + nginx_modules_http_metrics? ( dev-libs/yajl:= )
359 + nginx_modules_http_dav_ext? ( dev-libs/libxml2 )
360 + nginx_modules_http_security? (
361 + dev-libs/apr:=
362 + dev-libs/apr-util:=
363 + dev-libs/libxml2:=
364 + net-misc/curl
365 + www-servers/apache
366 + )
367 + nginx_modules_http_auth_ldap? ( net-nds/openldap[ssl?] )
368 + nginx_modules_stream_geoip? ( dev-libs/geoip )
369 + nginx_modules_stream_geoip2? ( dev-libs/libmaxminddb:= )"
370 +RDEPEND="${CDEPEND}
371 + selinux? ( sec-policy/selinux-nginx )
372 + !www-servers/nginx:0"
373 +DEPEND="${CDEPEND}
374 + arm? ( dev-libs/libatomic_ops )
375 + libatomic? ( dev-libs/libatomic_ops )"
376 +BDEPEND="nginx_modules_http_brotli? ( virtual/pkgconfig )
377 + nginx_modules_http_security? ( ${AUTOTOOLS_DEPEND} )"
378 +PDEPEND="vim-syntax? ( app-vim/nginx-syntax )"
379 +
380 +REQUIRED_USE="pcre-jit? ( pcre )
381 + nginx_modules_http_fancyindex? ( nginx_modules_http_addition )
382 + nginx_modules_http_grpc? ( http2 )
383 + nginx_modules_http_lua? (
384 + ${LUA_REQUIRED_USE}
385 + nginx_modules_http_rewrite
386 + )
387 + nginx_modules_http_naxsi? ( pcre )
388 + nginx_modules_http_dav_ext? ( nginx_modules_http_dav nginx_modules_http_xslt )
389 + nginx_modules_http_metrics? ( nginx_modules_http_stub_status )
390 + nginx_modules_http_security? ( pcre )
391 + nginx_modules_http_push_stream? ( ssl )"
392 +
393 +pkg_setup() {
394 + NGINX_HOME="/var/lib/nginx"
395 + NGINX_HOME_TMP="${NGINX_HOME}/tmp"
396 +
397 + ebegin "Creating nginx user and group"
398 + enewgroup ${PN}
399 + enewuser ${PN} -1 -1 "${NGINX_HOME}" ${PN}
400 + eend $?
401 +
402 + if use libatomic; then
403 + ewarn "GCC 4.1+ features built-in atomic operations."
404 + ewarn "Using libatomic_ops is only needed if using"
405 + ewarn "a different compiler or a GCC prior to 4.1"
406 + fi
407 +
408 + if [[ -n $NGINX_ADD_MODULES ]]; then
409 + ewarn "You are building custom modules via \$NGINX_ADD_MODULES!"
410 + ewarn "This nginx installation is not supported!"
411 + ewarn "Make sure you can reproduce the bug without those modules"
412 + ewarn "_before_ reporting bugs."
413 + fi
414 +
415 + if use !http; then
416 + ewarn "To actually disable all http-functionality you also have to disable"
417 + ewarn "all nginx http modules."
418 + fi
419 +
420 + if use nginx_modules_http_mogilefs && use threads; then
421 + eerror "mogilefs won't compile with threads support."
422 + eerror "Please disable either flag and try again."
423 + die "Can't compile mogilefs with threads support"
424 + fi
425 +
426 + use nginx_modules_http_lua && lua-single_pkg_setup
427 +}
428 +
429 +src_prepare() {
430 + eapply "${FILESDIR}/${PN}-1.4.1-fix-perl-install-path.patch"
431 + eapply "${FILESDIR}/${PN}-httpoxy-mitigation-r1.patch"
432 +
433 + if use nginx_modules_http_brotli; then
434 + cd "${HTTP_BROTLI_MODULE_WD}" || die
435 + eapply "${FILESDIR}"/http_brotli-detect-brotli-r3.patch
436 + cd "${S}" || die
437 + fi
438 +
439 + if use nginx_modules_http_upstream_check; then
440 + eapply -p0 "${FILESDIR}"/http_upstream_check-nginx-1.11.5+.patch
441 + fi
442 +
443 + if use nginx_modules_http_cache_purge; then
444 + cd "${HTTP_CACHE_PURGE_MODULE_WD}" || die
445 + eapply "${FILESDIR}"/http_cache_purge-1.11.6+.patch
446 + cd "${S}" || die
447 + fi
448 +
449 + if use nginx_modules_http_security; then
450 + cd "${HTTP_SECURITY_MODULE_WD}" || die
451 +
452 + eautoreconf
453 +
454 + if use nginx_modules_http_lua; then
455 + sed -i \
456 + -e "s|^\(LUA_PKGNAMES\)=.*|\1=\"${ELUA}\"|" \
457 + configure || die
458 + fi
459 +
460 + cd "${S}" || die
461 + fi
462 +
463 + if use nginx_modules_http_upload_progress; then
464 + cd "${HTTP_UPLOAD_PROGRESS_MODULE_WD}" || die
465 + eapply "${FILESDIR}"/http_uploadprogress-issue_50-r1.patch
466 + cd "${S}" || die
467 + fi
468 +
469 + find auto/ -type f -print0 | xargs -0 sed -i 's:\&\& make:\&\& \\$(MAKE):' || die
470 + # We have config protection, don't rename etc files
471 + sed -i 's:.default::' auto/install || die
472 + # remove useless files
473 + sed -i -e '/koi-/d' -e '/win-/d' auto/install || die
474 +
475 + # don't install to /etc/nginx/ if not in use
476 + local module
477 + for module in fastcgi scgi uwsgi ; do
478 + if ! use nginx_modules_http_${module}; then
479 + sed -i -e "/${module}/d" auto/install || die
480 + fi
481 + done
482 +
483 + eapply_user
484 +}
485 +
486 +src_configure() {
487 + # mod_security needs to generate nginx/modsecurity/config before including it
488 + if use nginx_modules_http_security; then
489 + cd "${HTTP_SECURITY_MODULE_WD}" || die
490 +
491 + ./configure \
492 + --enable-standalone-module \
493 + --disable-mlogc \
494 + --with-ssdeep=no \
495 + $(use_enable pcre-jit) \
496 + $(use_with nginx_modules_http_lua lua) || die "configure failed for mod_security"
497 +
498 + cd "${S}" || die
499 + fi
500 +
501 + local myconf=() http_enabled= mail_enabled= stream_enabled=
502 +
503 + use aio && myconf+=( --with-file-aio )
504 + use debug && myconf+=( --with-debug )
505 + use http2 && myconf+=( --with-http_v2_module )
506 + use libatomic && myconf+=( --with-libatomic )
507 + use pcre && myconf+=( --with-pcre )
508 + use pcre-jit && myconf+=( --with-pcre-jit )
509 + use threads && myconf+=( --with-threads )
510 +
511 + # HTTP modules
512 + for mod in $NGINX_MODULES_STD; do
513 + if use nginx_modules_http_${mod}; then
514 + http_enabled=1
515 + else
516 + myconf+=( --without-http_${mod}_module )
517 + fi
518 + done
519 +
520 + for mod in $NGINX_MODULES_OPT; do
521 + if use nginx_modules_http_${mod}; then
522 + http_enabled=1
523 + myconf+=( --with-http_${mod}_module )
524 + fi
525 + done
526 +
527 + if use nginx_modules_http_fastcgi; then
528 + myconf+=( --with-http_realip_module )
529 + fi
530 +
531 + # third-party modules
532 + if use nginx_modules_http_upload_progress; then
533 + http_enabled=1
534 + myconf+=( --add-module=${HTTP_UPLOAD_PROGRESS_MODULE_WD} )
535 + fi
536 +
537 + if use nginx_modules_http_headers_more; then
538 + http_enabled=1
539 + myconf+=( --add-module=${HTTP_HEADERS_MORE_MODULE_WD} )
540 + fi
541 +
542 + if use nginx_modules_http_cache_purge; then
543 + http_enabled=1
544 + myconf+=( --add-module=${HTTP_CACHE_PURGE_MODULE_WD} )
545 + fi
546 +
547 + if use nginx_modules_http_slowfs_cache; then
548 + http_enabled=1
549 + myconf+=( --add-module=${HTTP_SLOWFS_CACHE_MODULE_WD} )
550 + fi
551 +
552 + if use nginx_modules_http_fancyindex; then
553 + http_enabled=1
554 + myconf+=( --add-module=${HTTP_FANCYINDEX_MODULE_WD} )
555 + fi
556 +
557 + if use nginx_modules_http_lua; then
558 + http_enabled=1
559 + export LUAJIT_LIB=$(dirname $(lua_get_shared_lib))
560 + export LUAJIT_INC=$(lua_get_include_dir)
561 + myconf+=( --add-module=${DEVEL_KIT_MODULE_WD} )
562 + myconf+=( --add-module=${HTTP_LUA_MODULE_WD} )
563 + fi
564 +
565 + if use nginx_modules_http_auth_pam; then
566 + http_enabled=1
567 + myconf+=( --add-module=${HTTP_AUTH_PAM_MODULE_WD} )
568 + fi
569 +
570 + if use nginx_modules_http_upstream_check; then
571 + http_enabled=1
572 + myconf+=( --add-module=${HTTP_UPSTREAM_CHECK_MODULE_WD} )
573 + fi
574 +
575 + if use nginx_modules_http_metrics; then
576 + http_enabled=1
577 + myconf+=( --add-module=${HTTP_METRICS_MODULE_WD} )
578 + fi
579 +
580 + if use nginx_modules_http_naxsi ; then
581 + http_enabled=1
582 + myconf+=( --add-module=${HTTP_NAXSI_MODULE_WD} )
583 + fi
584 +
585 + if use rtmp ; then
586 + http_enabled=1
587 + myconf+=( --add-module=${RTMP_MODULE_WD} )
588 + fi
589 +
590 + if use nginx_modules_http_dav_ext ; then
591 + http_enabled=1
592 + myconf+=( --add-module=${HTTP_DAV_EXT_MODULE_WD} )
593 + fi
594 +
595 + if use nginx_modules_http_echo ; then
596 + http_enabled=1
597 + myconf+=( --add-module=${HTTP_ECHO_MODULE_WD} )
598 + fi
599 +
600 + if use nginx_modules_http_security ; then
601 + http_enabled=1
602 + myconf+=( --add-module=${HTTP_SECURITY_MODULE_WD}/nginx/modsecurity )
603 + fi
604 +
605 + if use nginx_modules_http_push_stream ; then
606 + http_enabled=1
607 + myconf+=( --add-module=${HTTP_PUSH_STREAM_MODULE_WD} )
608 + fi
609 +
610 + if use nginx_modules_http_sticky ; then
611 + http_enabled=1
612 + myconf+=( --add-module=${HTTP_STICKY_MODULE_WD} )
613 + fi
614 +
615 + if use nginx_modules_http_mogilefs ; then
616 + http_enabled=1
617 + myconf+=( --add-module=${HTTP_MOGILEFS_MODULE_WD} )
618 + fi
619 +
620 + if use nginx_modules_http_memc ; then
621 + http_enabled=1
622 + myconf+=( --add-module=${HTTP_MEMC_MODULE_WD} )
623 + fi
624 +
625 + if use nginx_modules_http_auth_ldap; then
626 + http_enabled=1
627 + myconf+=( --add-module=${HTTP_LDAP_MODULE_WD} )
628 + fi
629 +
630 + if use nginx_modules_http_vhost_traffic_status; then
631 + http_enabled=1
632 + myconf+=( --add-module=${HTTP_VHOST_TRAFFIC_STATUS_MODULE_WD} )
633 + fi
634 +
635 + if use nginx_modules_http_geoip2 || use nginx_modules_stream_geoip2; then
636 + myconf+=( --add-module=${GEOIP2_MODULE_WD} )
637 + fi
638 +
639 + if use nginx_modules_http_javascript || use nginx_modules_stream_javascript; then
640 + myconf+=( --add-module="${NJS_MODULE_WD}/nginx" )
641 + fi
642 +
643 + if use nginx_modules_http_brotli; then
644 + http_enabled=1
645 + myconf+=( --add-module=${HTTP_BROTLI_MODULE_WD} )
646 + fi
647 +
648 + if use http || use http-cache || use http2 || use nginx_modules_http_javascript; then
649 + http_enabled=1
650 + fi
651 +
652 + if [ $http_enabled ]; then
653 + use http-cache || myconf+=( --without-http-cache )
654 + use ssl && myconf+=( --with-http_ssl_module )
655 + else
656 + myconf+=( --without-http --without-http-cache )
657 + fi
658 +
659 + # Stream modules
660 + for mod in $NGINX_MODULES_STREAM_STD; do
661 + if use nginx_modules_stream_${mod}; then
662 + stream_enabled=1
663 + else
664 + myconf+=( --without-stream_${mod}_module )
665 + fi
666 + done
667 +
668 + for mod in $NGINX_MODULES_STREAM_OPT; do
669 + if use nginx_modules_stream_${mod}; then
670 + stream_enabled=1
671 + myconf+=( --with-stream_${mod}_module )
672 + fi
673 + done
674 +
675 + if use nginx_modules_stream_geoip2 || use nginx_modules_stream_javascript; then
676 + stream_enabled=1
677 + fi
678 +
679 + if [ $stream_enabled ]; then
680 + myconf+=( --with-stream )
681 + use ssl && myconf+=( --with-stream_ssl_module )
682 + fi
683 +
684 + # MAIL modules
685 + for mod in $NGINX_MODULES_MAIL; do
686 + if use nginx_modules_mail_${mod}; then
687 + mail_enabled=1
688 + else
689 + myconf+=( --without-mail_${mod}_module )
690 + fi
691 + done
692 +
693 + if [ $mail_enabled ]; then
694 + myconf+=( --with-mail )
695 + use ssl && myconf+=( --with-mail_ssl_module )
696 + fi
697 +
698 + # custom modules
699 + for mod in $NGINX_ADD_MODULES; do
700 + myconf+=( --add-module=${mod} )
701 + done
702 +
703 + # https://bugs.gentoo.org/286772
704 + export LANG=C LC_ALL=C
705 + tc-export AR CC
706 +
707 + if ! use prefix; then
708 + myconf+=( --user=${PN} )
709 + myconf+=( --group=${PN} )
710 + fi
711 +
712 + local WITHOUT_IPV6=
713 + if ! use ipv6; then
714 + WITHOUT_IPV6=" -DNGX_HAVE_INET6=0"
715 + fi
716 +
717 + if [[ -n "${EXTRA_ECONF}" ]]; then
718 + myconf+=( ${EXTRA_ECONF} )
719 + ewarn "EXTRA_ECONF applied. Now you are on your own, good luck!"
720 + fi
721 +
722 + ./configure \
723 + --prefix="${EPREFIX}"/usr \
724 + --conf-path="${EPREFIX}"/etc/${PN}/${PN}.conf \
725 + --error-log-path="${EPREFIX}"/var/log/${PN}/error_log \
726 + --pid-path="${EPREFIX}"/run/${PN}.pid \
727 + --lock-path="${EPREFIX}"/run/lock/${PN}.lock \
728 + --with-cc-opt="-I${EROOT}/usr/include${WITHOUT_IPV6}" \
729 + --with-ld-opt="-L${EROOT}/usr/$(get_libdir)" \
730 + --http-log-path="${EPREFIX}"/var/log/${PN}/access_log \
731 + --http-client-body-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/client \
732 + --http-proxy-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/proxy \
733 + --http-fastcgi-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/fastcgi \
734 + --http-scgi-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/scgi \
735 + --http-uwsgi-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/uwsgi \
736 + --with-compat \
737 + "${myconf[@]}" || die "configure failed"
738 +
739 + # A purely cosmetic change that makes nginx -V more readable. This can be
740 + # good if people outside the gentoo community would troubleshoot and
741 + # question the users setup.
742 + sed -i -e "s|${WORKDIR}|external_module|g" objs/ngx_auto_config.h || die
743 +}
744 +
745 +src_compile() {
746 + use nginx_modules_http_security && emake -C "${HTTP_SECURITY_MODULE_WD}"
747 +
748 + # https://bugs.gentoo.org/286772
749 + export LANG=C LC_ALL=C
750 + emake LINK="${CC} ${LDFLAGS}" OTHERLDFLAGS="${LDFLAGS}"
751 +}
752 +
753 +src_install() {
754 + emake DESTDIR="${D}" install
755 +
756 + cp "${FILESDIR}"/nginx.conf-r2 "${ED}"/etc/nginx/nginx.conf || die
757 +
758 + newinitd "${FILESDIR}"/nginx.initd-r4 nginx
759 + newconfd "${FILESDIR}"/nginx.confd nginx
760 +
761 + systemd_newunit "${FILESDIR}"/nginx.service-r1 nginx.service
762 +
763 + doman man/nginx.8
764 + dodoc CHANGES* README
765 +
766 + # just keepdir. do not copy the default htdocs files (bug #449136)
767 + keepdir /var/www/localhost
768 + rm -rf "${ED}"/usr/html || die
769 +
770 + # set up a list of directories to keep
771 + local keepdir_list="${NGINX_HOME_TMP}"/client
772 + local module
773 + for module in proxy fastcgi scgi uwsgi; do
774 + use nginx_modules_http_${module} && keepdir_list+=" ${NGINX_HOME_TMP}/${module}"
775 + done
776 +
777 + keepdir /var/log/nginx ${keepdir_list}
778 +
779 + # this solves a problem with SELinux where nginx doesn't see the directories
780 + # as root and tries to create them as nginx
781 + fperms 0750 "${NGINX_HOME_TMP}"
782 + fowners ${PN}:0 "${NGINX_HOME_TMP}"
783 +
784 + fperms 0700 ${keepdir_list}
785 + fowners ${PN}:${PN} ${keepdir_list}
786 +
787 + fperms 0710 /var/log/nginx
788 + fowners 0:${PN} /var/log/nginx
789 +
790 + # logrotate
791 + insinto /etc/logrotate.d
792 + newins "${FILESDIR}"/nginx.logrotate-r1 nginx
793 +
794 + # Don't create /run
795 + rm -rf "${ED}"/run || die
796 +
797 + if use lua_single_target_luajit; then
798 + pax-mark m "${ED}/usr/sbin/nginx"
799 + fi
800 +
801 + if use nginx_modules_http_perl; then
802 + cd "${S}"/objs/src/http/modules/perl/ || die
803 + emake DESTDIR="${D}" INSTALLDIRS=vendor
804 + perl_delete_localpod
805 + cd "${S}" || die
806 + fi
807 +
808 + if use nginx_modules_http_cache_purge; then
809 + docinto ${HTTP_CACHE_PURGE_MODULE_P}
810 + dodoc "${HTTP_CACHE_PURGE_MODULE_WD}"/{CHANGES,README.md,TODO.md}
811 + fi
812 +
813 + if use nginx_modules_http_slowfs_cache; then
814 + docinto ${HTTP_SLOWFS_CACHE_MODULE_P}
815 + dodoc "${HTTP_SLOWFS_CACHE_MODULE_WD}"/{CHANGES,README.md}
816 + fi
817 +
818 + if use nginx_modules_http_fancyindex; then
819 + docinto ${HTTP_FANCYINDEX_MODULE_P}
820 + dodoc "${HTTP_FANCYINDEX_MODULE_WD}"/README.rst
821 + fi
822 +
823 + if use nginx_modules_http_lua; then
824 + docinto ${HTTP_LUA_MODULE_P}
825 + dodoc "${HTTP_LUA_MODULE_WD}"/README.markdown
826 + fi
827 +
828 + if use nginx_modules_http_auth_pam; then
829 + docinto ${HTTP_AUTH_PAM_MODULE_P}
830 + dodoc "${HTTP_AUTH_PAM_MODULE_WD}"/{README.md,ChangeLog}
831 + fi
832 +
833 + if use nginx_modules_http_upstream_check; then
834 + docinto ${HTTP_UPSTREAM_CHECK_MODULE_P}
835 + dodoc "${HTTP_UPSTREAM_CHECK_MODULE_WD}"/{README,CHANGES}
836 + fi
837 +
838 + if use nginx_modules_http_naxsi; then
839 + insinto /etc/nginx
840 + doins "${HTTP_NAXSI_MODULE_WD}"/../naxsi_config/naxsi_core.rules
841 + fi
842 +
843 + if use rtmp; then
844 + docinto ${RTMP_MODULE_P}
845 + dodoc "${RTMP_MODULE_WD}"/{AUTHORS,README.md,stat.xsl}
846 + fi
847 +
848 + if use nginx_modules_http_dav_ext; then
849 + docinto ${HTTP_DAV_EXT_MODULE_P}
850 + dodoc "${HTTP_DAV_EXT_MODULE_WD}"/README.rst
851 + fi
852 +
853 + if use nginx_modules_http_echo; then
854 + docinto ${HTTP_ECHO_MODULE_P}
855 + dodoc "${HTTP_ECHO_MODULE_WD}"/README.markdown
856 + fi
857 +
858 + if use nginx_modules_http_security; then
859 + docinto ${HTTP_SECURITY_MODULE_P}
860 + dodoc "${HTTP_SECURITY_MODULE_WD}"/{CHANGES,README.md,authors.txt}
861 + fi
862 +
863 + if use nginx_modules_http_push_stream; then
864 + docinto ${HTTP_PUSH_STREAM_MODULE_P}
865 + dodoc "${HTTP_PUSH_STREAM_MODULE_WD}"/{AUTHORS,CHANGELOG.textile,README.textile}
866 + fi
867 +
868 + if use nginx_modules_http_sticky; then
869 + docinto ${HTTP_STICKY_MODULE_P}
870 + dodoc "${HTTP_STICKY_MODULE_WD}"/{README.md,Changelog.txt,docs/sticky.pdf}
871 + fi
872 +
873 + if use nginx_modules_http_memc; then
874 + docinto ${HTTP_MEMC_MODULE_P}
875 + dodoc "${HTTP_MEMC_MODULE_WD}"/README.markdown
876 + fi
877 +
878 + if use nginx_modules_http_auth_ldap; then
879 + docinto ${HTTP_LDAP_MODULE_P}
880 + dodoc "${HTTP_LDAP_MODULE_WD}"/example.conf
881 + fi
882 +}
883 +
884 +pkg_postinst() {
885 + if use ssl; then
886 + if [[ ! -f "${EROOT}"/etc/ssl/${PN}/${PN}.key ]]; then
887 + install_cert /etc/ssl/${PN}/${PN}
888 + use prefix || chown ${PN}:${PN} "${EROOT}"/etc/ssl/${PN}/${PN}.{crt,csr,key,pem}
889 + fi
890 + fi
891 +
892 + if use nginx_modules_http_spdy; then
893 + ewarn ""
894 + ewarn "In nginx 1.9.5 the spdy module was superseded by http2."
895 + ewarn "Update your configs and package.use accordingly."
896 + fi
897 +
898 + if use nginx_modules_http_lua; then
899 + ewarn ""
900 + ewarn "While you can build lua 3rd party module against ${P}"
901 + ewarn "the author warns that >=${PN}-1.11.11 is still not an"
902 + ewarn "officially supported target yet. You are on your own."
903 + ewarn "Expect runtime failures, memory leaks and other problems!"
904 + fi
905 +
906 + if use nginx_modules_http_lua && use http2; then
907 + ewarn ""
908 + ewarn "Lua 3rd party module author warns against using ${P} with"
909 + ewarn "NGINX_MODULES_HTTP=\"lua http2\". For more info, see https://git.io/OldLsg"
910 + fi
911 +
912 + local _n_permission_layout_checks=0
913 + local _has_to_adjust_permissions=0
914 + local _has_to_show_permission_warning=0
915 +
916 + # Defaults to 1 to inform people doing a fresh installation
917 + # that we ship modified {scgi,uwsgi,fastcgi}_params files
918 + local _has_to_show_httpoxy_mitigation_notice=1
919 +
920 + local _replacing_version=
921 + for _replacing_version in ${REPLACING_VERSIONS}; do
922 + _n_permission_layout_checks=$((${_n_permission_layout_checks}+1))
923 +
924 + if [[ ${_n_permission_layout_checks} -gt 1 ]]; then
925 + # Should never happen:
926 + # Package is abusing slots but doesn't allow multiple parallel installations.
927 + # If we run into this situation it is unsafe to automatically adjust any
928 + # permission...
929 + _has_to_show_permission_warning=1
930 +
931 + ewarn "Replacing multiple ${PN}' versions is unsupported! " \
932 + "You will have to adjust permissions on your own."
933 +
934 + break
935 + fi
936 +
937 + local _replacing_version_branch=$(ver_cut 1-2 "${_replacing_version}")
938 + debug-print "Updating an existing installation (v${_replacing_version}; branch '${_replacing_version_branch}') ..."
939 +
940 + # Do we need to adjust permissions to fix CVE-2013-0337 (bug #458726, #469094)?
941 + # This was before we introduced multiple nginx versions so we
942 + # do not need to distinguish between stable and mainline
943 + local _need_to_fix_CVE2013_0337=1
944 +
945 + if ver_test ${_replacing_version} -ge 1.4.1-r2; then
946 + # We are updating an installation which should already be fixed
947 + _need_to_fix_CVE2013_0337=0
948 + debug-print "Skipping CVE-2013-0337 ... existing installation should not be affected!"
949 + else
950 + _has_to_adjust_permissions=1
951 + debug-print "Need to adjust permissions to fix CVE-2013-0337!"
952 + fi
953 +
954 + # Do we need to inform about HTTPoxy mitigation?
955 + # In repository since commit 8be44f76d4ac02cebcd1e0e6e6284bb72d054b0f
956 + if ver_test ${_replacing_version_branch} -lt 1.10; then
957 + # Updating from <1.10
958 + _has_to_show_httpoxy_mitigation_notice=1
959 + debug-print "Need to inform about HTTPoxy mitigation!"
960 + else
961 + # Updating from >=1.10
962 + local _fixed_in_pvr=
963 + case "${_replacing_version_branch}" in
964 + "1.10")
965 + _fixed_in_pvr="1.10.1-r2"
966 + ;;
967 + "1.11")
968 + _fixed_in_pvr="1.11.3-r1"
969 + ;;
970 + *)
971 + # This should be any future branch.
972 + # If we run this code it is safe to assume that the user has
973 + # already seen the HTTPoxy mitigation notice because he/she is doing
974 + # an update from previous version where we have already shown
975 + # the warning. Otherwise, we wouldn't hit this code path ...
976 + _fixed_in_pvr=
977 + esac
978 +
979 + if [[ -z "${_fixed_in_pvr}" ]] || ver_test ${_replacing_version} -ge ${_fixed_in_pvr}; then
980 + # We are updating an installation where we already informed
981 + # that we are mitigating HTTPoxy per default
982 + _has_to_show_httpoxy_mitigation_notice=0
983 + debug-print "No need to inform about HTTPoxy mitigation ... information was already shown for existing installation!"
984 + else
985 + _has_to_show_httpoxy_mitigation_notice=1
986 + debug-print "Need to inform about HTTPoxy mitigation!"
987 + fi
988 + fi
989 +
990 + # Do we need to adjust permissions to fix CVE-2016-1247 (bug #605008)?
991 + # All branches up to 1.11 are affected
992 + local _need_to_fix_CVE2016_1247=1
993 +
994 + if ver_test ${_replacing_version_branch} -lt 1.10; then
995 + # Updating from <1.10
996 + _has_to_adjust_permissions=1
997 + debug-print "Need to adjust permissions to fix CVE-2016-1247!"
998 + else
999 + # Updating from >=1.10
1000 + local _fixed_in_pvr=
1001 + case "${_replacing_version_branch}" in
1002 + "1.10")
1003 + _fixed_in_pvr="1.10.2-r3"
1004 + ;;
1005 + "1.11")
1006 + _fixed_in_pvr="1.11.6-r1"
1007 + ;;
1008 + *)
1009 + # This should be any future branch.
1010 + # If we run this code it is safe to assume that we have already
1011 + # adjusted permissions or were never affected because user is
1012 + # doing an update from previous version which was safe or did
1013 + # the adjustments. Otherwise, we wouldn't hit this code path ...
1014 + _fixed_in_pvr=
1015 + esac
1016 +
1017 + if [[ -z "${_fixed_in_pvr}" ]] || ver_test ${_replacing_version} -ge ${_fixed_in_pvr}; then
1018 + # We are updating an installation which should already be adjusted
1019 + # or which was never affected
1020 + _need_to_fix_CVE2016_1247=0
1021 + debug-print "Skipping CVE-2016-1247 ... existing installation should not be affected!"
1022 + else
1023 + _has_to_adjust_permissions=1
1024 + debug-print "Need to adjust permissions to fix CVE-2016-1247!"
1025 + fi
1026 + fi
1027 + done
1028 +
1029 + if [[ ${_has_to_adjust_permissions} -eq 1 ]]; then
1030 + # We do not DIE when chmod/chown commands are failing because
1031 + # package is already merged on user's system at this stage
1032 + # and we cannot retry without losing the information that
1033 + # the existing installation needs to adjust permissions.
1034 + # Instead we are going to a show a big warning ...
1035 +
1036 + if [[ ${_has_to_show_permission_warning} -eq 0 ]] && [[ ${_need_to_fix_CVE2013_0337} -eq 1 ]]; then
1037 + ewarn ""
1038 + ewarn "The world-readable bit (if set) has been removed from the"
1039 + ewarn "following directories to mitigate a security bug"
1040 + ewarn "(CVE-2013-0337, bug #458726):"
1041 + ewarn ""
1042 + ewarn " ${EPREFIX}/var/log/nginx"
1043 + ewarn " ${EPREFIX}${NGINX_HOME_TMP}/{,client,proxy,fastcgi,scgi,uwsgi}"
1044 + ewarn ""
1045 + ewarn "Check if this is correct for your setup before restarting nginx!"
1046 + ewarn "This is a one-time change and will not happen on subsequent updates."
1047 + ewarn "Furthermore nginx' temp directories got moved to '${EPREFIX}${NGINX_HOME_TMP}'"
1048 + chmod o-rwx \
1049 + "${EPREFIX}"/var/log/nginx \
1050 + "${EPREFIX}"${NGINX_HOME_TMP}/{,client,proxy,fastcgi,scgi,uwsgi} || \
1051 + _has_to_show_permission_warning=1
1052 + fi
1053 +
1054 + if [[ ${_has_to_show_permission_warning} -eq 0 ]] && [[ ${_need_to_fix_CVE2016_1247} -eq 1 ]]; then
1055 + ewarn ""
1056 + ewarn "The permissions on the following directory have been reset in"
1057 + ewarn "order to mitigate a security bug (CVE-2016-1247, bug #605008):"
1058 + ewarn ""
1059 + ewarn " ${EPREFIX}/var/log/nginx"
1060 + ewarn ""
1061 + ewarn "Check if this is correct for your setup before restarting nginx!"
1062 + ewarn "Also ensure that no other log directory used by any of your"
1063 + ewarn "vhost(s) is not writeable for nginx user. Any of your log files"
1064 + ewarn "used by nginx can be abused to escalate privileges!"
1065 + ewarn "This is a one-time change and will not happen on subsequent updates."
1066 + chown 0:nginx "${EPREFIX}"/var/log/nginx || _has_to_show_permission_warning=1
1067 + chmod 710 "${EPREFIX}"/var/log/nginx || _has_to_show_permission_warning=1
1068 + fi
1069 +
1070 + if [[ ${_has_to_show_permission_warning} -eq 1 ]]; then
1071 + # Should never happen ...
1072 + ewarn ""
1073 + ewarn "*************************************************************"
1074 + ewarn "*************** W A R N I N G ***************"
1075 + ewarn "*************************************************************"
1076 + ewarn "The one-time only attempt to adjust permissions of the"
1077 + ewarn "existing nginx installation failed. Be aware that we will not"
1078 + ewarn "try to adjust the same permissions again because now you are"
1079 + ewarn "using a nginx version where we expect that the permissions"
1080 + ewarn "are already adjusted or that you know what you are doing and"
1081 + ewarn "want to keep custom permissions."
1082 + ewarn ""
1083 + fi
1084 + fi
1085 +
1086 + # Sanity check for CVE-2016-1247
1087 + # Required to warn users who received the warning above and thought
1088 + # they could fix it by unmerging and re-merging the package or have
1089 + # unmerged a affected installation on purpose in the past leaving
1090 + # /var/log/nginx on their system due to keepdir/non-empty folder
1091 + # and are now installing the package again.
1092 + local _sanity_check_testfile=$(mktemp --dry-run "${EPREFIX}"/var/log/nginx/.CVE-2016-1247.XXXXXXXXX)
1093 + su -s /bin/sh -c "touch ${_sanity_check_testfile}" nginx >&/dev/null
1094 + if [ $? -eq 0 ] ; then
1095 + # Cleanup -- no reason to die here!
1096 + rm -f "${_sanity_check_testfile}"
1097 +
1098 + ewarn ""
1099 + ewarn "*************************************************************"
1100 + ewarn "*************** W A R N I N G ***************"
1101 + ewarn "*************************************************************"
1102 + ewarn "Looks like your installation is vulnerable to CVE-2016-1247"
1103 + ewarn "(bug #605008) because nginx user is able to create files in"
1104 + ewarn ""
1105 + ewarn " ${EPREFIX}/var/log/nginx"
1106 + ewarn ""
1107 + ewarn "Also ensure that no other log directory used by any of your"
1108 + ewarn "vhost(s) is not writeable for nginx user. Any of your log files"
1109 + ewarn "used by nginx can be abused to escalate privileges!"
1110 + fi
1111 +
1112 + if [[ ${_has_to_show_httpoxy_mitigation_notice} -eq 1 ]]; then
1113 + # HTTPoxy mitigation
1114 + ewarn ""
1115 + ewarn "This nginx installation comes with a mitigation for the HTTPoxy"
1116 + ewarn "vulnerability for FastCGI, SCGI and uWSGI applications by setting"
1117 + ewarn "the HTTP_PROXY parameter to an empty string per default when you"
1118 + ewarn "are sourcing one of the default"
1119 + ewarn ""
1120 + ewarn " - 'fastcgi_params' or 'fastcgi.conf'"
1121 + ewarn " - 'scgi_params'"
1122 + ewarn " - 'uwsgi_params'"
1123 + ewarn ""
1124 + ewarn "files in your server block(s)."
1125 + ewarn ""
1126 + ewarn "If this is causing any problems for you make sure that you are sourcing the"
1127 + ewarn "default parameters _before_ you set your own values."
1128 + ewarn "If you are relying on user-supplied proxy values you have to remove the"
1129 + ewarn "correlating lines from the file(s) mentioned above."
1130 + ewarn ""
1131 + fi
1132 +}