diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /www-servers/uwsgi | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'www-servers/uwsgi')
-rw-r--r-- | www-servers/uwsgi/Manifest | 2 | ||||
-rw-r--r-- | www-servers/uwsgi/files/1.1.2-threaded-php.patch | 40 | ||||
-rw-r--r-- | www-servers/uwsgi/files/1.2.3-pyerl.patch | 31 | ||||
-rw-r--r-- | www-servers/uwsgi/files/42_mod_uwsgi-r1.conf | 9 | ||||
-rw-r--r-- | www-servers/uwsgi/files/42_mod_uwsgi-r2.conf | 9 | ||||
-rw-r--r-- | www-servers/uwsgi/files/42_mod_uwsgi.conf | 7 | ||||
-rw-r--r-- | www-servers/uwsgi/files/gentoo.buildconf | 30 | ||||
-rw-r--r-- | www-servers/uwsgi/files/uwsgi.confd-r1 | 53 | ||||
-rw-r--r-- | www-servers/uwsgi/files/uwsgi.confd-r3 | 63 | ||||
-rw-r--r-- | www-servers/uwsgi/files/uwsgi.initd-r1 | 138 | ||||
-rw-r--r-- | www-servers/uwsgi/files/uwsgi.initd-r2 | 142 | ||||
-rw-r--r-- | www-servers/uwsgi/files/uwsgi.initd-r3 | 144 | ||||
-rw-r--r-- | www-servers/uwsgi/files/uwsgi.initd-r4 | 144 | ||||
-rw-r--r-- | www-servers/uwsgi/files/uwsgi.initd-r5 | 144 | ||||
-rw-r--r-- | www-servers/uwsgi/files/uwsgi.initd-r6 | 144 | ||||
-rw-r--r-- | www-servers/uwsgi/metadata.xml | 22 | ||||
-rw-r--r-- | www-servers/uwsgi/uwsgi-2.0.11.1.ebuild | 376 | ||||
-rw-r--r-- | www-servers/uwsgi/uwsgi-2.0.9.ebuild | 376 |
18 files changed, 1874 insertions, 0 deletions
diff --git a/www-servers/uwsgi/Manifest b/www-servers/uwsgi/Manifest new file mode 100644 index 000000000000..d6eb89b09b80 --- /dev/null +++ b/www-servers/uwsgi/Manifest @@ -0,0 +1,2 @@ +DIST uwsgi-2.0.11.1.tar.gz 782091 SHA256 75a7d3138cfa9cd81a760c2f8a43f3d80961edc8e4f27043dc1412206c926287 SHA512 0978234bf1592b52f0e8718eb63de141e2aa9928e7efff3e4833f795ee66bcb14fa1a35a141d9b590d5fffc9fbc6bc8ed3c8095e04af27a34318f37dbac6117c WHIRLPOOL f830cf3cdbfda90dc65efbd01550644eb06e091fd91b6237f851efc71d2bcb1e811ad9e8db827abfeda76e041a5ef61711c84f0b3a93e041da598d349b788688 +DIST uwsgi-2.0.9.tar.gz 779244 SHA256 fe0489bca0a8b95653908be2297e35699fb9e992f728e382224587ee6b918295 SHA512 8afb6ca51aa2113e2c9fc0b90e11ce8c1aeddb38f41c7b0d5da6811d7ef93aa8b9e015abfd29b1ced35b0f6a00fd7285b8140b855fc3ee79804e2513e94a9fb5 WHIRLPOOL 362abe240b9a3f170409b850d9ae5186701b137159cd91d2e689b5f3d43dfe779f13d9e4554b60b82efd534a00751394a7982130912f7f106ac6e7c6dbde88d6 diff --git a/www-servers/uwsgi/files/1.1.2-threaded-php.patch b/www-servers/uwsgi/files/1.1.2-threaded-php.patch new file mode 100644 index 000000000000..ed75ad9b2f16 --- /dev/null +++ b/www-servers/uwsgi/files/1.1.2-threaded-php.patch @@ -0,0 +1,40 @@ +diff -r a6dd30e36bc0 plugins/php/php_plugin.c +--- a/plugins/php/php_plugin.c Fri Apr 20 16:27:00 2012 +0200 ++++ b/plugins/php/php_plugin.c Sun Apr 22 11:54:49 2012 +0200 +@@ -116,7 +116,7 @@ + } + + +-static int sapi_uwsgi_send_headers(sapi_headers_struct *sapi_headers) ++static int sapi_uwsgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) + { + sapi_header_struct *h; + zend_llist_position pos; +@@ -237,7 +237,7 @@ + } + + +-static char *sapi_uwsgi_read_cookies(void) ++static char *sapi_uwsgi_read_cookies(TSRMLS_D) + { + uint16_t len = 0; + struct wsgi_request *wsgi_req = (struct wsgi_request *) SG(server_context); +@@ -624,6 +624,10 @@ + struct uwsgi_string_list *pset = uphp.set; + struct uwsgi_string_list *append_config = uphp.append_config; + ++#ifdef ZTS ++ tsrm_startup(1, 1, 0, NULL); ++#endif ++ + sapi_startup(&uwsgi_sapi_module); + + // applying custom options +@@ -721,6 +725,7 @@ + + zend_file_handle file_handle; + ++ TSRMLS_FETCH(); // fetch the threading state in case PHP is built with threading + SG(server_context) = (void *) wsgi_req; + + if (uwsgi_parse_vars(wsgi_req)) { diff --git a/www-servers/uwsgi/files/1.2.3-pyerl.patch b/www-servers/uwsgi/files/1.2.3-pyerl.patch new file mode 100644 index 000000000000..1d4794d8f6e1 --- /dev/null +++ b/www-servers/uwsgi/files/1.2.3-pyerl.patch @@ -0,0 +1,31 @@ +diff --git a/plugins/pyerl/pyerl.c b/plugins/pyerl/pyerl.c +index a335f03..aee98e2 100644 +--- a/plugins/pyerl/pyerl.c ++++ b/plugins/pyerl/pyerl.c +@@ -537,7 +537,7 @@ void pyerl_init() { + } + + struct uwsgi_plugin pyerl_plugin = { +- ++ .name = "pyerl", + .post_init = pyerl_init, + }; + +diff --git a/plugins/pyerl/uwsgiplugin.py b/plugins/pyerl/uwsgiplugin.py +index 161d722..ae9c68d 100644 +--- a/plugins/pyerl/uwsgiplugin.py ++++ b/plugins/pyerl/uwsgiplugin.py +@@ -1,7 +1,12 @@ + from distutils import sysconfig ++import os + + NAME='pyerl' +-CFLAGS = ['-I' + sysconfig.get_python_inc(), '-I' + sysconfig.get_python_inc(plat_specific=True)] ++ ++ERLANGPATH = os.environ.get('UWSGICONFIG_ERLANGPATH', 'erl') ++includedir = os.popen(ERLANGPATH + " -noshell -noinput -eval \"io:format('~s~n', [code:lib_dir(erl_interface, include)])\" -s erlang halt").read().rstrip() ++ ++CFLAGS = ['-I' + sysconfig.get_python_inc(), '-I' + sysconfig.get_python_inc(plat_specific=True), '-I' + includedir ] + LDFLAGS = [] + LIBS = [] + diff --git a/www-servers/uwsgi/files/42_mod_uwsgi-r1.conf b/www-servers/uwsgi/files/42_mod_uwsgi-r1.conf new file mode 100644 index 000000000000..bcb383ee3abc --- /dev/null +++ b/www-servers/uwsgi/files/42_mod_uwsgi-r1.conf @@ -0,0 +1,9 @@ +<IfDefine PROXY_UWSGI> + LoadModule uwsgi_module modules/mod_proxy_uwsgi.so +</IfDefine> +<IfDefine RUWSGI> + LoadModule uwsgi_module modules/mod_Ruwsgi.so +</IfDefine> +<IfDefine UWSGI> + LoadModule uwsgi_module modules/mod_uwsgi.so +</IfDefine> 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 @@ +<IfDefine PROXY_UWSGI> + LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so +</IfDefine> +<IfDefine RUWSGI> + LoadModule uwsgi_module modules/mod_Ruwsgi.so +</IfDefine> +<IfDefine UWSGI> + LoadModule uwsgi_module modules/mod_uwsgi.so +</IfDefine> diff --git a/www-servers/uwsgi/files/42_mod_uwsgi.conf b/www-servers/uwsgi/files/42_mod_uwsgi.conf new file mode 100644 index 000000000000..a619baeafeeb --- /dev/null +++ b/www-servers/uwsgi/files/42_mod_uwsgi.conf @@ -0,0 +1,7 @@ +<IfDefine UWSGI> + LoadModule uwsgi_module modules/mod_uwsgi.so +</IfDefine> +<IfDefine RUWSGI> + LoadModule uwsgi_module modules/mod_Ruwsgi.so +</IfDefine> + 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-r1 b/www-servers/uwsgi/files/uwsgi.confd-r1 new file mode 100644 index 000000000000..3b0a005b8e63 --- /dev/null +++ b/www-servers/uwsgi/files/uwsgi.confd-r1 @@ -0,0 +1,53 @@ +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# 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= + +# The user and group to run your application as. If you do not specify these, +# the application will be run as root:root. +# +UWSGI_USER= + +# 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= + +# Additional options you might want to pass to uWSGI +# +UWSGI_EXTRA_OPTIONS= diff --git a/www-servers/uwsgi/files/uwsgi.confd-r3 b/www-servers/uwsgi/files/uwsgi.confd-r3 new file mode 100644 index 000000000000..fa0158029b1d --- /dev/null +++ b/www-servers/uwsgi/files/uwsgi.confd-r3 @@ -0,0 +1,63 @@ +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# 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= + +# 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= + +# 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-r1 b/www-servers/uwsgi/files/uwsgi.initd-r1 new file mode 100644 index 000000000000..9b3af69f1b60 --- /dev/null +++ b/www-servers/uwsgi/files/uwsgi.initd-r1 @@ -0,0 +1,138 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +PROGNAME=${SVCNAME#*.} + +UWSGI_EXEC=/usr/bin/uwsgi +PIDPATH=/var/run/uwsgi +PIDFILE="${PIDPATH}/${PROGNAME}.pid" + +extra_started_commands="${opts} reload stats" + +depend() { + need net +} + +start_pre() { + checkpath -d -m 0750 -o "${UWSGI_USER}":root "${PIDPATH}" +} + +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" + + if [ -n "${UWSGI_EXTRA_OPTIONS}" ]; then + OPTIONS="${OPTIONS} ${UWSGI_EXTRA_OPTIONS}" + fi + + ebegin "Starting uWSGI emperor" + cd "${UWSGI_DIR}" && \ + start-stop-daemon --start --user "${UWSGI_USER}" --exec "${UWSGI_EXEC}" \ + -- --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" + + 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}" + cd "${UWSGI_DIR}" && \ + start-stop-daemon --start --user "${UWSGI_USER}" --exec "${UWSGI_EXEC}" \ + -- ${OPTIONS} --pidfile "${PIDFILE}" + return $? +} + +start() { + if [ "${SVCNAME}" == "uwsgi" ]; then + if [ -n "${UWSGI_EMPEROR_PATH}" ]; then + start_emperor + eend $? + else + 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 + fi + else + start_app + eend $? + 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/files/uwsgi.initd-r2 b/www-servers/uwsgi/files/uwsgi.initd-r2 new file mode 100644 index 000000000000..f535dd24b51a --- /dev/null +++ b/www-servers/uwsgi/files/uwsgi.initd-r2 @@ -0,0 +1,142 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +PROGNAME=${SVCNAME#*.} + +UWSGI_EXEC=/usr/bin/uwsgi +if [ "${SVCNAME}" == "uwsgi" ]; then + PIDPATH=/var/run/uwsgi +else + PIDPATH="/var/run/uwsgi_${PROGNAME}" +fi +PIDFILE="${PIDPATH}/${PROGNAME}.pid" + +extra_started_commands="${opts} reload stats" + +depend() { + need net +} + +start_pre() { + checkpath -d -m 0750 -o "${UWSGI_USER}":root "${PIDPATH}" +} + +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" + + if [ -n "${UWSGI_EXTRA_OPTIONS}" ]; then + OPTIONS="${OPTIONS} ${UWSGI_EXTRA_OPTIONS}" + fi + + ebegin "Starting uWSGI emperor" + cd "${UWSGI_DIR}" && \ + start-stop-daemon --start --user "${UWSGI_USER}" --exec "${UWSGI_EXEC}" \ + -- --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" + + 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}" + cd "${UWSGI_DIR}" && \ + start-stop-daemon --start --user "${UWSGI_USER}" --exec "${UWSGI_EXEC}" \ + -- ${OPTIONS} --pidfile "${PIDFILE}" + return $? +} + +start() { + if [ "${SVCNAME}" == "uwsgi" ]; then + if [ -n "${UWSGI_EMPEROR_PATH}" ]; then + start_emperor + eend $? + else + 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 + fi + else + start_app + eend $? + 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/files/uwsgi.initd-r3 b/www-servers/uwsgi/files/uwsgi.initd-r3 new file mode 100644 index 000000000000..efa3150908ca --- /dev/null +++ b/www-servers/uwsgi/files/uwsgi.initd-r3 @@ -0,0 +1,144 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +PROGNAME=${SVCNAME#*.} + +UWSGI_EXEC=/usr/bin/uwsgi +if [ "${SVCNAME}" == "uwsgi" ]; then + PIDPATH=/var/run/uwsgi +else + PIDPATH="/var/run/uwsgi_${PROGNAME}" +fi +PIDFILE="${PIDPATH}/${PROGNAME}.pid" + +extra_started_commands="${opts} reload stats" + +depend() { + need net +} + +start_pre() { + checkpath -d -m 0750 -o "${UWSGI_USER}":"${UWSGI_GROUP}" "${PIDPATH}" +} + +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" + + if [ -n "${UWSGI_EXTRA_OPTIONS}" ]; then + OPTIONS="${OPTIONS} ${UWSGI_EXTRA_OPTIONS}" + fi + + ebegin "Starting uWSGI emperor" + 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" + + 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}" + cd "${UWSGI_DIR}" && \ + start-stop-daemon --start --user "${UWSGI_USER}" --group "${UWSGI_GROUP}" \ + --exec "${UWSGI_EXEC}" -- ${OPTIONS} --pidfile "${PIDFILE}" + return $? +} + +start() { + if [ "${SVCNAME}" == "uwsgi" ]; then + if [ -n "${UWSGI_EMPEROR_PATH}" ]; then + start_emperor + eend $? + else + 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 + fi + else + start_app + eend $? + 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/files/uwsgi.initd-r4 b/www-servers/uwsgi/files/uwsgi.initd-r4 new file mode 100644 index 000000000000..856fdb90e66b --- /dev/null +++ b/www-servers/uwsgi/files/uwsgi.initd-r4 @@ -0,0 +1,144 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +PROGNAME=${SVCNAME#*.} + +UWSGI_EXEC=/usr/bin/uwsgi +if [ "${SVCNAME}" = "uwsgi" ]; then + PIDPATH=/var/run/uwsgi +else + PIDPATH="/var/run/uwsgi_${PROGNAME}" +fi +PIDFILE="${PIDPATH}/${PROGNAME}.pid" + +extra_started_commands="${opts} reload stats" + +depend() { + need net +} + +start_pre() { + checkpath -d -m 0750 -o "${UWSGI_USER}":"${UWSGI_GROUP}" "${PIDPATH}" +} + +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" + + if [ -n "${UWSGI_EXTRA_OPTIONS}" ]; then + OPTIONS="${OPTIONS} ${UWSGI_EXTRA_OPTIONS}" + fi + + ebegin "Starting uWSGI emperor" + 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" + + 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}" + 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/files/uwsgi.initd-r5 b/www-servers/uwsgi/files/uwsgi.initd-r5 new file mode 100644 index 000000000000..d673daae6be1 --- /dev/null +++ b/www-servers/uwsgi/files/uwsgi.initd-r5 @@ -0,0 +1,144 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +PROGNAME=${SVCNAME#*.} + +UWSGI_EXEC=/usr/bin/uwsgi +if [ "${SVCNAME}" = "uwsgi" ]; then + PIDPATH=/var/run/uwsgi +else + PIDPATH="/var/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" + + if [ -n "${UWSGI_EXTRA_OPTIONS}" ]; then + OPTIONS="${OPTIONS} ${UWSGI_EXTRA_OPTIONS}" + fi + + ebegin "Starting uWSGI emperor" + checkpath -d -m 0750 -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" + + 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 0750 -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/files/uwsgi.initd-r6 b/www-servers/uwsgi/files/uwsgi.initd-r6 new file mode 100644 index 000000000000..ab550aabfaa5 --- /dev/null +++ b/www-servers/uwsgi/files/uwsgi.initd-r6 @@ -0,0 +1,144 @@ +#!/sbin/runscript +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +PROGNAME=${SVCNAME#*.} + +UWSGI_EXEC=/usr/bin/uwsgi +if [ "${SVCNAME}" = "uwsgi" ]; then + PIDPATH=/var/run/uwsgi +else + PIDPATH="/var/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" + + if [ -n "${UWSGI_EXTRA_OPTIONS}" ]; then + OPTIONS="${OPTIONS} ${UWSGI_EXTRA_OPTIONS}" + fi + + ebegin "Starting uWSGI emperor" + checkpath -d -m 0770 -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" + + 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 0750 -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..2113cc7d6bef --- /dev/null +++ b/www-servers/uwsgi/metadata.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <herd>python</herd> + <maintainer> + <email>ultrabug@gentoo.org</email> + </maintainer> + <use> + <flag name="embedded">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.</flag> + <flag name="jemalloc">Use <pkg>dev-libs/jemalloc</pkg> instead of libc's malloc</flag> + <flag name="json">Support json as a configuration file format.</flag> + <flag name="python_asyncio">Use the EXPERIMENTAL asyncio (tulip) for python3.4 async request dispatching and as LoopEngine (see http://uwsgi-docs.readthedocs.org/en/latest/asyncio.html).</flag> + <flag name="python_gevent">Use <pkg>dev-python/gevent</pkg> for async request dispatching and as LoopEngine (see http://projects.unbit.it/uwsgi/wiki/Gevent).</flag> + <flag name="routing">Enable routing support</flag> + <flag name="yaml">Support yaml as a configuration file format.</flag> + <flag name="yajl">Use <pkg>dev-libs/yajl</pkg> instead of <pkg>dev-libs/jansson</pkg> for parsing JSON configuration files (if USe=json is set)</flag> + <flag name="zeromq">Enable logging and deployment via ZeroMQ.</flag> + </use> + <upstream> + <remote-id type="github">unbit/uwsgi</remote-id> + </upstream> +</pkgmetadata> diff --git a/www-servers/uwsgi/uwsgi-2.0.11.1.ebuild b/www-servers/uwsgi/uwsgi-2.0.11.1.ebuild new file mode 100644 index 000000000000..0a15640ea746 --- /dev/null +++ b/www-servers/uwsgi/uwsgi-2.0.11.1.ebuild @@ -0,0 +1,376 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +PYTHON_COMPAT=( python2_7 python3_{3,4} ) + +RUBY_OPTIONAL="yes" +USE_RUBY="ruby19 ruby20 ruby21" + +PHP_EXT_INI="no" +PHP_EXT_NAME="dummy" +PHP_EXT_OPTIONAL_USE="php" +USE_PHP="php5-4 php5-5 php5-6" # deps must be registered separately below + +MY_P="${P/_/-}" + +inherit apache-module distutils-r1 eutils 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" + +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=( lua php 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 +# *go*: TODO +# *java*: TODO +# v8: TODO +# matheval: TODO +IUSE="apache2 +caps debug +embedded expat jemalloc json +pcre +routing +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_router_xmldir? ( xml ) + uwsgi_plugins_forkptyrouter? ( uwsgi_plugins_corerouter ) + 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? ( dev-libs/openssl:= ) + 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_rsyslog? ( app-admin/rsyslog ) + uwsgi_plugins_systemd_logger? ( sys-apps/systemd ) + uwsgi_plugins_webdav? ( dev-libs/libxml2 ) + uwsgi_plugins_xslt? ( dev-libs/libxslt ) + lua? ( dev-lang/lua:= ) + mono? ( =dev-lang/mono-2* ) + perl? ( dev-lang/perl:= ) + php? ( + php_targets_php5-4? ( dev-lang/php:5.4[embed] ) + php_targets_php5-5? ( dev-lang/php:5.5[embed] ) + ) + python? ( ${PYTHON_DEPS} ) + python_gevent? ( >=dev-python/gevent-1.0_beta2[$(python_gen_usedep 'python2*')] ) + ruby? ( $(ruby_implementations_depend) )" +DEPEND="${CDEPEND} + virtual/pkgconfig" +RDEPEND="${CDEPEND} + 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" + +src_unpack() { + default +} + +pkg_setup() { + python_setup + use ruby && ruby-ng_pkg_setup + depend.apache_pkg_setup +} + +src_prepare() { + 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 embedded 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 + sed -i \ + -e "s|VAR_XML|${xml}|" \ + -e "s|VAR_YAML|$(usex yaml true false)|" \ + -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|/usr/$(get_libdir)/uwsgi|" \ + -e "s|VAR_BUILD_DIR|${T}/plugins|" \ + -e "s|VAR_EMBEDDED|${embedded_plugins// /, }|" \ + buildconf/gentoo.ini + + use caps || sed -i -e 's|sys/capability.h|DISABLED|' uwsgiconfig.py || die "sed failed" + use zeromq || sed -i -e 's|uuid/uuid.h|DISABLED|' uwsgiconfig.py || die "sed failed" + + 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}" + + 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} + + ${PYTHON} uwsgiconfig.py --plugin plugins/python gentoo ${EPYV} || die "building plugin for ${EPYTHON} failed" + + if use python_asyncio ; then + if [ "${PYV}" == "34" ] ; 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 +} + +python_install_symlinks() { + dosym uwsgi /usr/bin/uwsgi_${EPYTHON/.} +} + +src_compile() { + mkdir -p "${T}/plugins" + + python uwsgiconfig.py --build gentoo || die "building uwsgi failed" + + 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 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-r6 uwsgi + newconfd "${FILESDIR}"/uwsgi.confd-r3 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} + + 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 + if [[ ${EPYTHON} == python2* ]] ; then + elog " '--plugins ${EPYV},gevent${PYV}' for gevent support in ${EPYTHON}" + else + elog " (gevent is currently not supported in ${EPYTHON})" + fi + 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.9.ebuild b/www-servers/uwsgi/uwsgi-2.0.9.ebuild new file mode 100644 index 000000000000..08fc6640bbbe --- /dev/null +++ b/www-servers/uwsgi/uwsgi-2.0.9.ebuild @@ -0,0 +1,376 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="5" + +PYTHON_COMPAT=( python2_7 python3_{3,4} ) + +RUBY_OPTIONAL="yes" +USE_RUBY="ruby19 ruby20" + +PHP_EXT_INI="no" +PHP_EXT_NAME="dummy" +PHP_EXT_OPTIONAL_USE="php" +USE_PHP="php5-4 php5-5" # deps must be registered separately below + +MY_P="${P/_/-}" + +inherit apache-module distutils-r1 eutils 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" + +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=( lua php 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 +# *go*: TODO +# *java*: TODO +# v8: TODO +# matheval: TODO +IUSE="apache2 +caps debug +embedded expat jemalloc json +pcre +routing +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_router_xmldir? ( xml ) + uwsgi_plugins_forkptyrouter? ( uwsgi_plugins_corerouter ) + 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? ( dev-libs/openssl:= ) + 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_rsyslog? ( app-admin/rsyslog ) + uwsgi_plugins_systemd_logger? ( sys-apps/systemd ) + uwsgi_plugins_webdav? ( dev-libs/libxml2 ) + uwsgi_plugins_xslt? ( dev-libs/libxslt ) + lua? ( dev-lang/lua:= ) + mono? ( =dev-lang/mono-2* ) + perl? ( dev-lang/perl:= ) + php? ( + php_targets_php5-4? ( dev-lang/php:5.4[embed] ) + php_targets_php5-5? ( dev-lang/php:5.5[embed] ) + ) + python? ( ${PYTHON_DEPS} ) + python_gevent? ( >=dev-python/gevent-1.0_beta2[$(python_gen_usedep 'python2*')] ) + ruby? ( $(ruby_implementations_depend) )" +DEPEND="${CDEPEND} + virtual/pkgconfig" +RDEPEND="${CDEPEND} + 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" + +src_unpack() { + default +} + +pkg_setup() { + python_setup + use ruby && ruby-ng_pkg_setup + depend.apache_pkg_setup +} + +src_prepare() { + 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 embedded 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 + sed -i \ + -e "s|VAR_XML|${xml}|" \ + -e "s|VAR_YAML|$(usex yaml true false)|" \ + -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|/usr/$(get_libdir)/uwsgi|" \ + -e "s|VAR_BUILD_DIR|${T}/plugins|" \ + -e "s|VAR_EMBEDDED|${embedded_plugins// /, }|" \ + buildconf/gentoo.ini + + use caps || sed -i -e 's|sys/capability.h|DISABLED|' uwsgiconfig.py || die "sed failed" + use zeromq || sed -i -e 's|uuid/uuid.h|DISABLED|' uwsgiconfig.py || die "sed failed" + + 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}" + + 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} + + ${PYTHON} uwsgiconfig.py --plugin plugins/python gentoo ${EPYV} || die "building plugin for ${EPYTHON} failed" + + if use python_asyncio ; then + if [ "${PYV}" == "34" ] ; 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 +} + +python_install_symlinks() { + dosym uwsgi /usr/bin/uwsgi_${EPYTHON/.} +} + +src_compile() { + mkdir -p "${T}/plugins" + + python uwsgiconfig.py --build gentoo || die "building uwsgi failed" + + 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 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-r5 uwsgi + newconfd "${FILESDIR}"/uwsgi.confd-r3 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} + + 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 + if [[ ${EPYTHON} == python2* ]] ; then + elog " '--plugins ${EPYV},gevent${PYV}' for gevent support in ${EPYTHON}" + else + elog " (gevent is currently not supported in ${EPYTHON})" + fi + 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 +} |