Gentoo Archives: gentoo-commits

From: "Alexys Jacob (ultrabug)" <ultrabug@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in www-servers/uwsgi: uwsgi-2.0-r1.ebuild ChangeLog uwsgi-2.0.ebuild
Date: Wed, 22 Jan 2014 17:07:15
Message-Id: 20140122170711.71BE02004C@flycatcher.gentoo.org
1 ultrabug 14/01/22 17:07:11
2
3 Modified: ChangeLog
4 Added: uwsgi-2.0-r1.ebuild
5 Removed: uwsgi-2.0.ebuild
6 Log:
7 fix #498738 thx to Zhixu Liu, rev bump
8
9 (Portage version: 2.2.8/cvs/Linux x86_64, signed Manifest commit with key B658FA13)
10
11 Revision Changes Path
12 1.50 www-servers/uwsgi/ChangeLog
13
14 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/uwsgi/ChangeLog?rev=1.50&view=markup
15 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/uwsgi/ChangeLog?rev=1.50&content-type=text/plain
16 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/uwsgi/ChangeLog?r1=1.49&r2=1.50
17
18 Index: ChangeLog
19 ===================================================================
20 RCS file: /var/cvsroot/gentoo-x86/www-servers/uwsgi/ChangeLog,v
21 retrieving revision 1.49
22 retrieving revision 1.50
23 diff -u -r1.49 -r1.50
24 --- ChangeLog 21 Jan 2014 15:40:57 -0000 1.49
25 +++ ChangeLog 22 Jan 2014 17:07:11 -0000 1.50
26 @@ -1,6 +1,12 @@
27 # ChangeLog for www-servers/uwsgi
28 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
29 -# $Header: /var/cvsroot/gentoo-x86/www-servers/uwsgi/ChangeLog,v 1.49 2014/01/21 15:40:57 jer Exp $
30 +# $Header: /var/cvsroot/gentoo-x86/www-servers/uwsgi/ChangeLog,v 1.50 2014/01/22 17:07:11 ultrabug Exp $
31 +
32 +*uwsgi-2.0-r1 (22 Jan 2014)
33 +
34 + 22 Jan 2014; Ultrabug <ultrabug@g.o> -uwsgi-2.0.ebuild,
35 + +uwsgi-2.0-r1.ebuild:
36 + Fix #498738 wrt xml and json USE flag detection thx to Zhixu Liu, rev bump
37
38 21 Jan 2014; Jeroen Roovers <jer@g.o> metadata.xml:
39 Whitespace.
40
41
42
43 1.1 www-servers/uwsgi/uwsgi-2.0-r1.ebuild
44
45 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/uwsgi/uwsgi-2.0-r1.ebuild?rev=1.1&view=markup
46 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/www-servers/uwsgi/uwsgi-2.0-r1.ebuild?rev=1.1&content-type=text/plain
47
48 Index: uwsgi-2.0-r1.ebuild
49 ===================================================================
50 # Copyright 1999-2014 Gentoo Foundation
51 # Distributed under the terms of the GNU General Public License v2
52 # $Header: /var/cvsroot/gentoo-x86/www-servers/uwsgi/uwsgi-2.0-r1.ebuild,v 1.1 2014/01/22 17:07:11 ultrabug Exp $
53
54 EAPI="5"
55
56 PYTHON_COMPAT=( python2_{6,7} python3_{2,3} )
57
58 RUBY_OPTIONAL="yes"
59 USE_RUBY="ruby19 ruby20 ruby21"
60
61 PHP_EXT_INI="no"
62 PHP_EXT_NAME="dummy"
63 PHP_EXT_OPTIONAL_USE="php"
64 USE_PHP="php5-3 php5-4 php5-5" # deps must be registered separately below
65
66 MY_P="${P/_/-}"
67
68 inherit apache-module distutils-r1 eutils multilib pax-utils php-ext-source-r2 python-r1 ruby-ng versionator
69
70 DESCRIPTION="uWSGI server for Python web applications"
71 HOMEPAGE="http://projects.unbit.it/uwsgi/"
72 SRC_URI="http://projects.unbit.it/downloads/${MY_P}.tar.gz"
73
74 LICENSE="GPL-2"
75 SLOT="0"
76 KEYWORDS="~amd64 ~x86"
77
78 UWSGI_PLUGINS_STD=( ping cache carbon nagios rpc rrdtool
79 http ugreen signal syslog rsyslog
80 router_{uwsgi,redirect,basicauth,rewrite,http,cache,static,memcached,redis,hash,expires,metrics}
81 {core,fast,raw,ssl}router
82 redislog mongodblog log{file,socket}
83 spooler cheaper_busyness symcall
84 transformation_{chunked,gzip,offload,tofile}
85 zergpool )
86 UWSGI_PLUGINS_OPT=( alarm_{curl,xmpp} clock_{monotonic,realtime} curl_cron
87 dumbloop echo emperor_{amqp,pg,zeromq} forkptyrouter
88 geoip graylog2 legion_cache_fetch ldap log{crypto,pipe} notfound pam
89 router_{access,radius,spnego,xmldir}
90 sqlite ssi stats_pusher_statsd
91 systemd_logger transformation_toupper tuntap webdav xattr xslt zabbix )
92
93 LANG_SUPPORT_SIMPLE=( cgi perl ) # plugins which can be built in the main build process
94 LANG_SUPPORT_EXTENDED=( lua php python python_gevent ruby )
95
96 # plugins to be ignored (for now):
97 # cheaper_backlog2: example plugin
98 # coroae: TODO
99 # cplusplus: partially example code, needs explicit class
100 # dummy: no idea
101 # example: example plugin
102 # exception_log: example plugin
103 # *go*: TODO
104 # *java*: TODO
105 # *mono*: TODO
106 # v8: TODO
107 # matheval: TODO
108 IUSE="apache2 +caps debug +embedded expat jemalloc json +pcre +routing +ssl +xml yajl yaml zeromq"
109
110 for plugin in ${UWSGI_PLUGINS_STD[@]} ; do IUSE="${IUSE} +uwsgi_plugins_${plugin}" ; done
111 for plugin in ${UWSGI_PLUGINS_OPT[@]} ; do IUSE="${IUSE} uwsgi_plugins_${plugin}" ; done
112 IUSE="${IUSE} ${LANG_SUPPORT_SIMPLE[@]} ${LANG_SUPPORT_EXTENDED[@]}"
113
114 REQUIRED_USE="|| ( ${LANG_SUPPORT_SIMPLE[@]} ${LANG_SUPPORT_EXTENDED[@]} )
115 uwsgi_plugins_logcrypto? ( ssl )
116 uwsgi_plugins_sslrouter? ( ssl )
117 routing? ( pcre )
118 uwsgi_plugins_emperor_zeromq? ( zeromq )
119 uwsgi_plugins_router_xmldir? ( xml )
120 uwsgi_plugins_forkptyrouter? ( uwsgi_plugins_corerouter )
121 python? ( ${PYTHON_REQUIRED_USE} )
122 python_gevent? ( python )
123 expat? ( xml )"
124
125 # util-linux is required for libuuid when requesting zeromq support
126 # Order:
127 # 1. Unconditional
128 # 2. General features
129 # 3. Plugins
130 # 4. Language/app support
131 CDEPEND="sys-libs/zlib
132 apache2? ( www-servers/apache )
133 caps? ( sys-libs/libcap )
134 json? ( !yajl? ( dev-libs/jansson )
135 yajl? ( dev-libs/yajl ) )
136 pcre? ( dev-libs/libpcre:3 )
137 ssl? ( dev-libs/openssl )
138 xml? ( !expat? ( dev-libs/libxml2 )
139 expat? ( dev-libs/expat ) )
140 yaml? ( dev-libs/libyaml )
141 zeromq? ( net-libs/zeromq sys-apps/util-linux )
142 uwsgi_plugins_alarm_curl? ( net-misc/curl )
143 uwsgi_plugins_alarm_xmpp? ( net-libs/gloox )
144 uwsgi_plugins_curl_cron? ( net-misc/curl )
145 uwsgi_plugins_emperor_pg? ( dev-db/postgresql-base:= )
146 uwsgi_plugins_geoip? ( dev-libs/geoip )
147 uwsgi_plugins_ldap? ( net-nds/openldap )
148 uwsgi_plugins_pam? ( virtual/pam )
149 uwsgi_plugins_sqlite? ( dev-db/sqlite:3 )
150 uwsgi_plugins_router_access? ( sys-apps/tcp-wrappers )
151 uwsgi_plugins_router_spnego? ( virtual/krb5 )
152 uwsgi_plugins_rsyslog? ( app-admin/rsyslog )
153 uwsgi_plugins_systemd_logger? ( sys-apps/systemd )
154 uwsgi_plugins_webdav? ( dev-libs/libxml2 )
155 uwsgi_plugins_xslt? ( dev-libs/libxslt )
156 lua? ( dev-lang/lua )
157 perl? ( dev-lang/perl:= )
158 php? (
159 php_targets_php5-3? ( dev-lang/php:5.3[embed] )
160 php_targets_php5-4? ( dev-lang/php:5.4[embed] )
161 php_targets_php5-5? ( dev-lang/php:5.5[embed] )
162 )
163 python? ( ${PYTHON_DEPS} )
164 python_gevent? ( >=dev-python/gevent-1.0_beta2[$(python_gen_usedep 'python2*')] )
165 ruby? ( $(ruby_implementations_depend) )"
166 DEPEND="${CDEPEND}
167 virtual/pkgconfig"
168 RDEPEND="${CDEPEND}
169 uwsgi_plugins_rrdtool? ( net-analyzer/rrdtool )"
170
171 S="${WORKDIR}/${MY_P}"
172 APXS2_S="${S}/apache2"
173 APACHE2_MOD_CONF="42_mod_uwsgi-r1 42_mod_uwsgi"
174
175 src_unpack() {
176 default
177 }
178
179 pkg_setup() {
180 python_setup
181 }
182
183 src_prepare() {
184 epatch \
185 "${FILESDIR}/1.1.2-threaded-php.patch"
186
187 sed -i \
188 -e "s|'-O2', ||" \
189 -e "s|'-Werror', ||" \
190 -e "s|uc.get('plugin_dir')|uc.get('plugin_build_dir')|" \
191 uwsgiconfig.py || die "sed failed"
192
193 sed -i \
194 -e "s|/lib|/$(get_libdir)|" \
195 plugins/php/uwsgiplugin.py || die "sed failed"
196 }
197
198 src_configure() {
199 local embedded_plugins=()
200 local plugins=()
201 local malloc_impl="libc"
202 local json="false"
203 local xml="false"
204
205 for p in ${UWSGI_PLUGINS_STD[@]} ${UWSGI_PLUGINS_OPT[@]} ; do
206 use uwsgi_plugins_${p} && embedded_plugins+=("${p}")
207 done
208 for p in ${LANG_SUPPORT_SIMPLE[@]} ; do
209 use ${p} && plugins+=("${p}")
210 done
211
212 # do not embedded any plugins
213 if ! use embedded ; then
214 plugins=( ${plugins[@]} ${embedded_plugins[@]} )
215 embedded_plugins=()
216 fi
217
218 # flatten the arrays
219 plugins=${plugins[@]}
220 embedded_plugins=${embedded_plugins[@]}
221
222 # rename some of the use flags, language plugins are always real plugins
223 plugins="${plugins/perl/psgi}"
224 plugins="${plugins/sqlite/sqlite3}"
225 embedded_plugins="${embedded_plugins/sqlite/sqlite3}"
226
227 # override defaults as requested by the user
228 if use xml; then
229 use expat && xml="expat" || xml="libxml2"
230 fi
231 if use json; then
232 use yajl && json="yajl" || json="jansson"
233 fi
234 use jemalloc && malloc_impl="jemalloc"
235
236 # prepare the buildconf for gentoo
237 cp "${FILESDIR}"/gentoo.buildconf buildconf/gentoo.ini
238 sed -i \
239 -e "s|VAR_XML|${xml}|" \
240 -e "s|VAR_YAML|$(usex yaml true false)|" \
241 -e "s|VAR_JSON|${json}|" \
242 -e "s|VAR_SSL|$(usex ssl true false)|" \
243 -e "s|VAR_PCRE|$(usex pcre true false)|" \
244 -e "s|VAR_ZMQ|$(usex zeromq true false)|" \
245 -e "s|VAR_ROUTING|$(usex routing true false)|" \
246 -e "s|VAR_DEBUG|$(usex debug true false)|" \
247 -e "s|VAR_MALLOC|${malloc_impl}|" \
248 -e "s|VAR_PLUGINS|${plugins// /, }|" \
249 -e "s|VAR_PLUGIN_DIR|/usr/$(get_libdir)/uwsgi|" \
250 -e "s|VAR_BUILD_DIR|${T}/plugins|" \
251 -e "s|VAR_EMBEDDED|${embedded_plugins// /, }|" \
252 buildconf/gentoo.ini
253
254 use caps || sed -i -e 's|sys/capability.h|DISABLED|' uwsgiconfig.py || die "sed failed"
255 use zeromq || sed -i -e 's|uuid/uuid.h|DISABLED|' uwsgiconfig.py || die "sed failed"
256
257 if use uwsgi_plugins_emperor_pg ; then
258 PGPV="$(best_version dev-db/postgresql-base)"
259 PGSLOT="$(get_version_component_range 1-2 ${PGPV##dev-db/postgresql-base-})"
260 sed -i \
261 -e "s|pg_config|pg_config${PGSLOT/.}|" \
262 plugins/emperor_pg/uwsgiplugin.py || die "sed failed"
263 fi
264 }
265
266 each_ruby_compile() {
267 cd "${WORKDIR}/${MY_P}"
268
269 UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/rack gentoo rack_${RUBY##*/} || die "building plugin for ${RUBY} failed"
270
271 if [[ "${RUBY}" == *ruby19 ]] ; then
272 UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/fiber gentoo || die "building fiber plugin for ${RUBY} failed"
273 fi
274 }
275
276 python_compile_plugins() {
277 local EPYV
278 local PYV
279 EPYV=${EPYTHON/.}
280 PYV=${EPYV/python}
281
282 ${PYTHON} uwsgiconfig.py --plugin plugins/python gentoo ${EPYV} || die "building plugin for ${EPYTHON} failed"
283
284 if use python_gevent ; then
285 ${PYTHON} uwsgiconfig.py --plugin plugins/gevent gentoo gevent${PYV} || die "building plugin for gevent-support in ${EPYTHON} failed"
286 fi
287 }
288
289 python_install_symlinks() {
290 dosym uwsgi /usr/bin/uwsgi_${EPYTHON/.}
291 }
292
293 src_compile() {
294 mkdir -p "${T}/plugins"
295
296 python uwsgiconfig.py --build gentoo || die "building uwsgi failed"
297
298 if use lua ; then
299 # setting LUALIB explicitly since lua is not slotted on Gentoo
300 # and uwsgi otherwise looks for lua5.1
301 UWSGICONFIG_LUALIB="lua" python uwsgiconfig.py --plugin plugins/lua gentoo || die "building plugin for lua failed"
302 fi
303
304 if use php ; then
305 for s in $(php_get_slots); do
306 UWSGICONFIG_PHPDIR="/usr/$(get_libdir)/${s}" python uwsgiconfig.py --plugin plugins/php gentoo ${s/.} || die "building plugin for ${s} failed"
307 done
308 fi
309
310 if use python ; then
311 python_foreach_impl python_compile_plugins
312 fi
313
314 if use ruby ; then
315 ruby-ng_src_compile
316 fi
317
318 if use apache2 ; then
319 for m in proxy_uwsgi Ruwsgi uwsgi ; do
320 APXS2_ARGS="-c mod_${m}.c"
321 apache-module_src_compile
322 done
323 fi
324 }
325
326 src_install() {
327 dobin uwsgi
328 pax-mark m "${D}"/usr/bin/uwsgi
329
330 insinto /usr/$(get_libdir)/uwsgi
331 doins "${T}/plugins"/*.so
332
333 use cgi && dosym uwsgi /usr/bin/uwsgi_cgi
334 use lua && dosym uwsgi /usr/bin/uwsgi_lua
335 use perl && dosym uwsgi /usr/bin/uwsgi_psgi
336
337 if use php ; then
338 for s in $(php_get_slots); do
339 dosym uwsgi /usr/bin/uwsgi_${s/.}
340 done
341 fi
342
343 if use python ; then
344 python_foreach_impl python_install_symlinks
345 python_foreach_impl python_domodule uwsgidecorators.py
346 fi
347
348 if use apache2; then
349 for m in proxy_uwsgi Ruwsgi uwsgi ; do
350 APACHE2_MOD_FILE="${APXS2_S}/.libs/mod_${m}.so"
351 apache-module_src_install
352 done
353 fi
354
355 newinitd "${FILESDIR}"/uwsgi.initd-r3 uwsgi
356 newconfd "${FILESDIR}"/uwsgi.confd-r3 uwsgi
357 keepdir /etc/"${PN}".d
358 use uwsgi_plugins_spooler && keepdir /var/spool/"${PN}"
359 }
360
361 pkg_postinst() {
362 if use apache2 ; then
363 elog "Three Apache modules have been installed: mod_proxy_uwsgi, mod_uwsgi and mod_Ruwsgi."
364 elog "You can enable them with -D PROXY_UWSGI, -DUWSGI or -DRUWSGI in /etc/conf.d/apache2."
365 elog "mod_uwsgi and mod_Ruwsgi have the same configuration interface and define the same symbols."
366 elog "Therefore you can enable only one of them at a time."
367 elog "mod_uwsgi is commercially supported by Unbit and stable but a bit hacky."
368 elog "mod_Ruwsgi is newer and more Apache-API friendly but not commercially supported."
369 elog "mod_proxy_uwsgi is the newest and not considered ready for production yet."
370 fi
371
372 elog "Append the following options to the uwsgi call to load the respective language plugin:"
373 use cgi && elog " '--plugins cgi' for cgi"
374 use lua && elog " '--plugins lua' for lua"
375 use perl && elog " '--plugins psgi' for perl"
376
377 if use php ; then
378 for s in $(php_get_slots); do
379 elog " '--plugins ${s/.}' for ${s}"
380 done
381 fi
382
383 python_pkg_postinst() {
384 elog " '--plugins ${EPYTHON}' for ${EPYTHON}"
385 if use python_gevent ; then
386 if [[ ${EPYTHON} == python2* ]] ; then
387 elog " '--plugins ${EPYTHON},gevent-${EPYTHON}' for gevent support in ${EPYTHON}"
388 else
389 elog " (gevent is currently not support in ${EPYTHON})"
390 fi
391 fi
392 }
393
394 use python && python_foreach_impl python_pkg_postinst
395
396 if use ruby ; then
397 for ruby in $USE_RUBY; do
398 use ruby_targets_${ruby} && elog " '--plugins rack_${ruby/.}' for ${ruby}"
399 if [[ "${ruby}" == *ruby19 ]] ; then
400 elog " '--plugins fibre' for ruby-1.9 fibres"
401 fi
402 done
403 fi
404 }