From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- www-servers/uwsgi/Manifest | 11 + www-servers/uwsgi/files/2.0.14-php-plugin.patch | 22 ++ www-servers/uwsgi/files/42_mod_uwsgi-r2.conf | 9 + www-servers/uwsgi/files/gentoo.buildconf | 30 ++ www-servers/uwsgi/files/uwsgi.confd-r4 | 68 ++++ www-servers/uwsgi/files/uwsgi.initd-r7 | 145 +++++++++ www-servers/uwsgi/metadata.xml | 23 ++ www-servers/uwsgi/uwsgi-2.0.15-r1.ebuild | 413 ++++++++++++++++++++++++ www-servers/uwsgi/uwsgi-2.0.15.ebuild | 413 ++++++++++++++++++++++++ 9 files changed, 1134 insertions(+) create mode 100644 www-servers/uwsgi/Manifest create mode 100644 www-servers/uwsgi/files/2.0.14-php-plugin.patch create mode 100644 www-servers/uwsgi/files/42_mod_uwsgi-r2.conf create mode 100644 www-servers/uwsgi/files/gentoo.buildconf create mode 100644 www-servers/uwsgi/files/uwsgi.confd-r4 create mode 100644 www-servers/uwsgi/files/uwsgi.initd-r7 create mode 100644 www-servers/uwsgi/metadata.xml create mode 100644 www-servers/uwsgi/uwsgi-2.0.15-r1.ebuild create mode 100644 www-servers/uwsgi/uwsgi-2.0.15.ebuild (limited to 'www-servers/uwsgi') diff --git a/www-servers/uwsgi/Manifest b/www-servers/uwsgi/Manifest new file mode 100644 index 000000000000..08558527573c --- /dev/null +++ b/www-servers/uwsgi/Manifest @@ -0,0 +1,11 @@ +AUX 2.0.14-php-plugin.patch 856 SHA256 612997e70252efaefdfb78a8bd14414a6e56e574828e56c313e4bde242d720b6 SHA512 ccddf94e145dbea4d0d69e45202b062de01b7b8d6b154d496eca6a03450adfe1455b45217dc18612f5a21296e276fbac061de30973aff656b93c6488e0d3359b WHIRLPOOL 4c23a5112ec80085edabff4b01acbcd4fe8cd10ee0af49c26cb1641e098f850a3ea92eafc34894e4fdfb0fb35369dafae9ce6e440ebd05621c824a6a6cc42d65 +AUX 42_mod_uwsgi-r2.conf 254 SHA256 8b0775302d112a3f1959776e89a5cc13a325d80719281db8d3e896a95f5fb691 SHA512 de827913644ff8763d7e9f6907e5dd500bc7d25f861c9e8dd07d6f070e96b9eb39bdacc3a8e7ca0925f2a8ee1cd74bfe22da467bab39e319b7cabee36d31dc70 WHIRLPOOL 2c9238712c10e0e1b0b7fa1c7e802a5ce973d71fc5e2f8eb03831c9b49dce0e98a6ee3acf9d17fcc32de1914f4d9955a9c0a218cf24658d4df5d0449bb211744 +AUX gentoo.buildconf 490 SHA256 a82aeada480a7571181c6767ba2df40f14117e4a3070920961510eee05035a19 SHA512 d5bdc136374aed58ce206ea72cc45c72750f60117eef98960356b5cd64e2152c454af6b5aebb28f03ad46b42ea95a16fbf1e4a6f976ae78744550803ac775fe2 WHIRLPOOL f5f13dc512e470bc32a1d487176cbc82dddb280b7f0b284580f5b0106a9f03aae123b9ac2298f4e61068212cc0afde7b970ff9a4c9f18e11bffb58a4c8d993e4 +AUX uwsgi.confd-r4 1849 SHA256 3c24868fe39a5d7676a5338d57deb82a0138be83f524f6f2a5ff14b104c3fc7e SHA512 041d1bd694fad6f7c5e28944aab6d7ba53b3c7fc990ce6b7c2d97b9f3d6650c46dda8069e545c252a7400e1d825c8e46d7393a289757b1bd665e64241ca3789a WHIRLPOOL e77250ccad44725a8fd8247f3b0166efb01859e6227e8172e76384e6f09653d5d0c7937dc1bc06103e13f312c195d0115b856cbdbd3e3ede8907db129ea9b348 +AUX uwsgi.initd-r7 3746 SHA256 848dc9811bb7954fe72a55f2a07984c9032458733b80f9d08987c3fe2c69195b SHA512 81ed974fb2957e05c890cab29f5b5a75845e6b7de899d2695fb2fa5f49b4545daa437c81c8dc5c735b24a45655cf6320c9256bc8faa7e32ffd7a2d981922def5 WHIRLPOOL 51545fd966deaa03ccee1cbe245be6d6d4313418ed16bc4274df285cbf5e2a31ede25a876aa7f2674e7478bf5927cc88f5ec78e05fed22236fde10598f7a3d4c +DIST uwsgi-2.0.15.tar.gz 794926 SHA256 251f0670628ce9b9f4c2b4288a7ea921e2ddb3d5e886b6aa2358273573e6fdcf SHA512 1a2a82cf99d3e6dfe62fa18fd6f04afd1dc727d61287a1c9f47f1448e76a4858dfd59286118c94672c84ff22bcd8444c0c1568ae46993fdbdb9414ad60474bf4 WHIRLPOOL 1708d010af0bb77082e630d945c2d9d31f887125276a92c3a78d11011242374eeb4e3d361a8b4bc593ebae933cc00510b3f64e42a277508addaf6568285b7eae +EBUILD uwsgi-2.0.15-r1.ebuild 12677 SHA256 219692634d26ee68a9b2918f70cdfc2f3cc5b49624f3a7631ffa4c4b95296cb1 SHA512 602131642d4cc96ffb4ea827a5c837e785911e7574546a6bef677ef532aa3e21c6ef8a95aa78ebfee1bde5e3ffba811b70d3dfe7cb4bb07df34bc13e00198548 WHIRLPOOL 554fb676cca74b0d840082d3b9a90345abe7eac4437656d982bd26bc5cdf3e431e04f13e9456ec77e5317248586826ad4f382d40eba4ab657a5f1234fea94e84 +EBUILD uwsgi-2.0.15.ebuild 12659 SHA256 6b3fcc56eaa3c62d2c35ffd7d7ab36a8d0f2fe94caf69abdf479e658f5fcee0e SHA512 d870f86ca5225ae9807fbf679f77a1d44b01bbced6700a743b5bc734e7092752209066c1839a03514a60a8c7277626fa8e047fbfc949dc148c730582b40ef432 WHIRLPOOL 3dd377f4c915e7e7bbe37b4bf18717eae7370b9db444e446052db3363df825411402b2f92290d4772b9eedcfacf82fa34a491fa5a035d1102eceab58350d6b23 +MISC ChangeLog 6919 SHA256 752d788a058a032bb5933ee81941659ebfd9b882c1084ad115e14a9fade8fbd3 SHA512 6b1f18b32d49aa49dfc4191b7b086a97fcfcf6ffa6be706794ae65588c0bf0af6c69924da16ff66d0d59efe710f2d4d2309a48fe474c61168a213c026c5b68f9 WHIRLPOOL 435392e096a451fb592849ca1950e25d4ba1eb3676fac856a9b8a9e1663b23d5af432573c6874c1f969a1518e9f24cb378c26708d225c9056d18b2055d95a931 +MISC ChangeLog-2015 14548 SHA256 8e432d44c22ae91323898e1a05e432ae642dab995cd5f44b8b04216481efec88 SHA512 cb5fa0d7756ffe866ca9d51a9ab674d2be986793647bb134a6e0b0df9cba294f8d405ae5f632c35e911e0481942ddd4828d038f6695bef469bbd49d998e6092c WHIRLPOOL e80948cfc945797521460b51096528581a5ed1622f4ae450bf1d43a824016c792c042b5b925b5426794bc8519e3e2c4bc4e1b8a9beac1d7c8f751a1ec817118f +MISC metadata.xml 1597 SHA256 2ec7ee7c13de5045c331134e620428cb772660cfdeeaba969b36a8ef4391d387 SHA512 6f31168a12d1c3a95cb140624584214fcefda352b4c4904425d633a6d94a74d30186e7fa25c19b6f97cc0ca6ab0a8253cdbcedd11df3be2a32400a6292f2877b WHIRLPOOL f2b39c0721b4fad17ddde69d2b90ce0a74af70bb6a736df853e6e54d2dae75b552b565a00c698ec780ebbb0128274e3bb9c6cfd756f126705335ed569fe16abb diff --git a/www-servers/uwsgi/files/2.0.14-php-plugin.patch b/www-servers/uwsgi/files/2.0.14-php-plugin.patch new file mode 100644 index 000000000000..f60a6553cfd1 --- /dev/null +++ b/www-servers/uwsgi/files/2.0.14-php-plugin.patch @@ -0,0 +1,22 @@ +From 6b332e6f7e6fc3c267a91ce5b5591684575ea271 Mon Sep 17 00:00:00 2001 +From: Damjan Georgievski +Date: Thu, 13 Oct 2016 00:55:35 +0200 +Subject: [PATCH] fix issue #1380 - compiling with llvm/freebsd + +--- + plugins/php/php_plugin.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/plugins/php/php_plugin.c b/plugins/php/php_plugin.c +index 536ec1a..ef30180 100644 +--- a/plugins/php/php_plugin.c ++++ b/plugins/php/php_plugin.c +@@ -232,7 +232,7 @@ static void sapi_uwsgi_register_variables(zval *track_vars_array TSRMLS_DC) + size_t name_len = equal-usl->value; + char *name = estrndup(usl->value, name_len); + char *strval = equal+1; +- zend_register_string_constant(name, name_len, strval, CONST_CS, 0); ++ zend_register_string_constant(name, name_len, strval, CONST_CS, 0 TSRMLS_CC); + } + usl = usl->next; + } diff --git a/www-servers/uwsgi/files/42_mod_uwsgi-r2.conf b/www-servers/uwsgi/files/42_mod_uwsgi-r2.conf new file mode 100644 index 000000000000..85ede87b037b --- /dev/null +++ b/www-servers/uwsgi/files/42_mod_uwsgi-r2.conf @@ -0,0 +1,9 @@ + + LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so + + + LoadModule uwsgi_module modules/mod_Ruwsgi.so + + + LoadModule uwsgi_module modules/mod_uwsgi.so + diff --git a/www-servers/uwsgi/files/gentoo.buildconf b/www-servers/uwsgi/files/gentoo.buildconf new file mode 100644 index 000000000000..e0c60bc6a5b8 --- /dev/null +++ b/www-servers/uwsgi/files/gentoo.buildconf @@ -0,0 +1,30 @@ +[uwsgi] +xml = VAR_XML +yaml = VAR_YAML +json = VAR_JSON +ssl = VAR_SSL +pcre = VAR_PCRE +zeromq = VAR_ZMQ +routing = VAR_ROUTING +debug = VAR_DEBUG +unbit = false +malloc_implementation = VAR_MALLOC +extras = +plugins = VAR_PLUGINS +bin_name = uwsgi +append_version = +plugin_dir = VAR_PLUGIN_DIR +plugin_build_dir = VAR_BUILD_DIR +embedded_plugins = VAR_EMBEDDED +as_shared_library = false + +locking = auto +event = auto +timer = auto +filemonitor = auto + +blacklist = +whitelist = + +embed_files = +embed_config = diff --git a/www-servers/uwsgi/files/uwsgi.confd-r4 b/www-servers/uwsgi/files/uwsgi.confd-r4 new file mode 100644 index 000000000000..5469c7b875f9 --- /dev/null +++ b/www-servers/uwsgi/files/uwsgi.confd-r4 @@ -0,0 +1,68 @@ +# Distributed under the terms of the GNU General Public License v2 + +# YOU SHOULD ONLY MODIFY THIS FILE IF YOU USE THE UWSGI EMPEROR MODE! +# IF YOU WANT TO RUN A SINGLE APP INSTANCE, CREATE A COPY AND MODIFY THAT INSTEAD! + +# Path (or name) of UNIX/TCP socket to bind to +# Example : UWSGI_SOCKET=127.0.0.1:1234 +UWSGI_SOCKET= + +# Enable threads? (1 = yes, 0 = no). The default is 0 +# +UWSGI_THREADS=0 + +# The path to your uWSGI application. +# +UWSGI_PROGRAM= + +# The path to your uWSGI xml config file. +# +UWSGI_XML_CONFIG= + +# The number of child processes to spawn. The default is 1. +# +UWSGI_PROCESSES=1 + +# The log file path. If empty, log only errors +# +UWSGI_LOG_FILE= + +# If you want to run your application inside a chroot then specify the +# directory here. Leave this blank otherwise. +# +UWSGI_CHROOT= + +# If you want to run your application from a specific directiory specify +# it here. Leave this blank otherwise. +# +UWSGI_DIR= + +# PIDPATH folder mode (/run/uwsgi_${PROGNAME}) +UWSGI_PIDPATH_MODE=0750 + +# The user to run your application as. If you do not specify these, +# the application will be run as user root. +# +UWSGI_USER= + +# The group to run your application as. If you do not specify these, +# the application will be run as group root. +# +UWSGI_GROUP= + +# Run the uwsgi emperor which loads vassals dynamically from this PATH +# see http://projects.unbit.it/uwsgi/wiki/Emperor +# The advised Gentoo folder is /etc/uwsgi.d/ +UWSGI_EMPEROR_PATH= + +# Emperor PIDPATH folder mode (/run/uwsgi) +UWSGI_EMPEROR_PIDPATH_MODE=0770 + +# The group the emperor should run as. This is different from the UWSGI_GROUP +# as you could want your apps share some sockets with other processes such as +# www servers while preserving your emperor logs from being accessible by them. +UWSGI_EMPEROR_GROUP= + +# Additional options you might want to pass to uWSGI +# +UWSGI_EXTRA_OPTIONS= diff --git a/www-servers/uwsgi/files/uwsgi.initd-r7 b/www-servers/uwsgi/files/uwsgi.initd-r7 new file mode 100644 index 000000000000..64dfc7a736ff --- /dev/null +++ b/www-servers/uwsgi/files/uwsgi.initd-r7 @@ -0,0 +1,145 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +PROGNAME=${SVCNAME#*.} + +UWSGI_EXEC=/usr/bin/uwsgi +if [ "${SVCNAME}" = "uwsgi" ]; then + PIDPATH=/run/uwsgi +else + PIDPATH="/run/uwsgi_${PROGNAME}" +fi +PIDFILE="${PIDPATH}/${PROGNAME}.pid" + +extra_started_commands="${opts} reload stats" + +depend() { + need net +} + +start_emperor() { + local OPTIONS + OPTIONS="--daemonize" + + if [ -n "${UWSGI_LOG_FILE}" ]; then + OPTIONS="${OPTIONS} ${UWSGI_LOG_FILE}" + else + OPTIONS="${OPTIONS} /dev/null --disable-logging" + fi + + [ -z "${UWSGI_DIR}" ] && UWSGI_DIR="/" + [ -z "${UWSGI_USER}" ] && UWSGI_USER="root" + [ -z "${UWSGI_GROUP}" ] && UWSGI_GROUP="root" + [ -z "${UWSGI_EMPEROR_PIDPATH_MODE}" ] && UWSGI_EMPEROR_PIDPATH_MODE=0770 + + if [ -n "${UWSGI_EXTRA_OPTIONS}" ]; then + OPTIONS="${OPTIONS} ${UWSGI_EXTRA_OPTIONS}" + fi + + ebegin "Starting uWSGI emperor" + checkpath -d -m ${UWSGI_EMPEROR_PIDPATH_MODE} -o "${UWSGI_USER}":"${UWSGI_EMPEROR_GROUP:-${UWSGI_GROUP}}" "${PIDPATH}" + + cd "${UWSGI_DIR}" && \ + start-stop-daemon --start --user "${UWSGI_USER}" --exec "${UWSGI_EXEC}" \ + --group ${UWSGI_EMPEROR_GROUP:-${UWSGI_GROUP}} \ + -- --emperor "${UWSGI_EMPEROR_PATH}" ${OPTIONS} --pidfile "${PIDFILE}" + return $? +} + +start_app() { + local OPTIONS + OPTIONS="--master --daemonize" + + if [ -n "${UWSGI_LOG_FILE}" ]; then + OPTIONS="${OPTIONS} ${UWSGI_LOG_FILE}" + else + OPTIONS="${OPTIONS} /dev/null --disable-logging" + fi + + [ -z "${UWSGI_DIR}" ] && UWSGI_DIR="/" + [ -z "${UWSGI_USER}" ] && UWSGI_USER="root" + [ -z "${UWSGI_GROUP}" ] && UWSGI_GROUP="root" + [ -z "${UWSGI_PIDPATH_MODE}" ] && UWSGI_PIDPATH_MODE=0750 + + if [ -n "${UWSGI_EXTRA_OPTIONS}" ]; then + OPTIONS="${OPTIONS} ${UWSGI_EXTRA_OPTIONS}" + fi + + if [ "${UWSGI_THREADS}" = "1" ]; then + OPTIONS="${OPTIONS} --enable-threads" + fi + + if [ -n "${UWSGI_SOCKET}" ]; then + OPTIONS="${OPTIONS} --socket ${UWSGI_SOCKET}" + fi + + if [ -n "${UWSGI_PROCESSES}" ]; then + OPTIONS="${OPTIONS} --processes ${UWSGI_PROCESSES}" + fi + + if [ -n "${UWSGI_CHROOT}" ]; then + OPTIONS="${OPTIONS} --chroot ${UWSGI_CHROOT}" + fi + + if [ -n "${UWSGI_PROGRAM}" ]; then + OPTIONS="${OPTIONS} --fileserve-mode ${UWSGI_PROGRAM}" + fi + + if [ -n "${UWSGI_XML_CONFIG}" ]; then + OPTIONS="${OPTIONS} --xmlconfig ${UWSGI_XML_CONFIG}" + fi + + ebegin "Starting uWSGI application ${PROGNAME}" + checkpath -d -m ${UWSGI_PIDPATH_MODE} -o "${UWSGI_USER}":"${UWSGI_GROUP}" "${PIDPATH}" + + cd "${UWSGI_DIR}" && \ + start-stop-daemon --start --user "${UWSGI_USER}" --group "${UWSGI_GROUP}" \ + --exec "${UWSGI_EXEC}" -- ${OPTIONS} --pidfile "${PIDFILE}" + return $? +} + +start() { + if [ -n "${UWSGI_EMPEROR_PATH}" ]; then + start_emperor + eend $? + else + if [ "${SVCNAME}" = "uwsgi" ]; then + eerror "You are not supposed to run this script directly unless you" + eerror "want to run in Emperor mode. In that case please set the UWSGI_EMPEROR_PATH." + eerror "Otherwise create a symlink for the uwsgi application you want to run as well as" + eerror "a copy of the configuration file and modify it appropriately like so..." + eerror + eerror " ln -s uwsgi /etc/init.d/uwsgi.trac" + eerror " cp /etc/conf.d/uwsgi /etc/conf.d/uwsgi.trac" + eerror " nano /etc/conf.d/uwsgi.trac" + eerror + return 1 + else + start_app + eend $? + fi + fi +} + +stop() { + if [ -n "${UWSGI_EMPEROR_PATH}" ]; then + ebegin "Stopping uWSGI emperor" + else + ebegin "Stopping uWSGI application ${PROGNAME}" + fi + start-stop-daemon --stop --signal QUIT --pidfile "${PIDFILE}" + eend $? +} + +reload() { + ebegin "Reloading uWSGI" + start-stop-daemon --signal HUP --pidfile "${PIDFILE}" + eend $? +} + +stats() { + ebegin "Logging uWSGI statistics" + start-stop-daemon --signal USR1 --pidfile "${PIDFILE}" + eend $? +} diff --git a/www-servers/uwsgi/metadata.xml b/www-servers/uwsgi/metadata.xml new file mode 100644 index 000000000000..498f2a5fb33d --- /dev/null +++ b/www-servers/uwsgi/metadata.xml @@ -0,0 +1,23 @@ + + + + + ultrabug@gentoo.org + + + Embed plugins instead of building them as real plugins. When disabling this USE flag make sure you specify all used plugins in your uWSGI configuration. Note: Language plugins will always be built as real plugins. + Build the gccgo plugin to run Go applications. + Use dev-libs/jemalloc instead of libc's malloc + Support json as a configuration file format. + Build the pypy plugin to run your code using virtual/pypy. + Use the EXPERIMENTAL asyncio (tulip) for python3.4 async request dispatching and as LoopEngine (see http://uwsgi-docs.readthedocs.org/en/latest/asyncio.html). + Use dev-python/gevent for async request dispatching and as LoopEngine (see http://projects.unbit.it/uwsgi/wiki/Gevent). + Enable routing support + Support yaml as a configuration file format. + Use dev-libs/yajl instead of dev-libs/jansson for parsing JSON configuration files (if USe=json is set) + Enable logging and deployment via ZeroMQ. + + + unbit/uwsgi + + diff --git a/www-servers/uwsgi/uwsgi-2.0.15-r1.ebuild b/www-servers/uwsgi/uwsgi-2.0.15-r1.ebuild new file mode 100644 index 000000000000..5043eca69ae1 --- /dev/null +++ b/www-servers/uwsgi/uwsgi-2.0.15-r1.ebuild @@ -0,0 +1,413 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy ) +PYTHON_REQ_USE="threads(+)" + +RUBY_OPTIONAL="yes" +USE_RUBY="ruby22 ruby23 ruby24" + +PHP_EXT_INI="no" +PHP_EXT_NAME="dummy" +PHP_EXT_OPTIONAL_USE="php" +USE_PHP="php5-6 php7-0" # deps must be registered separately below + +MY_P="${P/_/-}" + +inherit apache-module eutils flag-o-matic multilib pax-utils php-ext-source-r2 python-r1 ruby-ng versionator + +DESCRIPTION="uWSGI server for Python web applications" +HOMEPAGE="http://projects.unbit.it/uwsgi/" +SRC_URI="https://github.com/unbit/uwsgi/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~amd64-linux" + +UWSGI_PLUGINS_STD=( ping cache carbon nagios rpc rrdtool + http ugreen signal syslog rsyslog + router_{uwsgi,redirect,basicauth,rewrite,http,cache,static,memcached,redis,hash,expires,metrics} + {core,fast,raw,ssl}router + redislog mongodblog log{file,socket} + spooler cheaper_busyness symcall + transformation_{chunked,gzip,offload,tofile} + zergpool ) +UWSGI_PLUGINS_OPT=( alarm_{curl,xmpp} clock_{monotonic,realtime} curl_cron + dumbloop echo emperor_{amqp,pg,zeromq} forkptyrouter + geoip graylog2 legion_cache_fetch ldap log{crypto,pipe} notfound pam + rados router_{access,radius,spnego,xmldir} + sqlite ssi stats_pusher_statsd + systemd_logger transformation_toupper tuntap webdav xattr xslt zabbix ) + +LANG_SUPPORT_SIMPLE=( cgi mono perl ) # plugins which can be built in the main build process +LANG_SUPPORT_EXTENDED=( go lua php pypy python python_asyncio python_gevent ruby ) + +# plugins to be ignored (for now): +# cheaper_backlog2: example plugin +# coroae: TODO +# cplusplus: partially example code, needs explicit class +# dummy: no idea +# example: example plugin +# exception_log: example plugin +# *java*: TODO +# v8: TODO +# matheval: TODO +IUSE="apache2 +caps debug +embedded expat jemalloc json libressl +pcre +routing selinux +ssl +xml yajl yaml zeromq" + +for plugin in ${UWSGI_PLUGINS_STD[@]}; do IUSE="${IUSE} +uwsgi_plugins_${plugin}"; done +for plugin in ${UWSGI_PLUGINS_OPT[@]}; do IUSE="${IUSE} uwsgi_plugins_${plugin}"; done +IUSE="${IUSE} ${LANG_SUPPORT_SIMPLE[@]} ${LANG_SUPPORT_EXTENDED[@]}" + +REQUIRED_USE="|| ( ${LANG_SUPPORT_SIMPLE[@]} ${LANG_SUPPORT_EXTENDED[@]} ) + uwsgi_plugins_logcrypto? ( ssl ) + uwsgi_plugins_sslrouter? ( ssl ) + routing? ( pcre ) + uwsgi_plugins_emperor_zeromq? ( zeromq ) + uwsgi_plugins_forkptyrouter? ( uwsgi_plugins_corerouter ) + uwsgi_plugins_router_xmldir? ( xml !expat ) + pypy? ( python_targets_python2_7 ) + python? ( ${PYTHON_REQUIRED_USE} ) + python_asyncio? ( python_targets_python3_4 python_gevent ) + python_gevent? ( python ) + expat? ( xml )" + +# util-linux is required for libuuid when requesting zeromq support +# Order: +# 1. Unconditional +# 2. General features +# 3. Plugins +# 4. Language/app support +CDEPEND="sys-libs/zlib + caps? ( sys-libs/libcap ) + json? ( !yajl? ( dev-libs/jansson ) + yajl? ( dev-libs/yajl ) ) + pcre? ( dev-libs/libpcre:3 ) + ssl? ( + !libressl? ( dev-libs/openssl:0 ) + libressl? ( dev-libs/libressl ) + ) + xml? ( !expat? ( dev-libs/libxml2 ) + expat? ( dev-libs/expat ) ) + yaml? ( dev-libs/libyaml ) + zeromq? ( net-libs/zeromq sys-apps/util-linux ) + uwsgi_plugins_alarm_curl? ( net-misc/curl ) + uwsgi_plugins_alarm_xmpp? ( net-libs/gloox ) + uwsgi_plugins_curl_cron? ( net-misc/curl ) + uwsgi_plugins_emperor_pg? ( dev-db/postgresql:= ) + uwsgi_plugins_geoip? ( dev-libs/geoip ) + uwsgi_plugins_ldap? ( net-nds/openldap ) + uwsgi_plugins_pam? ( virtual/pam ) + uwsgi_plugins_sqlite? ( dev-db/sqlite:3 ) + uwsgi_plugins_rados? ( sys-cluster/ceph ) + uwsgi_plugins_router_access? ( sys-apps/tcp-wrappers ) + uwsgi_plugins_router_spnego? ( virtual/krb5 ) + uwsgi_plugins_systemd_logger? ( sys-apps/systemd ) + uwsgi_plugins_webdav? ( dev-libs/libxml2 ) + uwsgi_plugins_xslt? ( dev-libs/libxslt ) + go? ( dev-lang/go:=[gccgo] ) + lua? ( dev-lang/lua:= ) + mono? ( =dev-lang/mono-4* ) + perl? ( dev-lang/perl:= ) + php? ( + php_targets_php5-6? ( dev-lang/php:5.6[embed] ) + php_targets_php7-0? ( dev-lang/php:7.0[embed] ) + ) + pypy? ( virtual/pypy ) + python? ( ${PYTHON_DEPS} ) + python_gevent? ( >=dev-python/gevent-1.2.1[${PYTHON_USEDEP}] ) + ruby? ( $(ruby_implementations_depend) )" +DEPEND="${CDEPEND} + virtual/pkgconfig" +RDEPEND="${CDEPEND} + selinux? ( sec-policy/selinux-uwsgi ) + uwsgi_plugins_rrdtool? ( net-analyzer/rrdtool )" + +want_apache2 + +S="${WORKDIR}/${MY_P}" +APXS2_S="${S}/apache2" +APACHE2_MOD_CONF="42_mod_uwsgi-r2 42_mod_uwsgi" + +# FIXME: is this patch still useful? +PATCHES=( + "${FILESDIR}/2.0.14-php-plugin.patch" +) + +src_unpack() { + default +} + +pkg_setup() { + python_setup + use ruby && ruby-ng_pkg_setup + depend.apache_pkg_setup +} + +src_prepare() { + default + + sed -i \ + -e "s|'-O2', ||" \ + -e "s|'-Werror', ||" \ + -e "s|uc.get('plugin_dir')|uc.get('plugin_build_dir')|" \ + uwsgiconfig.py || die "sed failed" + + sed -i \ + -e "s|/lib|/$(get_libdir)|" \ + plugins/php/uwsgiplugin.py || die "sed failed" +} + +src_configure() { + local embedded_plugins=() + local plugins=() + local malloc_impl="libc" + local json="false" + local xml="false" + + for p in ${UWSGI_PLUGINS_STD[@]} ${UWSGI_PLUGINS_OPT[@]} ; do + use uwsgi_plugins_${p} && embedded_plugins+=("${p}") + done + for p in ${LANG_SUPPORT_SIMPLE[@]} ; do + use ${p} && plugins+=("${p}") + done + + # do not embed any plugins + if ! use embedded; then + plugins=( ${plugins[@]} ${embedded_plugins[@]} ) + embedded_plugins=() + fi + + # flatten the arrays + plugins=${plugins[@]} + embedded_plugins=${embedded_plugins[@]} + + # rename some of the use flags, language plugins are always real plugins + plugins="${plugins/perl/psgi}" + plugins="${plugins/sqlite/sqlite3}" + embedded_plugins="${embedded_plugins/sqlite/sqlite3}" + + # override defaults as requested by the user + if use xml; then + use expat && xml="expat" || xml="libxml2" + fi + if use json; then + use yajl && json="yajl" || json="jansson" + fi + use jemalloc && malloc_impl="jemalloc" + + # prepare the buildconf for gentoo + cp "${FILESDIR}"/gentoo.buildconf buildconf/gentoo.ini || die + sed -i \ + -e "s|VAR_XML|${xml}|" \ + -e "s|VAR_YAML|$(usex yaml libyaml true)|" \ + -e "s|VAR_JSON|${json}|" \ + -e "s|VAR_SSL|$(usex ssl true false)|" \ + -e "s|VAR_PCRE|$(usex pcre true false)|" \ + -e "s|VAR_ZMQ|$(usex zeromq true false)|" \ + -e "s|VAR_ROUTING|$(usex routing true false)|" \ + -e "s|VAR_DEBUG|$(usex debug true false)|" \ + -e "s|VAR_MALLOC|${malloc_impl}|" \ + -e "s|VAR_PLUGINS|${plugins// /, }|" \ + -e "s|VAR_PLUGIN_DIR|${EPREFIX}/usr/$(get_libdir)/uwsgi|" \ + -e "s|VAR_BUILD_DIR|${T}/plugins|" \ + -e "s|VAR_EMBEDDED|${embedded_plugins// /, }|" \ + buildconf/gentoo.ini || die "sed failed" + + if ! use caps; then + sed -i -e 's|sys/capability.h|DISABLED|' uwsgiconfig.py || die "sed failed" + fi + + if ! use zeromq; then + sed -i -e 's|uuid/uuid.h|DISABLED|' uwsgiconfig.py || die "sed failed" + fi + + if use uwsgi_plugins_emperor_pg ; then + PGPV="$(best_version dev-db/postgresql)" + PGSLOT="$(get_version_component_range 1-2 ${PGPV##dev-db/postgresql-})" + sed -i \ + -e "s|pg_config|pg_config${PGSLOT/.}|" \ + plugins/emperor_pg/uwsgiplugin.py || die "sed failed" + fi +} + +each_ruby_compile() { + cd "${WORKDIR}/${MY_P}" || die "sed failed" + + UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/rack gentoo rack_${RUBY##*/} || die "building plugin for ${RUBY} failed" + UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/fiber gentoo fiber_${RUBY##*/}|| die "building fiber plugin for ${RUBY} failed" + UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/rbthreads gentoo rbthreads_${RUBY##*/}|| die "building rbthreads plugin for ${RUBY} failed" +} + +python_compile_plugins() { + local EPYV + local PYV + EPYV=${EPYTHON/.} + PYV=${EPYV/python} + + if [[ ${EPYTHON} == pypy* ]]; then + einfo "skipping because pypy is not meant to build plugins on its own" + return + fi + + ${PYTHON} uwsgiconfig.py --plugin plugins/python gentoo ${EPYV} || die "building plugin for ${EPYTHON} failed" + + if use python_asyncio ; then + if [[ "${PYV}" == "34" || "${PYV}" == "35" ]] ; then + ${PYTHON} uwsgiconfig.py --plugin plugins/asyncio gentoo asyncio${PYV} || die "building plugin for asyncio-support in ${EPYTHON} failed" + fi + fi + + if use python_gevent ; then + ${PYTHON} uwsgiconfig.py --plugin plugins/gevent gentoo gevent${PYV} || die "building plugin for gevent-support in ${EPYTHON} failed" + fi + + if use pypy ; then + if [[ "${PYV}" == "27" ]] ; then + # TODO: do some proper patching ? The wiki didn't help... I gave up for now. + # QA: RWX --- --- usr/lib64/uwsgi/pypy_plugin.so + append-ldflags -Wl,-z,noexecstack + ${PYTHON} uwsgiconfig.py --plugin plugins/pypy gentoo pypy || die "building plugin for pypy-support in ${EPYTHON} failed" + fi + fi +} + +python_install_symlinks() { + dosym uwsgi /usr/bin/uwsgi_${EPYTHON/.} +} + +src_compile() { + mkdir -p "${T}/plugins" || die + + python uwsgiconfig.py --build gentoo || die "building uwsgi failed" + + if use go ; then + python uwsgiconfig.py --plugin plugins/gccgo gentoo || die "building plugin for go failed" + fi + + if use lua ; then + # setting the name for the pkg-config file to lua, since we don't have + # slotted lua + UWSGICONFIG_LUAPC="lua" python uwsgiconfig.py --plugin plugins/lua gentoo || die "building plugin for lua failed" + fi + + if use php ; then + for s in $(php_get_slots); do + UWSGICONFIG_PHPDIR="/usr/$(get_libdir)/${s}" python uwsgiconfig.py --plugin plugins/php gentoo ${s/.} || die "building plugin for ${s} failed" + done + fi + + if use python ; then + python_foreach_impl python_compile_plugins + fi + + if use ruby ; then + ruby-ng_src_compile + fi + + if use apache2 ; then + for m in proxy_uwsgi Ruwsgi uwsgi ; do + APXS2_ARGS="-c mod_${m}.c" + apache-module_src_compile + done + fi +} + +src_install() { + dobin uwsgi + pax-mark m "${D}"/usr/bin/uwsgi + + insinto /usr/$(get_libdir)/uwsgi + doins "${T}/plugins"/*.so + + use cgi && dosym uwsgi /usr/bin/uwsgi_cgi + use go && dosym uwsgi /usr/bin/uwsgi_go + use lua && dosym uwsgi /usr/bin/uwsgi_lua + use mono && dosym uwsgi /usr/bin/uwsgi_mono + use perl && dosym uwsgi /usr/bin/uwsgi_psgi + + if use php ; then + for s in $(php_get_slots); do + dosym uwsgi /usr/bin/uwsgi_${s/.} + done + fi + + if use python ; then + python_foreach_impl python_install_symlinks + python_foreach_impl python_domodule uwsgidecorators.py + fi + + if use apache2; then + for m in proxy_uwsgi Ruwsgi uwsgi ; do + APACHE2_MOD_FILE="${APXS2_S}/.libs/mod_${m}.so" + apache-module_src_install + done + fi + + newinitd "${FILESDIR}"/uwsgi.initd-r7 uwsgi + newconfd "${FILESDIR}"/uwsgi.confd-r4 uwsgi + keepdir /etc/"${PN}".d + use uwsgi_plugins_spooler && keepdir /var/spool/"${PN}" +} + +pkg_postinst() { + if use apache2 ; then + elog "Three Apache modules have been installed: mod_proxy_uwsgi, mod_uwsgi and mod_Ruwsgi." + elog "You can enable them with -D PROXY_UWSGI, -DUWSGI or -DRUWSGI in /etc/conf.d/apache2." + elog "mod_uwsgi and mod_Ruwsgi have the same configuration interface and define the same symbols." + elog "Therefore you can enable only one of them at a time." + elog "mod_uwsgi is commercially supported by Unbit and stable but a bit hacky." + elog "mod_Ruwsgi is newer and more Apache-API friendly but not commercially supported." + elog "mod_proxy_uwsgi is a proxy module, considered stable and is now the recommended module." + fi + + elog "Append the following options to the uwsgi call to load the respective language plugin:" + use cgi && elog " '--plugins cgi' for cgi" + use lua && elog " '--plugins lua' for lua" + use mono && elog " '--plugins mono' for mono" + use perl && elog " '--plugins psgi' for perl" + + if use php ; then + for s in $(php_get_slots); do + elog " '--plugins ${s/.}' for ${s}" + done + fi + + python_pkg_postinst() { + local EPYV + local PYV + EPYV=${EPYTHON/.} + PYV=${EPYV/python} + + if [[ ${EPYTHON} == pypy* ]] ; then + elog " '--plugins pypy' for pypy" + return + fi + + elog " " + elog " '--plugins ${EPYV}' for ${EPYTHON}" + if use python_asyncio ; then + if [[ ${EPYV} == python34 ]] ; then + elog " '--plugins ${EPYV},asyncio${PYV}' for asyncio support in ${EPYTHON}" + else + elog " (asyncio is only supported in python3.4)" + fi + fi + if use python_gevent ; then + elog " '--plugins ${EPYV},gevent${PYV}' for gevent support in ${EPYTHON}" + fi + } + + use python && python_foreach_impl python_pkg_postinst + + if use ruby ; then + for ruby in $USE_RUBY; do + if use ruby_targets_${ruby} ; then + elog " '--plugins rack_${ruby/.}' for ${ruby}" + elog " '--plugins fiber_${ruby/.}' for ${ruby} fibers" + elog " '--plugins rbthreads_${ruby/.}' for ${ruby} rbthreads" + fi + done + fi +} diff --git a/www-servers/uwsgi/uwsgi-2.0.15.ebuild b/www-servers/uwsgi/uwsgi-2.0.15.ebuild new file mode 100644 index 000000000000..f77a797cdf9d --- /dev/null +++ b/www-servers/uwsgi/uwsgi-2.0.15.ebuild @@ -0,0 +1,413 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +PYTHON_COMPAT=( python2_7 python3_{4,5} pypy ) +PYTHON_REQ_USE="threads(+)" + +RUBY_OPTIONAL="yes" +USE_RUBY="ruby22 ruby23" + +PHP_EXT_INI="no" +PHP_EXT_NAME="dummy" +PHP_EXT_OPTIONAL_USE="php" +USE_PHP="php5-6 php7-0" # deps must be registered separately below + +MY_P="${P/_/-}" + +inherit apache-module eutils flag-o-matic multilib pax-utils php-ext-source-r2 python-r1 ruby-ng versionator + +DESCRIPTION="uWSGI server for Python web applications" +HOMEPAGE="http://projects.unbit.it/uwsgi/" +SRC_URI="https://github.com/unbit/uwsgi/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 x86 ~amd64-linux" + +UWSGI_PLUGINS_STD=( ping cache carbon nagios rpc rrdtool + http ugreen signal syslog rsyslog + router_{uwsgi,redirect,basicauth,rewrite,http,cache,static,memcached,redis,hash,expires,metrics} + {core,fast,raw,ssl}router + redislog mongodblog log{file,socket} + spooler cheaper_busyness symcall + transformation_{chunked,gzip,offload,tofile} + zergpool ) +UWSGI_PLUGINS_OPT=( alarm_{curl,xmpp} clock_{monotonic,realtime} curl_cron + dumbloop echo emperor_{amqp,pg,zeromq} forkptyrouter + geoip graylog2 legion_cache_fetch ldap log{crypto,pipe} notfound pam + rados router_{access,radius,spnego,xmldir} + sqlite ssi stats_pusher_statsd + systemd_logger transformation_toupper tuntap webdav xattr xslt zabbix ) + +LANG_SUPPORT_SIMPLE=( cgi mono perl ) # plugins which can be built in the main build process +LANG_SUPPORT_EXTENDED=( go lua php pypy python python_asyncio python_gevent ruby ) + +# plugins to be ignored (for now): +# cheaper_backlog2: example plugin +# coroae: TODO +# cplusplus: partially example code, needs explicit class +# dummy: no idea +# example: example plugin +# exception_log: example plugin +# *java*: TODO +# v8: TODO +# matheval: TODO +IUSE="apache2 +caps debug +embedded expat jemalloc json libressl +pcre +routing selinux +ssl +xml yajl yaml zeromq" + +for plugin in ${UWSGI_PLUGINS_STD[@]}; do IUSE="${IUSE} +uwsgi_plugins_${plugin}"; done +for plugin in ${UWSGI_PLUGINS_OPT[@]}; do IUSE="${IUSE} uwsgi_plugins_${plugin}"; done +IUSE="${IUSE} ${LANG_SUPPORT_SIMPLE[@]} ${LANG_SUPPORT_EXTENDED[@]}" + +REQUIRED_USE="|| ( ${LANG_SUPPORT_SIMPLE[@]} ${LANG_SUPPORT_EXTENDED[@]} ) + uwsgi_plugins_logcrypto? ( ssl ) + uwsgi_plugins_sslrouter? ( ssl ) + routing? ( pcre ) + uwsgi_plugins_emperor_zeromq? ( zeromq ) + uwsgi_plugins_forkptyrouter? ( uwsgi_plugins_corerouter ) + uwsgi_plugins_router_xmldir? ( xml ) + pypy? ( python_targets_python2_7 ) + python? ( ${PYTHON_REQUIRED_USE} ) + python_asyncio? ( python_targets_python3_4 python_gevent ) + python_gevent? ( python ) + expat? ( xml )" + +# util-linux is required for libuuid when requesting zeromq support +# Order: +# 1. Unconditional +# 2. General features +# 3. Plugins +# 4. Language/app support +CDEPEND="sys-libs/zlib + caps? ( sys-libs/libcap ) + json? ( !yajl? ( dev-libs/jansson ) + yajl? ( dev-libs/yajl ) ) + pcre? ( dev-libs/libpcre:3 ) + ssl? ( + !libressl? ( dev-libs/openssl:0 ) + libressl? ( dev-libs/libressl ) + ) + xml? ( !expat? ( dev-libs/libxml2 ) + expat? ( dev-libs/expat ) ) + yaml? ( dev-libs/libyaml ) + zeromq? ( net-libs/zeromq sys-apps/util-linux ) + uwsgi_plugins_alarm_curl? ( net-misc/curl ) + uwsgi_plugins_alarm_xmpp? ( net-libs/gloox ) + uwsgi_plugins_curl_cron? ( net-misc/curl ) + uwsgi_plugins_emperor_pg? ( dev-db/postgresql:= ) + uwsgi_plugins_geoip? ( dev-libs/geoip ) + uwsgi_plugins_ldap? ( net-nds/openldap ) + uwsgi_plugins_pam? ( virtual/pam ) + uwsgi_plugins_sqlite? ( dev-db/sqlite:3 ) + uwsgi_plugins_rados? ( sys-cluster/ceph ) + uwsgi_plugins_router_access? ( sys-apps/tcp-wrappers ) + uwsgi_plugins_router_spnego? ( virtual/krb5 ) + uwsgi_plugins_systemd_logger? ( sys-apps/systemd ) + uwsgi_plugins_webdav? ( dev-libs/libxml2 ) + uwsgi_plugins_xslt? ( dev-libs/libxslt ) + go? ( dev-lang/go:=[gccgo] ) + lua? ( dev-lang/lua:= ) + mono? ( =dev-lang/mono-2* ) + perl? ( dev-lang/perl:= ) + php? ( + php_targets_php5-6? ( dev-lang/php:5.6[embed] ) + php_targets_php7-0? ( dev-lang/php:7.0[embed] ) + ) + pypy? ( virtual/pypy ) + python? ( ${PYTHON_DEPS} ) + python_gevent? ( >=dev-python/gevent-1.2.1[${PYTHON_USEDEP}] ) + ruby? ( $(ruby_implementations_depend) )" +DEPEND="${CDEPEND} + virtual/pkgconfig" +RDEPEND="${CDEPEND} + selinux? ( sec-policy/selinux-uwsgi ) + uwsgi_plugins_rrdtool? ( net-analyzer/rrdtool )" + +want_apache2 + +S="${WORKDIR}/${MY_P}" +APXS2_S="${S}/apache2" +APACHE2_MOD_CONF="42_mod_uwsgi-r2 42_mod_uwsgi" + +# FIXME: is this patch still useful? +PATCHES=( + "${FILESDIR}/2.0.14-php-plugin.patch" +) + +src_unpack() { + default +} + +pkg_setup() { + python_setup + use ruby && ruby-ng_pkg_setup + depend.apache_pkg_setup +} + +src_prepare() { + default + + sed -i \ + -e "s|'-O2', ||" \ + -e "s|'-Werror', ||" \ + -e "s|uc.get('plugin_dir')|uc.get('plugin_build_dir')|" \ + uwsgiconfig.py || die "sed failed" + + sed -i \ + -e "s|/lib|/$(get_libdir)|" \ + plugins/php/uwsgiplugin.py || die "sed failed" +} + +src_configure() { + local embedded_plugins=() + local plugins=() + local malloc_impl="libc" + local json="false" + local xml="false" + + for p in ${UWSGI_PLUGINS_STD[@]} ${UWSGI_PLUGINS_OPT[@]} ; do + use uwsgi_plugins_${p} && embedded_plugins+=("${p}") + done + for p in ${LANG_SUPPORT_SIMPLE[@]} ; do + use ${p} && plugins+=("${p}") + done + + # do not embed any plugins + if ! use embedded; then + plugins=( ${plugins[@]} ${embedded_plugins[@]} ) + embedded_plugins=() + fi + + # flatten the arrays + plugins=${plugins[@]} + embedded_plugins=${embedded_plugins[@]} + + # rename some of the use flags, language plugins are always real plugins + plugins="${plugins/perl/psgi}" + plugins="${plugins/sqlite/sqlite3}" + embedded_plugins="${embedded_plugins/sqlite/sqlite3}" + + # override defaults as requested by the user + if use xml; then + use expat && xml="expat" || xml="libxml2" + fi + if use json; then + use yajl && json="yajl" || json="jansson" + fi + use jemalloc && malloc_impl="jemalloc" + + # prepare the buildconf for gentoo + cp "${FILESDIR}"/gentoo.buildconf buildconf/gentoo.ini || die + sed -i \ + -e "s|VAR_XML|${xml}|" \ + -e "s|VAR_YAML|$(usex yaml libyaml true)|" \ + -e "s|VAR_JSON|${json}|" \ + -e "s|VAR_SSL|$(usex ssl true false)|" \ + -e "s|VAR_PCRE|$(usex pcre true false)|" \ + -e "s|VAR_ZMQ|$(usex zeromq true false)|" \ + -e "s|VAR_ROUTING|$(usex routing true false)|" \ + -e "s|VAR_DEBUG|$(usex debug true false)|" \ + -e "s|VAR_MALLOC|${malloc_impl}|" \ + -e "s|VAR_PLUGINS|${plugins// /, }|" \ + -e "s|VAR_PLUGIN_DIR|${EPREFIX}/usr/$(get_libdir)/uwsgi|" \ + -e "s|VAR_BUILD_DIR|${T}/plugins|" \ + -e "s|VAR_EMBEDDED|${embedded_plugins// /, }|" \ + buildconf/gentoo.ini || die "sed failed" + + if ! use caps; then + sed -i -e 's|sys/capability.h|DISABLED|' uwsgiconfig.py || die "sed failed" + fi + + if ! use zeromq; then + sed -i -e 's|uuid/uuid.h|DISABLED|' uwsgiconfig.py || die "sed failed" + fi + + if use uwsgi_plugins_emperor_pg ; then + PGPV="$(best_version dev-db/postgresql)" + PGSLOT="$(get_version_component_range 1-2 ${PGPV##dev-db/postgresql-})" + sed -i \ + -e "s|pg_config|pg_config${PGSLOT/.}|" \ + plugins/emperor_pg/uwsgiplugin.py || die "sed failed" + fi +} + +each_ruby_compile() { + cd "${WORKDIR}/${MY_P}" || die "sed failed" + + UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/rack gentoo rack_${RUBY##*/} || die "building plugin for ${RUBY} failed" + UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/fiber gentoo fiber_${RUBY##*/}|| die "building fiber plugin for ${RUBY} failed" + UWSGICONFIG_RUBYPATH="${RUBY}" python uwsgiconfig.py --plugin plugins/rbthreads gentoo rbthreads_${RUBY##*/}|| die "building rbthreads plugin for ${RUBY} failed" +} + +python_compile_plugins() { + local EPYV + local PYV + EPYV=${EPYTHON/.} + PYV=${EPYV/python} + + if [[ ${EPYTHON} == pypy* ]]; then + einfo "skipping because pypy is not meant to build plugins on its own" + return + fi + + ${PYTHON} uwsgiconfig.py --plugin plugins/python gentoo ${EPYV} || die "building plugin for ${EPYTHON} failed" + + if use python_asyncio ; then + if [[ "${PYV}" == "34" || "${PYV}" == "35" ]] ; then + ${PYTHON} uwsgiconfig.py --plugin plugins/asyncio gentoo asyncio${PYV} || die "building plugin for asyncio-support in ${EPYTHON} failed" + fi + fi + + if use python_gevent ; then + ${PYTHON} uwsgiconfig.py --plugin plugins/gevent gentoo gevent${PYV} || die "building plugin for gevent-support in ${EPYTHON} failed" + fi + + if use pypy ; then + if [[ "${PYV}" == "27" ]] ; then + # TODO: do some proper patching ? The wiki didn't help... I gave up for now. + # QA: RWX --- --- usr/lib64/uwsgi/pypy_plugin.so + append-ldflags -Wl,-z,noexecstack + ${PYTHON} uwsgiconfig.py --plugin plugins/pypy gentoo pypy || die "building plugin for pypy-support in ${EPYTHON} failed" + fi + fi +} + +python_install_symlinks() { + dosym uwsgi /usr/bin/uwsgi_${EPYTHON/.} +} + +src_compile() { + mkdir -p "${T}/plugins" || die + + python uwsgiconfig.py --build gentoo || die "building uwsgi failed" + + if use go ; then + python uwsgiconfig.py --plugin plugins/gccgo gentoo || die "building plugin for go failed" + fi + + if use lua ; then + # setting the name for the pkg-config file to lua, since we don't have + # slotted lua + UWSGICONFIG_LUAPC="lua" python uwsgiconfig.py --plugin plugins/lua gentoo || die "building plugin for lua failed" + fi + + if use php ; then + for s in $(php_get_slots); do + UWSGICONFIG_PHPDIR="/usr/$(get_libdir)/${s}" python uwsgiconfig.py --plugin plugins/php gentoo ${s/.} || die "building plugin for ${s} failed" + done + fi + + if use python ; then + python_foreach_impl python_compile_plugins + fi + + if use ruby ; then + ruby-ng_src_compile + fi + + if use apache2 ; then + for m in proxy_uwsgi Ruwsgi uwsgi ; do + APXS2_ARGS="-c mod_${m}.c" + apache-module_src_compile + done + fi +} + +src_install() { + dobin uwsgi + pax-mark m "${D}"/usr/bin/uwsgi + + insinto /usr/$(get_libdir)/uwsgi + doins "${T}/plugins"/*.so + + use cgi && dosym uwsgi /usr/bin/uwsgi_cgi + use go && dosym uwsgi /usr/bin/uwsgi_go + use lua && dosym uwsgi /usr/bin/uwsgi_lua + use mono && dosym uwsgi /usr/bin/uwsgi_mono + use perl && dosym uwsgi /usr/bin/uwsgi_psgi + + if use php ; then + for s in $(php_get_slots); do + dosym uwsgi /usr/bin/uwsgi_${s/.} + done + fi + + if use python ; then + python_foreach_impl python_install_symlinks + python_foreach_impl python_domodule uwsgidecorators.py + fi + + if use apache2; then + for m in proxy_uwsgi Ruwsgi uwsgi ; do + APACHE2_MOD_FILE="${APXS2_S}/.libs/mod_${m}.so" + apache-module_src_install + done + fi + + newinitd "${FILESDIR}"/uwsgi.initd-r7 uwsgi + newconfd "${FILESDIR}"/uwsgi.confd-r4 uwsgi + keepdir /etc/"${PN}".d + use uwsgi_plugins_spooler && keepdir /var/spool/"${PN}" +} + +pkg_postinst() { + if use apache2 ; then + elog "Three Apache modules have been installed: mod_proxy_uwsgi, mod_uwsgi and mod_Ruwsgi." + elog "You can enable them with -D PROXY_UWSGI, -DUWSGI or -DRUWSGI in /etc/conf.d/apache2." + elog "mod_uwsgi and mod_Ruwsgi have the same configuration interface and define the same symbols." + elog "Therefore you can enable only one of them at a time." + elog "mod_uwsgi is commercially supported by Unbit and stable but a bit hacky." + elog "mod_Ruwsgi is newer and more Apache-API friendly but not commercially supported." + elog "mod_proxy_uwsgi is a proxy module, considered stable and is now the recommended module." + fi + + elog "Append the following options to the uwsgi call to load the respective language plugin:" + use cgi && elog " '--plugins cgi' for cgi" + use lua && elog " '--plugins lua' for lua" + use mono && elog " '--plugins mono' for mono" + use perl && elog " '--plugins psgi' for perl" + + if use php ; then + for s in $(php_get_slots); do + elog " '--plugins ${s/.}' for ${s}" + done + fi + + python_pkg_postinst() { + local EPYV + local PYV + EPYV=${EPYTHON/.} + PYV=${EPYV/python} + + if [[ ${EPYTHON} == pypy* ]] ; then + elog " '--plugins pypy' for pypy" + return + fi + + elog " " + elog " '--plugins ${EPYV}' for ${EPYTHON}" + if use python_asyncio ; then + if [[ ${EPYV} == python34 ]] ; then + elog " '--plugins ${EPYV},asyncio${PYV}' for asyncio support in ${EPYTHON}" + else + elog " (asyncio is only supported in python3.4)" + fi + fi + if use python_gevent ; then + elog " '--plugins ${EPYV},gevent${PYV}' for gevent support in ${EPYTHON}" + fi + } + + use python && python_foreach_impl python_pkg_postinst + + if use ruby ; then + for ruby in $USE_RUBY; do + if use ruby_targets_${ruby} ; then + elog " '--plugins rack_${ruby/.}' for ${ruby}" + elog " '--plugins fiber_${ruby/.}' for ${ruby} fibers" + elog " '--plugins rbthreads_${ruby/.}' for ${ruby} rbthreads" + fi + done + fi +} -- cgit v1.2.3