Gentoo Archives: gentoo-commits

From: "Manuel Rüger" <mrueg@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-servers/nginx/, www-servers/nginx/files/
Date: Wed, 04 May 2016 13:20:14
Message-Id: 1462367981.8dd9fab6768ab82e3c23aaf3d35800bc96b8fc86.mrueg@gentoo
1 commit: 8dd9fab6768ab82e3c23aaf3d35800bc96b8fc86
2 Author: Manuel Rüger <mrueg <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 4 13:19:41 2016 +0000
4 Commit: Manuel Rüger <mrueg <AT> gentoo <DOT> org>
5 CommitDate: Wed May 4 13:19:41 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8dd9fab6
7
8 www-servers/nginx: Version bump to 1.10.0, use openrc-run
9
10 Gentoo-Bug: #581862
11 Gentoo-Bug: #581944
12
13 Package-Manager: portage-2.2.28
14
15 www-servers/nginx/Manifest | 3 +
16 www-servers/nginx/files/nginx.initd-r3 | 89 ++++
17 www-servers/nginx/nginx-1.10.0.ebuild | 761 +++++++++++++++++++++++++++++++++
18 3 files changed, 853 insertions(+)
19
20 diff --git a/www-servers/nginx/Manifest b/www-servers/nginx/Manifest
21 index e29cd6e..0c541fc 100644
22 --- a/www-servers/nginx/Manifest
23 +++ b/www-servers/nginx/Manifest
24 @@ -1,9 +1,11 @@
25 DIST modsecurity-2.9.0.tar.gz 4246467 SHA256 e2bbf789966c1f80094d88d9085a81bde082b2054f8e38e0db571ca49208f434 SHA512 1af04f29bf23c51d03cdd3795c530f88b523a645aa02d776a6b23dcbc31decec7cd574919e5c7c7cf82684df2774062de5e465bddbbaf4c01a442c6d49401d3d WHIRLPOOL 1167ba6048a3ca05dcdabf03c67ae12720cca0cec74547fc223ee92ff76b6d5131785fa77b5f16da180e56590c851c192eaf02817b798e4d6f41fa6bfb2735a6
26 DIST modsecurity-2.9.1.tar.gz 4261212 SHA256 958cc5a7a7430f93fac0fd6f8b9aa92fc1801efce0cda797d6029d44080a9b24 SHA512 374733cbfc26e53d95b78c8f268a4e465d838163e9893fc24e33a9d272b114f1b287147bab6d0289575074cbbd94f48983e23fa59832cbcb32950046cea59269 WHIRLPOOL 5f41bebf032f8a269412d104b7632a06af4d4c495658c9cd1ebf69b82c10ce1bbcb34b9dd159a7b00e57348714a5e93ad3db19701dda51479accd3a9dc79a9cb
27 +DIST nginx-1.10.0.tar.gz 908954 SHA256 8ed647c3dd65bc4ced03b0e0f6bf9e633eff6b01bac772bcf97077d58bc2be4d SHA512 495da729ce6de935399c2bf7fc0c2cd112197d9dba6d8604f639d5815cbb8bb3ff70e994f942785481e064cc1df97211f886297ee72519b332a7197999d9f14e WHIRLPOOL 889e723f635909d1b562663ed46b27edac83b63143c10c2c53e70dc6dccf3a378f8fef3f2f19641879dc9f812880b4f51ef0d438d80ede395ffda38987b13dd3
28 DIST nginx-1.8.1.tar.gz 833473 SHA256 8f4b3c630966c044ec72715754334d1fdf741caa1d5795fb4646c27d09f797b7 SHA512 546eba1749af0034cb8b924d2432be2f0e82a75c545aa929391ef7234103c3f29376235a2ef1363b120e1825cda15aeb085a05f9ce3596c88466e112e82aa882 WHIRLPOOL cd399083fb14bdb3498f1cd91a1cb59a73d37f323ce7c2a32500c9443f654cb5449137708cf149a0126aedb77abec9d1eb3dce3121f0b378d7d70e8eb18062af
29 DIST nginx-1.9.14.tar.gz 908191 SHA256 2b4893076d28e6b4384bba8c4fdebfca6de6f8f68ec48a1ca94b9b855ff457d2 SHA512 e73a10495a8b199856f4e5d6f428b46e0b1148cee26c8517e360130d9f1e85028b28f311879d31f37e1d3facccf6f215377e984ae937a44f45245fe09a3be90e WHIRLPOOL c4e1d2b8181b9c8c967de2d68314c05c28a1fe44bd35809f3672c2ff9b02d08e2f572970ab0328f85dbe9b29c6dae0c4ebb33586a8c70053e764158c055fa8d8
30 DIST nginx-1.9.15.tar.gz 908984 SHA256 cc89b277cc03f403c0b746d60aa5943cdecf59ae48278f8cb7e2df0cbdb6dac3 SHA512 563cec7828d1e398ded83579c3c4afcd83fd809662e64a0212e25a34ce1b599135558e9fd8cee3e07ba028ee4b308e40ce9910a5071a3d8e3b7ec9f9bdef95f0 WHIRLPOOL b87dd96b1fa34824fb6ca16da39d72cf6036f6276766ef420c3be8ceac8e8639ff74e842c1ffd5f8f2dd03d7c411197a05049c1673dc70862cee662b494da88f
31 DIST nginx-auth-ldap-8517bb05ecc896b54429ca5e95137b0a386bd41a.tar.gz 16950 SHA256 2f0b1a65847ea1da801a99b654f132e1c814d2fa49a43a324d8fc4ce6327935f SHA512 65b0aec3a4b28625ef93d166f659d63b9ef7d971dea78b09987eaa02f632bf5b8f6c9afdb6ef444afa466dba7ff67180cad27e138e6818c2ba80bc804f140ca6 WHIRLPOOL 9ef896fa3501415e2c7022448783626af256c6c3878fcca5d6cc042a9789937147eb4c3743f92002ab8d09e4ce828532b9ae321dc284ef2560801da98153d146
32 +DIST nginx-auth-ldap-dbcef31bebb2d54b6120422d0b178bbf78bc48f7.tar.gz 16998 SHA256 35c8f29581823be0f8bdbcf237d7fa5518c45eabe0ab9a695b131d32c8f1c264 SHA512 f47a9a6c5f93daa9260825261d2069bca5fc528221f94fc8ec98462f61774a36bce0238d931f8d0690544fd0144a83f942b6673c8376fe03f7834f8da9666671 WHIRLPOOL 26a2f67e715d13f785932f00e642c0864b5b7059d120f7fe7458017dbe02203f4873d1cfc4f0dd262834465438ad2b00ef4b49295e18a8e246abda6f7694ac70
33 DIST nginx_http_sticky_module_ng-1.2.5.tar.bz2 124072 SHA256 f975c033eb3c342f7247f6524774bbb727aaf630ed984576dbafe5de7a790c58 SHA512 d6ae723f739efb2f0548461931b1c395801684759962beda08067111426b1c9787ceaede91b0e984c023108fd17864c53c53925506f7e8e25ec8d2fc065585f6 WHIRLPOOL 1013c6a51f5989c8131392b3d9704d42c99f9727a673f6205878d0b7dfd265bb6042c1d30089603c9b38e339d48302e6873e77fe380b7e8edba25b71e9e84ba6
34 DIST nginx_http_sticky_module_ng-1.2.6.tar.bz2 124089 SHA256 e47b9fd435d7a5a3200f945a9745aaa7b9446495bda76df48f211129f88d6b26 SHA512 2632b04c94f523aa7c9726db182cba11d83e642c2db5798274e67fbef30de95d02e4e95cbfb98bc429d4244d630b5d9617405b43f728ae0117a5c134940c0ded WHIRLPOOL 1b754c02f834c6b4d4930e9c46b8c5accb6c9663718fb9296c92d79bc33206e66e49e4234ca4db9a5afcd42fa23273bdf0e675aa7b38927c4e46a85318c189eb
35 DIST ngx_devel_kit-0.2.19-r1.tar.gz 65029 SHA256 501f299abdb81b992a980bda182e5de5a4b2b3e275fbf72ee34dd7ae84c4b679 SHA512 915954acf16a27fbd3c93c154012d38e864f1d8dfd51cde401bba26e46eb3e3c778ec4c92f4f8ed83ac001e96cee72765554d0e4da06acf6a4be5184b23b3657 WHIRLPOOL 0ce6bffc0fe2cef28ee74f5862ca6d914ed18fdee18d900608ff2a9983594c707aab3e335957b79dd7e77ae1beed054d8f71965ca0f57fc5f1d41ac06106c5a4
36 @@ -23,6 +25,7 @@ DIST ngx_http_naxsi-0.53-2.tar.gz 165690 SHA256 3eadff1d91995beae41b92733ade2809
37 DIST ngx_http_naxsi-0.54.tar.gz 163809 SHA256 9cc2c09405bc71f78ef26a8b6d70afcea3fccbe8125df70cb0cfc480133daba5 SHA512 91934bfd41495715269cc6e549d17f6da66f2bdd0c9a6821fa9096b694dd3927109c4aad2f8b327620ae7c34f76a0839ac16669cd8c65081bc01fa7f829c1d43 WHIRLPOOL ef68cfecc9849086527c3590744d3c0d73cec830c6cf1ebca63566a7444438757a85d0c79fa552c4763e0416a615f4cf8d99622e2f36d3713b7072138a82f5a8
38 DIST ngx_http_push_stream-0.4.1.tar.gz 166928 SHA256 553584f557a3faec73702550e7e1417cbc0021f4f98468cc83e61e9d94def5cc SHA512 3b2289cc3abe6df0ee39360816675a39de1669a284e23770aa04b29e1e5dc73f5d99f3db6c7e8e4895a4abad0602aa64024ec19a2e741e138a70191501f038be WHIRLPOOL 9d203d4a78a3bd189527ebeaf1ff98613ee6a3150ae433efa17ed45dd9f6cb263b2a4c329a6fc2d04c6583ac2beaf24e87e3263d71a910f720b80038c9bc09c2
39 DIST ngx_http_push_stream-0.5.1.tar.gz 175263 SHA256 a95f31e80120fd7324795b92a0d94c0b43e1265df7fd0f1eba11a337c1e0a626 SHA512 b996c6fe48b97540d1ee9879f37aca1a4c8262ad7577d607d402a00d79f5d32676f010da303f89db18e6f90351b8bb5cf0265338cc5df8154e94d5f332a227c8 WHIRLPOOL aacf93841af0384b2be1d4075ceb23e67b89a4cac0a06fe40e2efd5f0334309ccc83e29014c9746dda9e6b59df0866f0a796c0a9dc9d14e2625a11c019c8e79d
40 +DIST ngx_http_push_stream-0.5.2.tar.gz 182008 SHA256 1d07f38acdb8194bd49344b0ba21de101070de9b8731d27a8d22e928850bc199 SHA512 ee8bf9ece652da6aa5a39879298bba70d1842696545259f3f5e302cc61397b35f016364805805f9ab1914fc39ed2f07c015e042155789073e3d1fdc02a0783de WHIRLPOOL d309cecbb1bb5b6c4f64712d44889e3ecca59140d845a31a3f605dc3cc2aa01622b0deadb8f6852baea3c211bebbe6ed7d7868399447ac1249c1b1b740fa3c27
41 DIST ngx_http_slowfs_cache-1.10.tar.gz 11809 SHA256 1e81453942e5b0877de1f1f06c56ae82918ea9818255cb935bcb673c95a758a1 SHA512 fbc9609a8d6913aeefe535f206b9e53477503f131934ead2ae5a6169e395af2f5fb54778704824d5eeb22a4ef40a11ebbcde580db62a631f70edcc2cfc06b15d WHIRLPOOL a02ed77422c47d9e476f8746186d19d632ddb953635d8d9dd51ff076225a78044286ee7e114478bc02e4b2a422e4fdc207154fc287629dd2cd7c3f9a634dad18
42 DIST ngx_http_upload_progress-0.9.1-r1.tar.gz 17166 SHA256 99ec072cca35cd7791e77c40a8ded41a7a8c1111e057be26e55fba2fdf105f43 SHA512 6c1e3776402b6e2cda50d9c48c4b578a85feffe15891c075443f6d9c7b9e2414e0614b50a8f417ddda9faf5f719957c77ade519c88b48caec970fc51fe12f0d1 WHIRLPOOL 12970d0f75ee3f0d8a97c4948b97fca2bd707a93e4e578c0e2ac0d18991986e620dd6b15c2ab5680ff726c0490671e3bc5e1ee6109baf81877d8baa6a5357825
43 DIST ngx_http_upstream_check-0.3.0.tar.gz 136542 SHA256 c543bf427b38643c10dcd1a0c701392bc666708313e7b63f9272396a6cc9a461 SHA512 ca19e8bcae218c639ff59e8f743bd2fb78de2c1f33dfb0de7b7b5ce82ae7ef04488255715e3e0311ebbc8c9741726573ac532cb269052925b0935f349414e959 WHIRLPOOL acee2ea955f87844a724815fc78d0296f23e9d6726551febd6bbff563625e8eadd04213394b6029c45b6036138c4f8957b2621f1b033a6177410fa7778176749
44
45 diff --git a/www-servers/nginx/files/nginx.initd-r3 b/www-servers/nginx/files/nginx.initd-r3
46 new file mode 100644
47 index 0000000..6e3a824
48 --- /dev/null
49 +++ b/www-servers/nginx/files/nginx.initd-r3
50 @@ -0,0 +1,89 @@
51 +#!/sbin/openrc-run
52 +# Copyright 1999-2016 Gentoo Foundation
53 +# Distributed under the terms of the GNU General Public License v2
54 +# $Id$
55 +
56 +extra_commands="configtest"
57 +extra_started_commands="upgrade reload"
58 +
59 +description="Robust, small and high performance http and reverse proxy server"
60 +description_configtest="Run nginx' internal config check."
61 +description_upgrade="Upgrade the nginx binary without losing connections."
62 +description_reload="Reload the nginx configuration without losing connections."
63 +
64 +nginx_config=${nginx_config:-/etc/nginx/nginx.conf}
65 +
66 +command="/usr/sbin/nginx"
67 +command_args="-c ${nginx_config}"
68 +pidfile=${pidfile:-/run/nginx.pid}
69 +user=${user:-nginx}
70 +group=${group:-nginx}
71 +
72 +depend() {
73 + need net
74 + use dns logger netmount
75 +}
76 +
77 +start_pre() {
78 + if [ "${RC_CMD}" != "restart" ]; then
79 + configtest || return 1
80 + fi
81 +}
82 +
83 +stop_pre() {
84 + if [ "${RC_CMD}" = "restart" ]; then
85 + configtest || return 1
86 + fi
87 +}
88 +
89 +stop_post() {
90 + rm -f ${pidfile}
91 +}
92 +
93 +reload() {
94 + configtest || return 1
95 + ebegin "Refreshing nginx' configuration"
96 + kill -HUP `cat ${pidfile}` &>/dev/null
97 + eend $? "Failed to reload nginx"
98 +}
99 +
100 +upgrade() {
101 + configtest || return 1
102 + ebegin "Upgrading nginx"
103 +
104 + einfo "Sending USR2 to old binary"
105 + kill -USR2 `cat ${pidfile}` &>/dev/null
106 +
107 + einfo "Sleeping 3 seconds before pid-files checking"
108 + sleep 3
109 +
110 + if [ ! -f ${pidfile}.oldbin ]; then
111 + eerror "File with old pid not found"
112 + return 1
113 + fi
114 +
115 + if [ ! -f ${pidfile} ]; then
116 + eerror "New binary failed to start"
117 + return 1
118 + fi
119 +
120 + einfo "Sleeping 3 seconds before WINCH"
121 + sleep 3 ; kill -WINCH `cat ${pidfile}.oldbin`
122 +
123 + einfo "Sending QUIT to old binary"
124 + kill -QUIT `cat ${pidfile}.oldbin`
125 +
126 + einfo "Upgrade completed"
127 + eend $? "Upgrade failed"
128 +}
129 +
130 +configtest() {
131 + ebegin "Checking nginx' configuration"
132 + ${command} -c ${nginx_config} -t -q
133 +
134 + if [ $? -ne 0 ]; then
135 + ${command} -c ${nginx_config} -t
136 + fi
137 +
138 + eend $? "failed, please correct errors above"
139 +}
140
141 diff --git a/www-servers/nginx/nginx-1.10.0.ebuild b/www-servers/nginx/nginx-1.10.0.ebuild
142 new file mode 100644
143 index 0000000..cc19cc7
144 --- /dev/null
145 +++ b/www-servers/nginx/nginx-1.10.0.ebuild
146 @@ -0,0 +1,761 @@
147 +# Copyright 1999-2016 Gentoo Foundation
148 +# Distributed under the terms of the GNU General Public License v2
149 +# $Id$
150 +
151 +EAPI=6
152 +
153 +# Maintainer notes:
154 +# - http_rewrite-independent pcre-support makes sense for matching locations without an actual rewrite
155 +# - any http-module activates the main http-functionality and overrides USE=-http
156 +# - keep the following requirements in mind before adding external modules:
157 +# * alive upstream
158 +# * sane packaging
159 +# * builds cleanly
160 +# * does not need a patch for nginx core
161 +# - TODO: test the google-perftools module (included in vanilla tarball)
162 +
163 +# prevent perl-module from adding automagic perl DEPENDs
164 +GENTOO_DEPEND_ON_PERL="no"
165 +
166 +# devel_kit (https://github.com/simpl/ngx_devel_kit, BSD license)
167 +DEVEL_KIT_MODULE_PV="0.2.19"
168 +DEVEL_KIT_MODULE_P="ngx_devel_kit-${DEVEL_KIT_MODULE_PV}-r1"
169 +DEVEL_KIT_MODULE_URI="https://github.com/simpl/ngx_devel_kit/archive/v${DEVEL_KIT_MODULE_PV}.tar.gz"
170 +DEVEL_KIT_MODULE_WD="${WORKDIR}/ngx_devel_kit-${DEVEL_KIT_MODULE_PV}"
171 +
172 +# http_uploadprogress (https://github.com/masterzen/nginx-upload-progress-module, BSD-2 license)
173 +HTTP_UPLOAD_PROGRESS_MODULE_PV="0.9.1"
174 +HTTP_UPLOAD_PROGRESS_MODULE_P="ngx_http_upload_progress-${HTTP_UPLOAD_PROGRESS_MODULE_PV}-r1"
175 +HTTP_UPLOAD_PROGRESS_MODULE_URI="https://github.com/masterzen/nginx-upload-progress-module/archive/v${HTTP_UPLOAD_PROGRESS_MODULE_PV}.tar.gz"
176 +HTTP_UPLOAD_PROGRESS_MODULE_WD="${WORKDIR}/nginx-upload-progress-module-${HTTP_UPLOAD_PROGRESS_MODULE_PV}"
177 +
178 +# http_headers_more (https://github.com/agentzh/headers-more-nginx-module, BSD license)
179 +HTTP_HEADERS_MORE_MODULE_PV="0.29"
180 +HTTP_HEADERS_MORE_MODULE_P="ngx_http_headers_more-${HTTP_HEADERS_MORE_MODULE_PV}"
181 +HTTP_HEADERS_MORE_MODULE_URI="https://github.com/agentzh/headers-more-nginx-module/archive/v${HTTP_HEADERS_MORE_MODULE_PV}.tar.gz"
182 +HTTP_HEADERS_MORE_MODULE_WD="${WORKDIR}/headers-more-nginx-module-${HTTP_HEADERS_MORE_MODULE_PV}"
183 +
184 +# http_cache_purge (http://labs.frickle.com/nginx_ngx_cache_purge/, BSD-2 license)
185 +HTTP_CACHE_PURGE_MODULE_PV="2.3"
186 +HTTP_CACHE_PURGE_MODULE_P="ngx_http_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}"
187 +HTTP_CACHE_PURGE_MODULE_URI="http://labs.frickle.com/files/ngx_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}.tar.gz"
188 +HTTP_CACHE_PURGE_MODULE_WD="${WORKDIR}/ngx_cache_purge-${HTTP_CACHE_PURGE_MODULE_PV}"
189 +
190 +# http_slowfs_cache (http://labs.frickle.com/nginx_ngx_slowfs_cache/, BSD-2 license)
191 +HTTP_SLOWFS_CACHE_MODULE_PV="1.10"
192 +HTTP_SLOWFS_CACHE_MODULE_P="ngx_http_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}"
193 +HTTP_SLOWFS_CACHE_MODULE_URI="http://labs.frickle.com/files/ngx_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}.tar.gz"
194 +HTTP_SLOWFS_CACHE_MODULE_WD="${WORKDIR}/ngx_slowfs_cache-${HTTP_SLOWFS_CACHE_MODULE_PV}"
195 +
196 +# http_fancyindex (https://github.com/aperezdc/ngx-fancyindex, BSD license)
197 +HTTP_FANCYINDEX_MODULE_PV="0.3.6"
198 +HTTP_FANCYINDEX_MODULE_P="ngx_http_fancyindex-${HTTP_FANCYINDEX_MODULE_PV}"
199 +HTTP_FANCYINDEX_MODULE_URI="https://github.com/aperezdc/ngx-fancyindex/archive/v${HTTP_FANCYINDEX_MODULE_PV}.tar.gz"
200 +HTTP_FANCYINDEX_MODULE_WD="${WORKDIR}/ngx-fancyindex-${HTTP_FANCYINDEX_MODULE_PV}"
201 +
202 +# http_lua (https://github.com/openresty/lua-nginx-module, BSD license)
203 +HTTP_LUA_MODULE_PV="0.10.2"
204 +HTTP_LUA_MODULE_P="ngx_http_lua-${HTTP_LUA_MODULE_PV}"
205 +HTTP_LUA_MODULE_URI="https://github.com/openresty/lua-nginx-module/archive/v${HTTP_LUA_MODULE_PV}.tar.gz"
206 +HTTP_LUA_MODULE_WD="${WORKDIR}/lua-nginx-module-${HTTP_LUA_MODULE_PV}"
207 +
208 +# http_auth_pam (https://github.com/stogh/ngx_http_auth_pam_module/, http://web.iti.upv.es/~sto/nginx/, BSD-2 license)
209 +HTTP_AUTH_PAM_MODULE_PV="1.5.1"
210 +HTTP_AUTH_PAM_MODULE_P="ngx_http_auth_pam-${HTTP_AUTH_PAM_MODULE_PV}"
211 +HTTP_AUTH_PAM_MODULE_URI="https://github.com/stogh/ngx_http_auth_pam_module/archive/v${HTTP_AUTH_PAM_MODULE_PV}.tar.gz"
212 +HTTP_AUTH_PAM_MODULE_WD="${WORKDIR}/ngx_http_auth_pam_module-${HTTP_AUTH_PAM_MODULE_PV}"
213 +
214 +# http_upstream_check (https://github.com/yaoweibin/nginx_upstream_check_module, BSD license)
215 +HTTP_UPSTREAM_CHECK_MODULE_PV="0.3.0"
216 +HTTP_UPSTREAM_CHECK_MODULE_P="ngx_http_upstream_check-${HTTP_UPSTREAM_CHECK_MODULE_PV}"
217 +HTTP_UPSTREAM_CHECK_MODULE_URI="https://github.com/yaoweibin/nginx_upstream_check_module/archive/v${HTTP_UPSTREAM_CHECK_MODULE_PV}.tar.gz"
218 +HTTP_UPSTREAM_CHECK_MODULE_WD="${WORKDIR}/nginx_upstream_check_module-${HTTP_UPSTREAM_CHECK_MODULE_PV}"
219 +
220 +# http_metrics (https://github.com/zenops/ngx_metrics, BSD license)
221 +HTTP_METRICS_MODULE_PV="0.1.1"
222 +HTTP_METRICS_MODULE_P="ngx_metrics-${HTTP_METRICS_MODULE_PV}"
223 +HTTP_METRICS_MODULE_URI="https://github.com/madvertise/ngx_metrics/archive/v${HTTP_METRICS_MODULE_PV}.tar.gz"
224 +HTTP_METRICS_MODULE_WD="${WORKDIR}/ngx_metrics-${HTTP_METRICS_MODULE_PV}"
225 +
226 +# naxsi-core (https://github.com/nbs-system/naxsi, GPLv2+)
227 +HTTP_NAXSI_MODULE_PV="0.54"
228 +HTTP_NAXSI_MODULE_P="ngx_http_naxsi-${HTTP_NAXSI_MODULE_PV}"
229 +HTTP_NAXSI_MODULE_URI="https://github.com/nbs-system/naxsi/archive/${HTTP_NAXSI_MODULE_PV}.tar.gz"
230 +HTTP_NAXSI_MODULE_WD="${WORKDIR}/naxsi-${HTTP_NAXSI_MODULE_PV}/naxsi_src"
231 +
232 +# nginx-rtmp-module (https://github.com/arut/nginx-rtmp-module, BSD license)
233 +RTMP_MODULE_PV="1.1.7"
234 +RTMP_MODULE_P="ngx_rtmp-${RTMP_MODULE_PV}"
235 +RTMP_MODULE_URI="https://github.com/arut/nginx-rtmp-module/archive/v${RTMP_MODULE_PV}.tar.gz"
236 +RTMP_MODULE_WD="${WORKDIR}/nginx-rtmp-module-${RTMP_MODULE_PV}"
237 +
238 +# nginx-dav-ext-module (https://github.com/arut/nginx-dav-ext-module, BSD license)
239 +HTTP_DAV_EXT_MODULE_PV="0.0.3"
240 +HTTP_DAV_EXT_MODULE_P="ngx_http_dav_ext-${HTTP_DAV_EXT_MODULE_PV}"
241 +HTTP_DAV_EXT_MODULE_URI="https://github.com/arut/nginx-dav-ext-module/archive/v${HTTP_DAV_EXT_MODULE_PV}.tar.gz"
242 +HTTP_DAV_EXT_MODULE_WD="${WORKDIR}/nginx-dav-ext-module-${HTTP_DAV_EXT_MODULE_PV}"
243 +
244 +# echo-nginx-module (https://github.com/agentzh/echo-nginx-module, BSD license)
245 +HTTP_ECHO_MODULE_PV="0.58"
246 +HTTP_ECHO_MODULE_P="ngx_http_echo-${HTTP_ECHO_MODULE_PV}"
247 +HTTP_ECHO_MODULE_URI="https://github.com/agentzh/echo-nginx-module/archive/v${HTTP_ECHO_MODULE_PV}.tar.gz"
248 +HTTP_ECHO_MODULE_WD="${WORKDIR}/echo-nginx-module-${HTTP_ECHO_MODULE_PV}"
249 +
250 +# mod_security for nginx (https://modsecurity.org/, Apache-2.0)
251 +# keep the MODULE_P here consistent with upstream to avoid tarball duplication
252 +HTTP_SECURITY_MODULE_PV="2.9.1"
253 +HTTP_SECURITY_MODULE_P="modsecurity-${HTTP_SECURITY_MODULE_PV}"
254 +HTTP_SECURITY_MODULE_URI="https://www.modsecurity.org/tarball/${HTTP_SECURITY_MODULE_PV}/${HTTP_SECURITY_MODULE_P}.tar.gz"
255 +HTTP_SECURITY_MODULE_WD="${WORKDIR}/${HTTP_SECURITY_MODULE_P}"
256 +
257 +# push-stream-module (http://www.nginxpushstream.com, https://github.com/wandenberg/nginx-push-stream-module, GPL-3)
258 +HTTP_PUSH_STREAM_MODULE_PV="0.5.2"
259 +HTTP_PUSH_STREAM_MODULE_P="ngx_http_push_stream-${HTTP_PUSH_STREAM_MODULE_PV}"
260 +HTTP_PUSH_STREAM_MODULE_URI="https://github.com/wandenberg/nginx-push-stream-module/archive/${HTTP_PUSH_STREAM_MODULE_PV}.tar.gz"
261 +HTTP_PUSH_STREAM_MODULE_WD="${WORKDIR}/nginx-push-stream-module-${HTTP_PUSH_STREAM_MODULE_PV}"
262 +
263 +# sticky-module (https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng, BSD-2)
264 +HTTP_STICKY_MODULE_PV="1.2.6"
265 +HTTP_STICKY_MODULE_P="nginx_http_sticky_module_ng-${HTTP_STICKY_MODULE_PV}"
266 +HTTP_STICKY_MODULE_URI="https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/${HTTP_STICKY_MODULE_PV}.tar.bz2"
267 +HTTP_STICKY_MODULE_WD="${WORKDIR}/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d"
268 +
269 +# mogilefs-module (https://github.com/vkholodkov/nginx-mogilefs-module, BSD-2)
270 +HTTP_MOGILEFS_MODULE_PV="1.0.4"
271 +HTTP_MOGILEFS_MODULE_P="ngx_mogilefs_module-${HTTP_MOGILEFS_MODULE_PV}"
272 +HTTP_MOGILEFS_MODULE_URI="https://github.com/vkholodkov/nginx-mogilefs-module/archive/${HTTP_MOGILEFS_MODULE_PV}.tar.gz"
273 +HTTP_MOGILEFS_MODULE_WD="${WORKDIR}/nginx_mogilefs_module-${HTTP_MOGILEFS_MODULE_PV}"
274 +
275 +# memc-module (https://github.com/openresty/memc-nginx-module, BSD-2)
276 +HTTP_MEMC_MODULE_PV="0.16"
277 +HTTP_MEMC_MODULE_P="ngx_memc_module-${HTTP_MEMC_MODULE_PV}"
278 +HTTP_MEMC_MODULE_URI="https://github.com/openresty/memc-nginx-module/archive/v${HTTP_MEMC_MODULE_PV}.tar.gz"
279 +HTTP_MEMC_MODULE_WD="${WORKDIR}/memc-nginx-module-${HTTP_MEMC_MODULE_PV}"
280 +
281 +# nginx-ldap-auth-module (https://github.com/kvspb/nginx-auth-ldap, BSD-2)
282 +HTTP_LDAP_MODULE_PV="dbcef31bebb2d54b6120422d0b178bbf78bc48f7"
283 +HTTP_LDAP_MODULE_P="nginx-auth-ldap-${HTTP_LDAP_MODULE_PV}"
284 +HTTP_LDAP_MODULE_URI="https://github.com/kvspb/nginx-auth-ldap/archive/${HTTP_LDAP_MODULE_PV}.tar.gz"
285 +HTTP_LDAP_MODULE_WD="${WORKDIR}/nginx-auth-ldap-${HTTP_LDAP_MODULE_PV}"
286 +
287 +# We handle deps below ourselves
288 +SSL_DEPS_SKIP=1
289 +
290 +inherit ssl-cert toolchain-funcs perl-module flag-o-matic user systemd versionator multilib
291 +
292 +DESCRIPTION="Robust, small and high performance http and reverse proxy server"
293 +HOMEPAGE="http://nginx.org"
294 +SRC_URI="http://nginx.org/download/${P}.tar.gz
295 + ${DEVEL_KIT_MODULE_URI} -> ${DEVEL_KIT_MODULE_P}.tar.gz
296 + nginx_modules_http_upload_progress? ( ${HTTP_UPLOAD_PROGRESS_MODULE_URI} -> ${HTTP_UPLOAD_PROGRESS_MODULE_P}.tar.gz )
297 + nginx_modules_http_headers_more? ( ${HTTP_HEADERS_MORE_MODULE_URI} -> ${HTTP_HEADERS_MORE_MODULE_P}.tar.gz )
298 + nginx_modules_http_cache_purge? ( ${HTTP_CACHE_PURGE_MODULE_URI} -> ${HTTP_CACHE_PURGE_MODULE_P}.tar.gz )
299 + nginx_modules_http_slowfs_cache? ( ${HTTP_SLOWFS_CACHE_MODULE_URI} -> ${HTTP_SLOWFS_CACHE_MODULE_P}.tar.gz )
300 + nginx_modules_http_fancyindex? ( ${HTTP_FANCYINDEX_MODULE_URI} -> ${HTTP_FANCYINDEX_MODULE_P}.tar.gz )
301 + nginx_modules_http_lua? ( ${HTTP_LUA_MODULE_URI} -> ${HTTP_LUA_MODULE_P}.tar.gz )
302 + nginx_modules_http_auth_pam? ( ${HTTP_AUTH_PAM_MODULE_URI} -> ${HTTP_AUTH_PAM_MODULE_P}.tar.gz )
303 + nginx_modules_http_upstream_check? ( ${HTTP_UPSTREAM_CHECK_MODULE_URI} -> ${HTTP_UPSTREAM_CHECK_MODULE_P}.tar.gz )
304 + nginx_modules_http_metrics? ( ${HTTP_METRICS_MODULE_URI} -> ${HTTP_METRICS_MODULE_P}.tar.gz )
305 + nginx_modules_http_naxsi? ( ${HTTP_NAXSI_MODULE_URI} -> ${HTTP_NAXSI_MODULE_P}.tar.gz )
306 + rtmp? ( ${RTMP_MODULE_URI} -> ${RTMP_MODULE_P}.tar.gz )
307 + nginx_modules_http_dav_ext? ( ${HTTP_DAV_EXT_MODULE_URI} -> ${HTTP_DAV_EXT_MODULE_P}.tar.gz )
308 + nginx_modules_http_echo? ( ${HTTP_ECHO_MODULE_URI} -> ${HTTP_ECHO_MODULE_P}.tar.gz )
309 + nginx_modules_http_security? ( ${HTTP_SECURITY_MODULE_URI} -> ${HTTP_SECURITY_MODULE_P}.tar.gz )
310 + nginx_modules_http_push_stream? ( ${HTTP_PUSH_STREAM_MODULE_URI} -> ${HTTP_PUSH_STREAM_MODULE_P}.tar.gz )
311 + nginx_modules_http_sticky? ( ${HTTP_STICKY_MODULE_URI} -> ${HTTP_STICKY_MODULE_P}.tar.bz2 )
312 + nginx_modules_http_mogilefs? ( ${HTTP_MOGILEFS_MODULE_URI} -> ${HTTP_MOGILEFS_MODULE_P}.tar.gz )
313 + nginx_modules_http_memc? ( ${HTTP_MEMC_MODULE_URI} -> ${HTTP_MEMC_MODULE_P}.tar.gz )
314 + nginx_modules_http_auth_ldap? ( ${HTTP_LDAP_MODULE_URI} -> ${HTTP_LDAP_MODULE_P}.tar.gz )"
315 +
316 +LICENSE="BSD-2 BSD SSLeay MIT GPL-2 GPL-2+
317 + nginx_modules_http_security? ( Apache-2.0 )
318 + nginx_modules_http_push_stream? ( GPL-3 )"
319 +
320 +SLOT="0"
321 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
322 +
323 +NGINX_MODULES_STD="access auth_basic autoindex browser charset empty_gif
324 + fastcgi geo gzip limit_req limit_conn map memcached proxy referer
325 + rewrite scgi ssi split_clients upstream_ip_hash userid uwsgi"
326 +NGINX_MODULES_OPT="addition auth_request dav degradation flv geoip gunzip
327 + gzip_static image_filter mp4 perl random_index realip secure_link
328 + slice stub_status sub xslt"
329 +NGINX_MODULES_STREAM="access limit_conn upstream"
330 +NGINX_MODULES_MAIL="imap pop3 smtp"
331 +NGINX_MODULES_3RD="
332 + http_upload_progress
333 + http_headers_more
334 + http_cache_purge
335 + http_slowfs_cache
336 + http_fancyindex
337 + http_lua
338 + http_auth_pam
339 + http_upstream_check
340 + http_metrics
341 + http_naxsi
342 + http_dav_ext
343 + http_echo
344 + http_security
345 + http_push_stream
346 + http_sticky
347 + http_ajp
348 + http_mogilefs
349 + http_memc
350 + http_auth_ldap"
351 +
352 +IUSE="aio debug +http +http2 +http-cache ipv6 libatomic libressl luajit +pcre
353 + pcre-jit rtmp selinux ssl threads userland_GNU vim-syntax"
354 +
355 +for mod in $NGINX_MODULES_STD; do
356 + IUSE="${IUSE} +nginx_modules_http_${mod}"
357 +done
358 +
359 +for mod in $NGINX_MODULES_OPT; do
360 + IUSE="${IUSE} nginx_modules_http_${mod}"
361 +done
362 +
363 +for mod in $NGINX_MODULES_STREAM; do
364 + IUSE="${IUSE} nginx_modules_stream_${mod}"
365 +done
366 +
367 +for mod in $NGINX_MODULES_MAIL; do
368 + IUSE="${IUSE} nginx_modules_mail_${mod}"
369 +done
370 +
371 +for mod in $NGINX_MODULES_3RD; do
372 + IUSE="${IUSE} nginx_modules_${mod}"
373 +done
374 +
375 +# Add so we can warn users updating about config changes
376 +# @TODO: jbergstroem: remove on next release series
377 +IUSE="${IUSE} nginx_modules_http_spdy"
378 +
379 +CDEPEND="
380 + pcre? ( >=dev-libs/libpcre-4.2 )
381 + pcre-jit? ( >=dev-libs/libpcre-8.20[jit] )
382 + ssl? (
383 + !libressl? ( dev-libs/openssl:0= )
384 + libressl? ( dev-libs/libressl:= )
385 + )
386 + http2? (
387 + !libressl? ( >=dev-libs/openssl-1.0.1c:0= )
388 + libressl? ( dev-libs/libressl:= )
389 + )
390 + http-cache? (
391 + userland_GNU? (
392 + !libressl? ( dev-libs/openssl:0= )
393 + libressl? ( dev-libs/libressl:= )
394 + )
395 + )
396 + nginx_modules_http_geoip? ( dev-libs/geoip )
397 + nginx_modules_http_gunzip? ( sys-libs/zlib )
398 + nginx_modules_http_gzip? ( sys-libs/zlib )
399 + nginx_modules_http_gzip_static? ( sys-libs/zlib )
400 + nginx_modules_http_image_filter? ( media-libs/gd[jpeg,png] )
401 + nginx_modules_http_perl? ( >=dev-lang/perl-5.8 )
402 + nginx_modules_http_rewrite? ( >=dev-libs/libpcre-4.2 )
403 + nginx_modules_http_secure_link? (
404 + userland_GNU? (
405 + !libressl? ( dev-libs/openssl:0= )
406 + libressl? ( dev-libs/libressl:= )
407 + )
408 + )
409 + nginx_modules_http_xslt? ( dev-libs/libxml2 dev-libs/libxslt )
410 + nginx_modules_http_lua? ( !luajit? ( dev-lang/lua:0= ) luajit? ( dev-lang/luajit:2= ) )
411 + nginx_modules_http_auth_pam? ( virtual/pam )
412 + nginx_modules_http_metrics? ( dev-libs/yajl )
413 + nginx_modules_http_dav_ext? ( dev-libs/expat )
414 + nginx_modules_http_security? ( >=dev-libs/libxml2-2.7.8 dev-libs/apr-util www-servers/apache )
415 + nginx_modules_http_auth_ldap? ( net-nds/openldap[ssl?] )"
416 +RDEPEND="${CDEPEND}
417 + selinux? ( sec-policy/selinux-nginx )
418 + !www-servers/nginx:0"
419 +DEPEND="${CDEPEND}
420 + arm? ( dev-libs/libatomic_ops )
421 + libatomic? ( dev-libs/libatomic_ops )"
422 +PDEPEND="vim-syntax? ( app-vim/nginx-syntax )"
423 +
424 +REQUIRED_USE="pcre-jit? ( pcre )
425 + nginx_modules_http_lua? ( nginx_modules_http_rewrite )
426 + nginx_modules_http_naxsi? ( pcre )
427 + nginx_modules_http_dav_ext? ( nginx_modules_http_dav )
428 + nginx_modules_http_metrics? ( nginx_modules_http_stub_status )
429 + nginx_modules_http_security? ( pcre )
430 + nginx_modules_http_push_stream? ( ssl )"
431 +
432 +pkg_setup() {
433 + NGINX_HOME="/var/lib/nginx"
434 + NGINX_HOME_TMP="${NGINX_HOME}/tmp"
435 +
436 + ebegin "Creating nginx user and group"
437 + enewgroup ${PN}
438 + enewuser ${PN} -1 -1 "${NGINX_HOME}" ${PN}
439 + eend $?
440 +
441 + if use libatomic; then
442 + ewarn "GCC 4.1+ features built-in atomic operations."
443 + ewarn "Using libatomic_ops is only needed if using"
444 + ewarn "a different compiler or a GCC prior to 4.1"
445 + fi
446 +
447 + if [[ -n $NGINX_ADD_MODULES ]]; then
448 + ewarn "You are building custom modules via \$NGINX_ADD_MODULES!"
449 + ewarn "This nginx installation is not supported!"
450 + ewarn "Make sure you can reproduce the bug without those modules"
451 + ewarn "_before_ reporting bugs."
452 + fi
453 +
454 + if use !http; then
455 + ewarn "To actually disable all http-functionality you also have to disable"
456 + ewarn "all nginx http modules."
457 + fi
458 +
459 + if use nginx_modules_http_ajp; then
460 + eerror "The AJP module currently doesn't build for nginx >1.8."
461 + eerror "It will be reintroduced with the 1.9 series when proven stable."
462 + eerror "Either disable it or stick with nginx 1.7.x."
463 + die "AJP module not supported"
464 + fi
465 +
466 + if use nginx_modules_http_mogilefs && use threads; then
467 + eerror "mogilefs won't compile with threads support."
468 + eerror "Please disable either flag and try again."
469 + die "Can't compile mogilefs with threads support"
470 + fi
471 +}
472 +
473 +src_prepare() {
474 + eapply "${FILESDIR}/${PN}-1.4.1-fix-perl-install-path.patch"
475 +
476 + if use nginx_modules_http_upstream_check; then
477 + eapply -p0 "${FILESDIR}/check-1.9.2".patch
478 + fi
479 +
480 + if use nginx_modules_http_lua; then
481 + sed -i -e 's/-llua5.1/-llua/' "${HTTP_LUA_MODULE_WD}/config" || die
482 + fi
483 +
484 + find auto/ -type f -print0 | xargs -0 sed -i 's:\&\& make:\&\& \\$(MAKE):' || die
485 + # We have config protection, don't rename etc files
486 + sed -i 's:.default::' auto/install || die
487 + # remove useless files
488 + sed -i -e '/koi-/d' -e '/win-/d' auto/install || die
489 +
490 + # don't install to /etc/nginx/ if not in use
491 + local module
492 + for module in fastcgi scgi uwsgi ; do
493 + if ! use nginx_modules_http_${module}; then
494 + sed -i -e "/${module}/d" auto/install || die
495 + fi
496 + done
497 +
498 + eapply_user
499 +}
500 +
501 +src_configure() {
502 + # mod_security needs to generate nginx/modsecurity/config before including it
503 + if use nginx_modules_http_security; then
504 + cd "${HTTP_SECURITY_MODULE_WD}"
505 + if use luajit ; then
506 + sed -i \
507 + -e 's|^\(LUA_PKGNAMES\)=.*|\1="luajit"|' \
508 + configure || die
509 + fi
510 + ./configure \
511 + --enable-standalone-module \
512 + $(use_enable pcre-jit) \
513 + $(use_with nginx_modules_http_lua lua) || die "configure failed for mod_security"
514 + fi
515 +
516 + cd "${S}"
517 +
518 + local myconf=() http_enabled= mail_enabled= stream_enabled=
519 +
520 + use aio && myconf+=( --with-file-aio )
521 + use debug && myconf+=( --with-debug )
522 + use http2 && myconf+=( --with-http_v2_module )
523 + use ipv6 && myconf+=( --with-ipv6 )
524 + use libatomic && myconf+=( --with-libatomic )
525 + use pcre && myconf+=( --with-pcre )
526 + use pcre-jit && myconf+=( --with-pcre-jit )
527 + use threads && myconf+=( --with-threads )
528 +
529 + # HTTP modules
530 + for mod in $NGINX_MODULES_STD; do
531 + if use nginx_modules_http_${mod}; then
532 + http_enabled=1
533 + else
534 + myconf+=( --without-http_${mod}_module )
535 + fi
536 + done
537 +
538 + for mod in $NGINX_MODULES_OPT; do
539 + if use nginx_modules_http_${mod}; then
540 + http_enabled=1
541 + myconf+=( --with-http_${mod}_module )
542 + fi
543 + done
544 +
545 + if use nginx_modules_http_fastcgi; then
546 + myconf+=( --with-http_realip_module )
547 + fi
548 +
549 + # third-party modules
550 + if use nginx_modules_http_upload_progress; then
551 + http_enabled=1
552 + myconf+=( --add-module=${HTTP_UPLOAD_PROGRESS_MODULE_WD} )
553 + fi
554 +
555 + if use nginx_modules_http_headers_more; then
556 + http_enabled=1
557 + myconf+=( --add-module=${HTTP_HEADERS_MORE_MODULE_WD} )
558 + fi
559 +
560 + if use nginx_modules_http_cache_purge; then
561 + http_enabled=1
562 + myconf+=( --add-module=${HTTP_CACHE_PURGE_MODULE_WD} )
563 + fi
564 +
565 + if use nginx_modules_http_slowfs_cache; then
566 + http_enabled=1
567 + myconf+=( --add-module=${HTTP_SLOWFS_CACHE_MODULE_WD} )
568 + fi
569 +
570 + if use nginx_modules_http_fancyindex; then
571 + http_enabled=1
572 + myconf+=( --add-module=${HTTP_FANCYINDEX_MODULE_WD} )
573 + fi
574 +
575 + if use nginx_modules_http_lua; then
576 + http_enabled=1
577 + if use luajit; then
578 + export LUAJIT_LIB=$(pkg-config --variable libdir luajit)
579 + export LUAJIT_INC=$(pkg-config --variable includedir luajit)
580 + else
581 + export LUA_LIB=$(pkg-config --variable libdir lua)
582 + export LUA_INC=$(pkg-config --variable includedir lua)
583 + fi
584 + myconf+=( --add-module=${DEVEL_KIT_MODULE_WD} )
585 + myconf+=( --add-module=${HTTP_LUA_MODULE_WD} )
586 + fi
587 +
588 + if use nginx_modules_http_auth_pam; then
589 + http_enabled=1
590 + myconf+=( --add-module=${HTTP_AUTH_PAM_MODULE_WD} )
591 + fi
592 +
593 + if use nginx_modules_http_upstream_check; then
594 + http_enabled=1
595 + myconf+=( --add-module=${HTTP_UPSTREAM_CHECK_MODULE_WD} )
596 + fi
597 +
598 + if use nginx_modules_http_metrics; then
599 + http_enabled=1
600 + myconf+=( --add-module=${HTTP_METRICS_MODULE_WD} )
601 + fi
602 +
603 + if use nginx_modules_http_naxsi ; then
604 + http_enabled=1
605 + myconf+=( --add-module=${HTTP_NAXSI_MODULE_WD} )
606 + fi
607 +
608 + if use rtmp ; then
609 + http_enabled=1
610 + myconf+=( --add-module=${RTMP_MODULE_WD} )
611 + fi
612 +
613 + if use nginx_modules_http_dav_ext ; then
614 + http_enabled=1
615 + myconf+=( --add-module=${HTTP_DAV_EXT_MODULE_WD} )
616 + fi
617 +
618 + if use nginx_modules_http_echo ; then
619 + http_enabled=1
620 + myconf+=( --add-module=${HTTP_ECHO_MODULE_WD} )
621 + fi
622 +
623 + if use nginx_modules_http_security ; then
624 + http_enabled=1
625 + myconf+=( --add-module=${HTTP_SECURITY_MODULE_WD}/nginx/modsecurity )
626 + fi
627 +
628 + if use nginx_modules_http_push_stream ; then
629 + http_enabled=1
630 + myconf+=( --add-module=${HTTP_PUSH_STREAM_MODULE_WD} )
631 + fi
632 +
633 + if use nginx_modules_http_sticky ; then
634 + http_enabled=1
635 + myconf+=( --add-module=${HTTP_STICKY_MODULE_WD} )
636 + fi
637 +
638 + if use nginx_modules_http_mogilefs ; then
639 + http_enabled=1
640 + myconf+=( --add-module=${HTTP_MOGILEFS_MODULE_WD} )
641 + fi
642 +
643 + if use nginx_modules_http_memc ; then
644 + http_enabled=1
645 + myconf+=( --add-module=${HTTP_MEMC_MODULE_WD} )
646 + fi
647 +
648 + if use nginx_modules_http_auth_ldap; then
649 + http_enabled=1
650 + myconf+=( --add-module=${HTTP_LDAP_MODULE_WD} )
651 + fi
652 +
653 + if use http || use http-cache || use http2; then
654 + http_enabled=1
655 + fi
656 +
657 + if [ $http_enabled ]; then
658 + use http-cache || myconf+=( --without-http-cache )
659 + use ssl && myconf+=( --with-http_ssl_module )
660 + else
661 + myconf+=( --without-http --without-http-cache )
662 + fi
663 +
664 + # Stream modules
665 + for mod in $NGINX_MODULES_STREAM; do
666 + if use nginx_modules_stream_${mod}; then
667 + stream_enabled=1
668 + else
669 + # Treat stream upstream slightly differently
670 + if ! use nginx_modules_stream_upstream; then
671 + myconf+=( --without-stream_upstream_hash_module )
672 + myconf+=( --without-stream_upstream_least_conn_module )
673 + myconf+=( --without-stream_upstream_zone_module )
674 + else
675 + myconf+=( --without-stream_${stream}_module )
676 + fi
677 + fi
678 + done
679 +
680 + if [ $stream_enabled ]; then
681 + myconf+=( --with-stream )
682 + use ssl && myconf+=( --with-stream_ssl_module )
683 + fi
684 +
685 + # MAIL modules
686 + for mod in $NGINX_MODULES_MAIL; do
687 + if use nginx_modules_mail_${mod}; then
688 + mail_enabled=1
689 + else
690 + myconf+=( --without-mail_${mod}_module )
691 + fi
692 + done
693 +
694 + if [ $mail_enabled ]; then
695 + myconf+=( --with-mail )
696 + use ssl && myconf+=( --with-mail_ssl_module )
697 + fi
698 +
699 + # custom modules
700 + for mod in $NGINX_ADD_MODULES; do
701 + myconf+=( --add-module=${mod} )
702 + done
703 +
704 + # https://bugs.gentoo.org/286772
705 + export LANG=C LC_ALL=C
706 + tc-export CC
707 +
708 + if ! use prefix; then
709 + myconf+=( --user=${PN}" "--group=${PN} )
710 + fi
711 +
712 + ./configure \
713 + --prefix="${EPREFIX}"/usr \
714 + --conf-path="${EPREFIX}"/etc/${PN}/${PN}.conf \
715 + --error-log-path="${EPREFIX}"/var/log/${PN}/error_log \
716 + --pid-path="${EPREFIX}"/run/${PN}.pid \
717 + --lock-path="${EPREFIX}"/run/lock/${PN}.lock \
718 + --with-cc-opt="-I${EROOT}usr/include" \
719 + --with-ld-opt="-L${EROOT}usr/$(get_libdir)" \
720 + --http-log-path="${EPREFIX}"/var/log/${PN}/access_log \
721 + --http-client-body-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/client \
722 + --http-proxy-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/proxy \
723 + --http-fastcgi-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/fastcgi \
724 + --http-scgi-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/scgi \
725 + --http-uwsgi-temp-path="${EPREFIX}${NGINX_HOME_TMP}"/uwsgi \
726 + "${myconf[@]}" || die "configure failed"
727 +
728 + # A purely cosmetic change that makes nginx -V more readable. This can be
729 + # good if people outside the gentoo community would troubleshoot and
730 + # question the users setup.
731 + sed -i -e "s|${WORKDIR}|external_module|g" objs/ngx_auto_config.h || die
732 +}
733 +
734 +src_compile() {
735 + use nginx_modules_http_security && emake -C "${HTTP_SECURITY_MODULE_WD}"
736 +
737 + # https://bugs.gentoo.org/286772
738 + export LANG=C LC_ALL=C
739 + emake LINK="${CC} ${LDFLAGS}" OTHERLDFLAGS="${LDFLAGS}"
740 +}
741 +
742 +src_install() {
743 + emake DESTDIR="${D%/}" install
744 +
745 + cp "${FILESDIR}"/nginx.conf-r2 "${ED}"etc/nginx/nginx.conf || die
746 +
747 + newinitd "${FILESDIR}"/nginx.initd-r3 nginx
748 +
749 + systemd_newunit "${FILESDIR}"/nginx.service-r1 nginx.service
750 +
751 + doman man/nginx.8
752 + dodoc CHANGES* README
753 +
754 + # just keepdir. do not copy the default htdocs files (bug #449136)
755 + keepdir /var/www/localhost
756 + rm -rf "${D}"usr/html || die
757 +
758 + # set up a list of directories to keep
759 + local keepdir_list="${NGINX_HOME_TMP}"/client
760 + local module
761 + for module in proxy fastcgi scgi uwsgi; do
762 + use nginx_modules_http_${module} && keepdir_list+=" ${NGINX_HOME_TMP}/${module}"
763 + done
764 +
765 + keepdir /var/log/nginx ${keepdir_list}
766 +
767 + # this solves a problem with SELinux where nginx doesn't see the directories
768 + # as root and tries to create them as nginx
769 + fperms 0750 "${NGINX_HOME_TMP}"
770 + fowners ${PN}:0 "${NGINX_HOME_TMP}"
771 +
772 + fperms 0700 /var/log/nginx ${keepdir_list}
773 + fowners ${PN}:${PN} /var/log/nginx ${keepdir_list}
774 +
775 + # logrotate
776 + insinto /etc/logrotate.d
777 + newins "${FILESDIR}"/nginx.logrotate-r1 nginx
778 +
779 + if use nginx_modules_http_perl; then
780 + cd "${S}"/objs/src/http/modules/perl/
781 + emake DESTDIR="${D}" INSTALLDIRS=vendor
782 + perl_delete_localpod
783 + fi
784 +
785 + if use nginx_modules_http_cache_purge; then
786 + docinto ${HTTP_CACHE_PURGE_MODULE_P}
787 + dodoc "${HTTP_CACHE_PURGE_MODULE_WD}"/{CHANGES,README.md,TODO.md}
788 + fi
789 +
790 + if use nginx_modules_http_slowfs_cache; then
791 + docinto ${HTTP_SLOWFS_CACHE_MODULE_P}
792 + dodoc "${HTTP_SLOWFS_CACHE_MODULE_WD}"/{CHANGES,README.md}
793 + fi
794 +
795 + if use nginx_modules_http_fancyindex; then
796 + docinto ${HTTP_FANCYINDEX_MODULE_P}
797 + dodoc "${HTTP_FANCYINDEX_MODULE_WD}"/README.rst
798 + fi
799 +
800 + if use nginx_modules_http_lua; then
801 + docinto ${HTTP_LUA_MODULE_P}
802 + dodoc "${HTTP_LUA_MODULE_WD}"/{Changes,README.markdown}
803 + fi
804 +
805 + if use nginx_modules_http_auth_pam; then
806 + docinto ${HTTP_AUTH_PAM_MODULE_P}
807 + dodoc "${HTTP_AUTH_PAM_MODULE_WD}"/{README.md,ChangeLog}
808 + fi
809 +
810 + if use nginx_modules_http_upstream_check; then
811 + docinto ${HTTP_UPSTREAM_CHECK_MODULE_P}
812 + dodoc "${HTTP_UPSTREAM_CHECK_MODULE_WD}"/{README,CHANGES}
813 + fi
814 +
815 + if use nginx_modules_http_naxsi; then
816 + insinto /etc/nginx
817 + doins "${HTTP_NAXSI_MODULE_WD}"/../naxsi_config/naxsi_core.rules
818 + fi
819 +
820 + if use rtmp; then
821 + docinto ${RTMP_MODULE_P}
822 + dodoc "${RTMP_MODULE_WD}"/{AUTHORS,README.md,stat.xsl}
823 + fi
824 +
825 + if use nginx_modules_http_dav_ext; then
826 + docinto ${HTTP_DAV_EXT_MODULE_P}
827 + dodoc "${HTTP_DAV_EXT_MODULE_WD}"/README
828 + fi
829 +
830 + if use nginx_modules_http_echo; then
831 + docinto ${HTTP_ECHO_MODULE_P}
832 + dodoc "${HTTP_ECHO_MODULE_WD}"/{README.markdown,doc/HttpEchoModule.wiki}
833 + fi
834 +
835 + if use nginx_modules_http_security; then
836 + docinto ${HTTP_SECURITY_MODULE_P}
837 + dodoc "${HTTP_SECURITY_MODULE_WD}"/{CHANGES,README.TXT,authors.txt}
838 + fi
839 +
840 + if use nginx_modules_http_push_stream; then
841 + docinto ${HTTP_PUSH_STREAM_MODULE_P}
842 + dodoc "${HTTP_PUSH_STREAM_MODULE_WD}"/{AUTHORS,CHANGELOG.textile,README.textile}
843 + fi
844 +
845 + if use nginx_modules_http_sticky; then
846 + docinto ${HTTP_STICKY_MODULE_P}
847 + dodoc "${HTTP_STICKY_MODULE_WD}"/{README.md,Changelog.txt,docs/sticky.pdf}
848 + fi
849 +
850 + if use nginx_modules_http_memc; then
851 + docinto ${HTTP_MEMC_MODULE_P}
852 + dodoc "${HTTP_MEMC_MODULE_WD}"/README.markdown
853 + fi
854 +
855 + if use nginx_modules_http_auth_ldap; then
856 + docinto ${HTTP_LDAP_MODULE_P}
857 + dodoc "${HTTP_LDAP_MODULE_WD}"/example.conf
858 + fi
859 +}
860 +
861 +pkg_postinst() {
862 + if use ssl; then
863 + if [ ! -f "${EROOT}"etc/ssl/${PN}/${PN}.key ]; then
864 + install_cert /etc/ssl/${PN}/${PN}
865 + use prefix || chown ${PN}:${PN} "${EROOT}"etc/ssl/${PN}/${PN}.{crt,csr,key,pem}
866 + fi
867 + fi
868 +
869 + if use nginx_modules_http_spdy; then
870 + ewarn "In nginx 1.9.5 the spdy module was superseded by http2."
871 + ewarn "Update your configs and package.use accordingly."
872 + fi
873 +
874 + if use nginx_modules_http_lua && use http2; then
875 + ewarn "Lua 3rd party module author warns against using ${P} with"
876 + ewarn "NGINX_MODULES_HTTP=\"lua http2\". For more info, see http://git.io/OldLsg"
877 + fi
878 +
879 + # This is the proper fix for bug #458726/#469094, resp. CVE-2013-0337 for
880 + # existing installations
881 + local fix_perms=0
882 +
883 + for rv in ${REPLACING_VERSIONS} ; do
884 + version_compare ${rv} 1.4.1-r2
885 + [[ $? -eq 1 ]] && fix_perms=1
886 + done
887 +
888 + if [[ $fix_perms -eq 1 ]] ; then
889 + ewarn "To fix a security bug (CVE-2013-0337, bug #458726) had the following"
890 + ewarn "directories the world-readable bit removed (if set):"
891 + ewarn " ${EPREFIX}/var/log/nginx"
892 + ewarn " ${EPREFIX}${NGINX_HOME_TMP}/{,client,proxy,fastcgi,scgi,uwsgi}"
893 + ewarn "Check if this is correct for your setup before restarting nginx!"
894 + ewarn "This is a one-time change and will not happen on subsequent updates."
895 + ewarn "Furthermore nginx' temp directories got moved to ${NGINX_HOME_TMP}"
896 + chmod -f o-rwx "${EPREFIX}"/var/log/nginx "${EPREFIX}${NGINX_HOME_TMP}"/{,client,proxy,fastcgi,scgi,uwsgi}
897 + fi
898 +
899 + # If the nginx user can't change into or read the dir, display a warning.
900 + # If su is not available we display the warning nevertheless since we can't check properly
901 + su -s /bin/sh -c 'cd /var/log/nginx/ && ls' nginx >&/dev/null
902 + if [ $? -ne 0 ] ; then
903 + ewarn "Please make sure that the nginx user or group has at least"
904 + ewarn "'rx' permissions on /var/log/nginx (default on a fresh install)"
905 + ewarn "Otherwise you end up with empty log files after a logrotate."
906 + fi
907 +}