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