Gentoo Archives: gentoo-commits

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