Gentoo Archives: gentoo-commits

From: Alexys Jacob <ultrabug@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-servers/uwsgi/
Date: Mon, 31 Jul 2017 14:52:49
Message-Id: 1501512751.26aecad5d1977c3e8b8897164c2186fcfee13eab.ultrabug@gentoo
1 commit: 26aecad5d1977c3e8b8897164c2186fcfee13eab
2 Author: Ultrabug <ultrabug <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 31 14:52:07 2017 +0000
4 Commit: Alexys Jacob <ultrabug <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 31 14:52:31 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=26aecad5
7
8 www-servers/uwsgi: revbump for #624866 #624860 #596598 #620852
9
10 Package-Manager: Portage-2.3.6, Repoman-2.3.3
11
12 www-servers/uwsgi/uwsgi-2.0.15-r1.ebuild | 413 +++++++++++++++++++++++++++++++
13 1 file changed, 413 insertions(+)
14
15 diff --git a/www-servers/uwsgi/uwsgi-2.0.15-r1.ebuild b/www-servers/uwsgi/uwsgi-2.0.15-r1.ebuild
16 new file mode 100644
17 index 00000000000..29acbfa8939
18 --- /dev/null
19 +++ b/www-servers/uwsgi/uwsgi-2.0.15-r1.ebuild
20 @@ -0,0 +1,413 @@
21 +# Copyright 1999-2017 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=5
25 +
26 +PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy )
27 +PYTHON_REQ_USE="threads(+)"
28 +
29 +RUBY_OPTIONAL="yes"
30 +USE_RUBY="ruby21 ruby22 ruby23 ruby24"
31 +
32 +PHP_EXT_INI="no"
33 +PHP_EXT_NAME="dummy"
34 +PHP_EXT_OPTIONAL_USE="php"
35 +USE_PHP="php5-6 php7-0" # deps must be registered separately below
36 +
37 +MY_P="${P/_/-}"
38 +
39 +inherit apache-module eutils flag-o-matic multilib pax-utils php-ext-source-r2 python-r1 ruby-ng versionator
40 +
41 +DESCRIPTION="uWSGI server for Python web applications"
42 +HOMEPAGE="http://projects.unbit.it/uwsgi/"
43 +SRC_URI="https://github.com/unbit/uwsgi/archive/${PV}.tar.gz -> ${P}.tar.gz"
44 +
45 +LICENSE="GPL-2"
46 +SLOT="0"
47 +KEYWORDS="~amd64 ~x86 ~amd64-linux"
48 +
49 +UWSGI_PLUGINS_STD=( ping cache carbon nagios rpc rrdtool
50 + http ugreen signal syslog rsyslog
51 + router_{uwsgi,redirect,basicauth,rewrite,http,cache,static,memcached,redis,hash,expires,metrics}
52 + {core,fast,raw,ssl}router
53 + redislog mongodblog log{file,socket}
54 + spooler cheaper_busyness symcall
55 + transformation_{chunked,gzip,offload,tofile}
56 + zergpool )
57 +UWSGI_PLUGINS_OPT=( alarm_{curl,xmpp} clock_{monotonic,realtime} curl_cron
58 + dumbloop echo emperor_{amqp,pg,zeromq} forkptyrouter
59 + geoip graylog2 legion_cache_fetch ldap log{crypto,pipe} notfound pam
60 + rados router_{access,radius,spnego,xmldir}
61 + sqlite ssi stats_pusher_statsd
62 + systemd_logger transformation_toupper tuntap webdav xattr xslt zabbix )
63 +
64 +LANG_SUPPORT_SIMPLE=( cgi mono perl ) # plugins which can be built in the main build process
65 +LANG_SUPPORT_EXTENDED=( go lua php pypy python python_asyncio python_gevent ruby )
66 +
67 +# plugins to be ignored (for now):
68 +# cheaper_backlog2: example plugin
69 +# coroae: TODO
70 +# cplusplus: partially example code, needs explicit class
71 +# dummy: no idea
72 +# example: example plugin
73 +# exception_log: example plugin
74 +# *java*: TODO
75 +# v8: TODO
76 +# matheval: TODO
77 +IUSE="apache2 +caps debug +embedded expat jemalloc json libressl +pcre +routing selinux +ssl +xml yajl yaml zeromq"
78 +
79 +for plugin in ${UWSGI_PLUGINS_STD[@]}; do IUSE="${IUSE} +uwsgi_plugins_${plugin}"; done
80 +for plugin in ${UWSGI_PLUGINS_OPT[@]}; do IUSE="${IUSE} uwsgi_plugins_${plugin}"; done
81 +IUSE="${IUSE} ${LANG_SUPPORT_SIMPLE[@]} ${LANG_SUPPORT_EXTENDED[@]}"
82 +
83 +REQUIRED_USE="|| ( ${LANG_SUPPORT_SIMPLE[@]} ${LANG_SUPPORT_EXTENDED[@]} )
84 + uwsgi_plugins_logcrypto? ( ssl )
85 + uwsgi_plugins_sslrouter? ( ssl )
86 + routing? ( pcre )
87 + uwsgi_plugins_emperor_zeromq? ( zeromq )
88 + uwsgi_plugins_forkptyrouter? ( uwsgi_plugins_corerouter )
89 + uwsgi_plugins_router_xmldir? ( xml !expat )
90 + pypy? ( python_targets_python2_7 )
91 + python? ( ${PYTHON_REQUIRED_USE} )
92 + python_asyncio? ( python_targets_python3_4 python_gevent )
93 + python_gevent? ( python )
94 + expat? ( xml )"
95 +
96 +# util-linux is required for libuuid when requesting zeromq support
97 +# Order:
98 +# 1. Unconditional
99 +# 2. General features
100 +# 3. Plugins
101 +# 4. Language/app support
102 +CDEPEND="sys-libs/zlib
103 + caps? ( sys-libs/libcap )
104 + json? ( !yajl? ( dev-libs/jansson )
105 + yajl? ( dev-libs/yajl ) )
106 + pcre? ( dev-libs/libpcre:3 )
107 + ssl? (
108 + !libressl? ( dev-libs/openssl:0 )
109 + libressl? ( dev-libs/libressl )
110 + )
111 + xml? ( !expat? ( dev-libs/libxml2 )
112 + expat? ( dev-libs/expat ) )
113 + yaml? ( dev-libs/libyaml )
114 + zeromq? ( net-libs/zeromq sys-apps/util-linux )
115 + uwsgi_plugins_alarm_curl? ( net-misc/curl )
116 + uwsgi_plugins_alarm_xmpp? ( net-libs/gloox )
117 + uwsgi_plugins_curl_cron? ( net-misc/curl )
118 + uwsgi_plugins_emperor_pg? ( dev-db/postgresql:= )
119 + uwsgi_plugins_geoip? ( dev-libs/geoip )
120 + uwsgi_plugins_ldap? ( net-nds/openldap )
121 + uwsgi_plugins_pam? ( virtual/pam )
122 + uwsgi_plugins_sqlite? ( dev-db/sqlite:3 )
123 + uwsgi_plugins_rados? ( sys-cluster/ceph )
124 + uwsgi_plugins_router_access? ( sys-apps/tcp-wrappers )
125 + uwsgi_plugins_router_spnego? ( virtual/krb5 )
126 + uwsgi_plugins_systemd_logger? ( sys-apps/systemd )
127 + uwsgi_plugins_webdav? ( dev-libs/libxml2 )
128 + uwsgi_plugins_xslt? ( dev-libs/libxslt )
129 + go? ( dev-lang/go:=[gccgo] )
130 + lua? ( dev-lang/lua:= )
131 + mono? ( =dev-lang/mono-4* )
132 + perl? ( dev-lang/perl:= )
133 + php? (
134 + php_targets_php5-6? ( dev-lang/php:5.6[embed] )
135 + php_targets_php7-0? ( dev-lang/php:7.0[embed] )
136 + )
137 + pypy? ( virtual/pypy )
138 + python? ( ${PYTHON_DEPS} )
139 + python_gevent? ( >=dev-python/gevent-1.2.1[${PYTHON_USEDEP}] )
140 + ruby? ( $(ruby_implementations_depend) )"
141 +DEPEND="${CDEPEND}
142 + virtual/pkgconfig"
143 +RDEPEND="${CDEPEND}
144 + selinux? ( sec-policy/selinux-uwsgi )
145 + uwsgi_plugins_rrdtool? ( net-analyzer/rrdtool )"
146 +
147 +want_apache2
148 +
149 +S="${WORKDIR}/${MY_P}"
150 +APXS2_S="${S}/apache2"
151 +APACHE2_MOD_CONF="42_mod_uwsgi-r2 42_mod_uwsgi"
152 +
153 +# FIXME: is this patch still useful?
154 +PATCHES=(
155 + "${FILESDIR}/2.0.14-php-plugin.patch"
156 +)
157 +
158 +src_unpack() {
159 + default
160 +}
161 +
162 +pkg_setup() {
163 + python_setup
164 + use ruby && ruby-ng_pkg_setup
165 + depend.apache_pkg_setup
166 +}
167 +
168 +src_prepare() {
169 + default
170 +
171 + sed -i \
172 + -e "s|'-O2', ||" \
173 + -e "s|'-Werror', ||" \
174 + -e "s|uc.get('plugin_dir')|uc.get('plugin_build_dir')|" \
175 + uwsgiconfig.py || die "sed failed"
176 +
177 + sed -i \
178 + -e "s|/lib|/$(get_libdir)|" \
179 + plugins/php/uwsgiplugin.py || die "sed failed"
180 +}
181 +
182 +src_configure() {
183 + local embedded_plugins=()
184 + local plugins=()
185 + local malloc_impl="libc"
186 + local json="false"
187 + local xml="false"
188 +
189 + for p in ${UWSGI_PLUGINS_STD[@]} ${UWSGI_PLUGINS_OPT[@]} ; do
190 + use uwsgi_plugins_${p} && embedded_plugins+=("${p}")
191 + done
192 + for p in ${LANG_SUPPORT_SIMPLE[@]} ; do
193 + use ${p} && plugins+=("${p}")
194 + done
195 +
196 + # do not embed any plugins
197 + if ! use embedded; then
198 + plugins=( ${plugins[@]} ${embedded_plugins[@]} )
199 + embedded_plugins=()
200 + fi
201 +
202 + # flatten the arrays
203 + plugins=${plugins[@]}
204 + embedded_plugins=${embedded_plugins[@]}
205 +
206 + # rename some of the use flags, language plugins are always real plugins
207 + plugins="${plugins/perl/psgi}"
208 + plugins="${plugins/sqlite/sqlite3}"
209 + embedded_plugins="${embedded_plugins/sqlite/sqlite3}"
210 +
211 + # override defaults as requested by the user
212 + if use xml; then
213 + use expat && xml="expat" || xml="libxml2"
214 + fi
215 + if use json; then
216 + use yajl && json="yajl" || json="jansson"
217 + fi
218 + use jemalloc && malloc_impl="jemalloc"
219 +
220 + # prepare the buildconf for gentoo
221 + cp "${FILESDIR}"/gentoo.buildconf buildconf/gentoo.ini || die
222 + sed -i \
223 + -e "s|VAR_XML|${xml}|" \
224 + -e "s|VAR_YAML|$(usex yaml libyaml true)|" \
225 + -e "s|VAR_JSON|${json}|" \
226 + -e "s|VAR_SSL|$(usex ssl true false)|" \
227 + -e "s|VAR_PCRE|$(usex pcre true false)|" \
228 + -e "s|VAR_ZMQ|$(usex zeromq true false)|" \
229 + -e "s|VAR_ROUTING|$(usex routing true false)|" \
230 + -e "s|VAR_DEBUG|$(usex debug true false)|" \
231 + -e "s|VAR_MALLOC|${malloc_impl}|" \
232 + -e "s|VAR_PLUGINS|${plugins// /, }|" \
233 + -e "s|VAR_PLUGIN_DIR|${EPREFIX}/usr/$(get_libdir)/uwsgi|" \
234 + -e "s|VAR_BUILD_DIR|${T}/plugins|" \
235 + -e "s|VAR_EMBEDDED|${embedded_plugins// /, }|" \
236 + buildconf/gentoo.ini || die "sed failed"
237 +
238 + if ! use caps; then
239 + sed -i -e 's|sys/capability.h|DISABLED|' uwsgiconfig.py || die "sed failed"
240 + fi
241 +
242 + if ! use zeromq; then
243 + sed -i -e 's|uuid/uuid.h|DISABLED|' uwsgiconfig.py || die "sed failed"
244 + fi
245 +
246 + if use uwsgi_plugins_emperor_pg ; then
247 + PGPV="$(best_version dev-db/postgresql)"
248 + PGSLOT="$(get_version_component_range 1-2 ${PGPV##dev-db/postgresql-})"
249 + sed -i \
250 + -e "s|pg_config|pg_config${PGSLOT/.}|" \
251 + plugins/emperor_pg/uwsgiplugin.py || die "sed failed"
252 + fi
253 +}
254 +
255 +each_ruby_compile() {
256 + cd "${WORKDIR}/${MY_P}" || die "sed failed"
257 +
258 + UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/rack gentoo rack_${RUBY##*/} || die "building plugin for ${RUBY} failed"
259 + UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/fiber gentoo fiber_${RUBY##*/}|| die "building fiber plugin for ${RUBY} failed"
260 + UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/rbthreads gentoo rbthreads_${RUBY##*/}|| die "building rbthreads plugin for ${RUBY} failed"
261 +}
262 +
263 +python_compile_plugins() {
264 + local EPYV
265 + local PYV
266 + EPYV=${EPYTHON/.}
267 + PYV=${EPYV/python}
268 +
269 + if [[ ${EPYTHON} == pypy* ]]; then
270 + einfo "skipping because pypy is not meant to build plugins on its own"
271 + return
272 + fi
273 +
274 + ${PYTHON} uwsgiconfig.py --plugin plugins/python gentoo ${EPYV} || die "building plugin for ${EPYTHON} failed"
275 +
276 + if use python_asyncio ; then
277 + if [[ "${PYV}" == "34" || "${PYV}" == "35" ]] ; then
278 + ${PYTHON} uwsgiconfig.py --plugin plugins/asyncio gentoo asyncio${PYV} || die "building plugin for asyncio-support in ${EPYTHON} failed"
279 + fi
280 + fi
281 +
282 + if use python_gevent ; then
283 + ${PYTHON} uwsgiconfig.py --plugin plugins/gevent gentoo gevent${PYV} || die "building plugin for gevent-support in ${EPYTHON} failed"
284 + fi
285 +
286 + if use pypy ; then
287 + if [[ "${PYV}" == "27" ]] ; then
288 + # TODO: do some proper patching ? The wiki didn't help... I gave up for now.
289 + # QA: RWX --- --- usr/lib64/uwsgi/pypy_plugin.so
290 + append-ldflags -Wl,-z,noexecstack
291 + ${PYTHON} uwsgiconfig.py --plugin plugins/pypy gentoo pypy || die "building plugin for pypy-support in ${EPYTHON} failed"
292 + fi
293 + fi
294 +}
295 +
296 +python_install_symlinks() {
297 + dosym uwsgi /usr/bin/uwsgi_${EPYTHON/.}
298 +}
299 +
300 +src_compile() {
301 + mkdir -p "${T}/plugins" || die
302 +
303 + python uwsgiconfig.py --build gentoo || die "building uwsgi failed"
304 +
305 + if use go ; then
306 + python uwsgiconfig.py --plugin plugins/gccgo gentoo || die "building plugin for go failed"
307 + fi
308 +
309 + if use lua ; then
310 + # setting the name for the pkg-config file to lua, since we don't have
311 + # slotted lua
312 + UWSGICONFIG_LUAPC="lua" python uwsgiconfig.py --plugin plugins/lua gentoo || die "building plugin for lua failed"
313 + fi
314 +
315 + if use php ; then
316 + for s in $(php_get_slots); do
317 + UWSGICONFIG_PHPDIR="/usr/$(get_libdir)/${s}" python uwsgiconfig.py --plugin plugins/php gentoo ${s/.} || die "building plugin for ${s} failed"
318 + done
319 + fi
320 +
321 + if use python ; then
322 + python_foreach_impl python_compile_plugins
323 + fi
324 +
325 + if use ruby ; then
326 + ruby-ng_src_compile
327 + fi
328 +
329 + if use apache2 ; then
330 + for m in proxy_uwsgi Ruwsgi uwsgi ; do
331 + APXS2_ARGS="-c mod_${m}.c"
332 + apache-module_src_compile
333 + done
334 + fi
335 +}
336 +
337 +src_install() {
338 + dobin uwsgi
339 + pax-mark m "${D}"/usr/bin/uwsgi
340 +
341 + insinto /usr/$(get_libdir)/uwsgi
342 + doins "${T}/plugins"/*.so
343 +
344 + use cgi && dosym uwsgi /usr/bin/uwsgi_cgi
345 + use go && dosym uwsgi /usr/bin/uwsgi_go
346 + use lua && dosym uwsgi /usr/bin/uwsgi_lua
347 + use mono && dosym uwsgi /usr/bin/uwsgi_mono
348 + use perl && dosym uwsgi /usr/bin/uwsgi_psgi
349 +
350 + if use php ; then
351 + for s in $(php_get_slots); do
352 + dosym uwsgi /usr/bin/uwsgi_${s/.}
353 + done
354 + fi
355 +
356 + if use python ; then
357 + python_foreach_impl python_install_symlinks
358 + python_foreach_impl python_domodule uwsgidecorators.py
359 + fi
360 +
361 + if use apache2; then
362 + for m in proxy_uwsgi Ruwsgi uwsgi ; do
363 + APACHE2_MOD_FILE="${APXS2_S}/.libs/mod_${m}.so"
364 + apache-module_src_install
365 + done
366 + fi
367 +
368 + newinitd "${FILESDIR}"/uwsgi.initd-r7 uwsgi
369 + newconfd "${FILESDIR}"/uwsgi.confd-r4 uwsgi
370 + keepdir /etc/"${PN}".d
371 + use uwsgi_plugins_spooler && keepdir /var/spool/"${PN}"
372 +}
373 +
374 +pkg_postinst() {
375 + if use apache2 ; then
376 + elog "Three Apache modules have been installed: mod_proxy_uwsgi, mod_uwsgi and mod_Ruwsgi."
377 + elog "You can enable them with -D PROXY_UWSGI, -DUWSGI or -DRUWSGI in /etc/conf.d/apache2."
378 + elog "mod_uwsgi and mod_Ruwsgi have the same configuration interface and define the same symbols."
379 + elog "Therefore you can enable only one of them at a time."
380 + elog "mod_uwsgi is commercially supported by Unbit and stable but a bit hacky."
381 + elog "mod_Ruwsgi is newer and more Apache-API friendly but not commercially supported."
382 + elog "mod_proxy_uwsgi is a proxy module, considered stable and is now the recommended module."
383 + fi
384 +
385 + elog "Append the following options to the uwsgi call to load the respective language plugin:"
386 + use cgi && elog " '--plugins cgi' for cgi"
387 + use lua && elog " '--plugins lua' for lua"
388 + use mono && elog " '--plugins mono' for mono"
389 + use perl && elog " '--plugins psgi' for perl"
390 +
391 + if use php ; then
392 + for s in $(php_get_slots); do
393 + elog " '--plugins ${s/.}' for ${s}"
394 + done
395 + fi
396 +
397 + python_pkg_postinst() {
398 + local EPYV
399 + local PYV
400 + EPYV=${EPYTHON/.}
401 + PYV=${EPYV/python}
402 +
403 + if [[ ${EPYTHON} == pypy* ]] ; then
404 + elog " '--plugins pypy' for pypy"
405 + return
406 + fi
407 +
408 + elog " "
409 + elog " '--plugins ${EPYV}' for ${EPYTHON}"
410 + if use python_asyncio ; then
411 + if [[ ${EPYV} == python34 ]] ; then
412 + elog " '--plugins ${EPYV},asyncio${PYV}' for asyncio support in ${EPYTHON}"
413 + else
414 + elog " (asyncio is only supported in python3.4)"
415 + fi
416 + fi
417 + if use python_gevent ; then
418 + elog " '--plugins ${EPYV},gevent${PYV}' for gevent support in ${EPYTHON}"
419 + fi
420 + }
421 +
422 + use python && python_foreach_impl python_pkg_postinst
423 +
424 + if use ruby ; then
425 + for ruby in $USE_RUBY; do
426 + if use ruby_targets_${ruby} ; then
427 + elog " '--plugins rack_${ruby/.}' for ${ruby}"
428 + elog " '--plugins fiber_${ruby/.}' for ${ruby} fibers"
429 + elog " '--plugins rbthreads_${ruby/.}' for ${ruby} rbthreads"
430 + fi
431 + done
432 + fi
433 +}