Mercurial > hgrepos > FreeBSD > ports > www > uwsginl
changeset 175:c567b3394ef8
MERGE: upstream uwsgi 2.0.28 as of 2024-10-26.
BUGS: Just basic merge. No adjustments and no tests.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sat, 08 Mar 2025 20:46:03 +0100 |
| parents | 927ba0b5d294 (diff) 72804fc47f7c (current diff) |
| children | 9f86d2b1b802 |
| files | uwsginl-plugin-lang-py3/distinfo uwsginl-plugin-lang-pypy3/distinfo uwsginl/Makefile uwsginl/distinfo uwsginl/files/patch-core_socket.c uwsginl/files/patch-plugins_corerouter_corerouter.c uwsginl/files/patch-proto_base.c |
| diffstat | 71 files changed, 1608 insertions(+), 354 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,5 @@ +syntax: regexp + +/work/ +/work\.old/ +/work(-[^/]*)?/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgsigs Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,7 @@ +689ef3454fc98e68f72a3403d97c9523785e4845 0 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgtags Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,7 @@ +02a0807309f71884397fbb6cb79de557bed54664 v2.0.18 +0f8e5c6bf77b3a5ad3daea019588edfee5140581 v2.1.pl1.g20201011 +4b01da8b5a33cd57176bcc5ee2c9e5088bf9e5a4 v2.1.pl2.g20201129 +8335c02a2e45d51d46fd8e66dea669e9e68d401e v2.1.pl3.g20210418 +a813664e4595a01da5f70d6a68f18d8f4145d5f4 v2.1.pl4.g20211229 +53a1506e60b8c787e08700ca8287e2ea7c9a6260 v2.1.pl5.g20220921 +910d38ab41abeedc9a9787a7e702e80b6f2f11f1 v2.1.pl6.g20221024
--- a/Makefile Sat Mar 08 19:34:51 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -PORTNAME= uwsgi -PORTVERSION= 2.0.28 -CATEGORIES= www python -PKGNAMESUFFIX= ${PYTHON_PKGNAMESUFFIX} - -MAINTAINER= wen@FreeBSD.org -COMMENT= Developer-friendly WSGI server which uses uwsgi protocol -WWW= https://projects.unbit.it/uwsgi/ - -LICENSE= GPLv2 -LICENSE_FILE= ${WRKSRC}/LICENSE - -USES= cpe pkgconfig python -USE_GITHUB= yes -GH_ACCOUNT= unbit -USE_PYTHON= distutils concurrent -USE_RC_SUBR= uwsgi -CPE_VENDOR= unbit - -MAKE_ENV+= CPUCOUNT=${MAKE_JOBS_NUMBER} UWSGI_EMBED_PLUGINS=cgi - -PYSETUP= uwsgiconfig.py -PYDISTUTILS_BUILD_TARGET= --build -PYDISTUTILS_BUILDARGS= --verbose - -USERS= uwsgi -GROUPS= uwsgi - -PLIST_FILES= bin/uwsgi \ - ${PYTHON_SITELIBDIR}/uwsgidecorators.py - -SUB_LIST= PYTHON_VER=${PYTHON_VER} - -OPTIONS_DEFINE= DEBUG JSON PCRE XML SSL -OPTIONS_DEFAULT= SSL - -OPTIONS_GROUP= PLG -OPTIONS_GROUP_PLG= COROAE LOGPIPE PSGI - -PLG_DESC= Enable plugins -COROAE_DESC= Coro::AnyEvent support -LOGPIPE_DESC= Pipe logger support -PSGI_DESC= PSGI embedded plugin - -COROAE_BUILD_DEPENDS= p5-Coro>=0:devel/p5-Coro -COROAE_IMPLIES= PSGI - -DEBUG_VARS= PYDISTUTILS_BUILDARGS+=--debug - -JSON_VARS= BUILDCONF_JSON=jansson -JSON_LIB_DEPENDS= libjansson.so:devel/jansson - -PCRE_VARS= BUILDCONF_PCRE=true -PCRE_LIB_DEPENDS= libpcre.so:devel/pcre - -PSGI_USES= perl5 - -XML_VARS= BUILDCONF_XML=libxml2 -XML_LIB_DEPENDS= libxml2.so:textproc/libxml2 - -SSL_VARS= BUILDCONF_SSL=true -SSL_USES= ssl -SSL_CFLAGS= -I${OPENSSLINC} -SSL_LDFLAGS= ${OPENSSL_LDFLAGS} - -post-patch: -.for var in JSON PCRE XML SSL - @${REINPLACE_CMD} -e '/^${var:tl} =/ s|= .*|= ${BUILDCONF_${var}:Ufalse}|' ${WRKSRC}/buildconf/base.ini -.endfor - -.for plugin in COROAE LOGPIPE PSGI -post-patch-${plugin}-on: - @${REINPLACE_CMD} -e 's/%(main_plugin)s,/& ${plugin:tl},/' \ - ${WRKSRC}/buildconf/base.ini -.endfor - -do-configure: - @${DO_NADA} - -do-install: - ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/ - @${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} - ${INSTALL_DATA} ${WRKSRC}/uwsgidecorators.py ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} - -.include <bsd.port.mk>
--- a/distinfo Sat Mar 08 19:34:51 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -TIMESTAMP = 1734750335 -SHA256 (unbit-uwsgi-2.0.28_GH0.tar.gz) = 4bb0762c5becb0414352cca664957206df4d6847e9a1c472e87708dc2cdad610 -SIZE (unbit-uwsgi-2.0.28_GH0.tar.gz) = 815887
--- a/files/patch-core-logging.c Sat Mar 08 19:34:51 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ ---- core/logging.c.orig 2020-11-06 10:12:49.865752000 +0100 -+++ core/logging.c 2020-11-06 10:17:57.825745000 +0100 -@@ -536,13 +536,23 @@ - uwsgi_error_open(logfile); - exit(1); - } -- else { -- if (dup2(fd, log_fd) < 0) { -- // this could be lost :( -- uwsgi_error("uwsgi_log_do_rotate()/dup2()"); -- exit(1); -- } -+ if (dup2(fd, log_fd) < 0) { -+ // this could be lost :( -+ uwsgi_error("uwsgi_log_do_rotate()/dup2()"); - close(fd); -+ exit(1); -+ } -+ close(fd); -+ -+ if (uwsgi.chmod_logfile_value) { -+ if (fchmod(log_fd, uwsgi.chmod_logfile_value)) { -+ uwsgi_error("fchmod()"); -+ } -+ } -+ if (uwsgi.logfile_chown) { -+ if (fchown(log_fd, uwsgi.uid, uwsgi.gid)) { -+ uwsgi_error("fchown()"); -+ } - } - } - else {
--- a/files/patch-core_socket.c Sat Mar 08 19:34:51 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -Fix SOCK_NONBLOCK handling for FreeBSD, copied from NetBSD. ---- core/socket.c.orig 2024-06-05 01:53:18 UTC -+++ core/socket.c -@@ -413,7 +413,7 @@ static int connect_to_unix(char *socket_name, int time - memcpy(uws_addr.sun_path, socket_name, UMIN(strlen(socket_name), 102)); - } - --#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) -+#if (defined(__linux__) || defined(__FreeBSD__)) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) - uwsgi_poll.fd = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0); - #else - uwsgi_poll.fd = socket(AF_UNIX, SOCK_STREAM, 0); -@@ -453,7 +453,7 @@ static int connect_to_tcp(char *socket_name, int port, - uws_addr.sin_addr.s_addr = inet_addr(socket_name); - } - --#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) -+#if (defined(__linux__) || defined(__FreeBSD__)) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) - uwsgi_poll.fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0); - #else - uwsgi_poll.fd = socket(AF_INET, SOCK_STREAM, 0); -@@ -827,7 +827,7 @@ int timed_connect(struct pollfd *fdpoll, const struct - int cnt; - /* set non-blocking socket */ - --#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) -+#if (defined(__linux__) || defined(__FreeBSD__)) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) - // hmm, nothing to do, as we are already non-blocking - #else - int arg = fcntl(fdpoll->fd, F_GETFL, NULL); -@@ -861,7 +861,7 @@ int timed_connect(struct pollfd *fdpoll, const struct - } - - --#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) -+#if (defined(__linux__) || defined(__FreeBSD__)) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) - uwsgi_socket_b(fdpoll->fd); - #else - /* re-set blocking socket */ -@@ -1907,7 +1907,7 @@ int uwsgi_accept(int server_fd) { - struct sockaddr_un client_src; - memset(&client_src, 0, sizeof(struct sockaddr_un)); - socklen_t client_src_len = 0; --#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) -+#if (defined(__linux__) || defined(__FreeBSD__)) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) - return accept4(server_fd, (struct sockaddr *) &client_src, &client_src_len, SOCK_NONBLOCK); - #elif defined(__linux__) - int client_fd = accept(server_fd, (struct sockaddr *) &client_src, &client_src_len);
--- a/files/patch-plugins_corerouter_corerouter.c Sat Mar 08 19:34:51 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -Fix SOCK_NONBLOCK handling for FreeBSD, copied from NetBSD. ---- plugins/corerouter/corerouter.c.orig 2024-06-05 01:59:02 UTC -+++ plugins/corerouter/corerouter.c -@@ -822,7 +822,7 @@ void uwsgi_corerouter_loop(int id, void *data) { - while (ugs) { - if (ugs->gateway == &ushared->gateways[id] && ucr->interesting_fd == ugs->fd) { - if (!ugs->subscription) { --#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) -+#if (defined(__linux__) || defined(__FreeBSD__)) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) - new_connection = accept4(ucr->interesting_fd, (struct sockaddr *) &cr_addr, &cr_addr_len, SOCK_NONBLOCK); - if (new_connection < 0) { - taken = 1;
--- a/files/patch-proto_base.c Sat Mar 08 19:34:51 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -Fix SOCK_NONBLOCK handling for FreeBSD, copied from NetBSD. ---- proto/base.c.orig 2024-06-05 02:00:36 UTC -+++ proto/base.c -@@ -97,7 +97,7 @@ int uwsgi_proto_base_accept(struct wsgi_request *wsgi_ - int uwsgi_proto_base_accept(struct wsgi_request *wsgi_req, int fd) { - - wsgi_req->c_len = sizeof(struct sockaddr_un); --#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) -+#if (defined(__linux__) ||defined(__FreeBSD__)) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) - return accept4(fd, (struct sockaddr *) &wsgi_req->client_addr, (socklen_t *) & wsgi_req->c_len, SOCK_NONBLOCK); - #elif defined(__linux__) - int client_fd = accept(fd, (struct sockaddr *) &wsgi_req->client_addr, (socklen_t *) & wsgi_req->c_len);
--- a/files/uwsgi.in Sat Mar 08 19:34:51 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -#!/bin/sh - -# PROVIDE: uwsgi -# REQUIRE: DAEMON -# KEYWORD: shutdown -# -# Add the following lines to /etc/rc.conf to enable uwsgi: -# -# uwsgi_enable (bool): Set it to "YES" to enable uwsgi -# Default is "NO". -# uwsgi_socket (path/str): Set the path to the uwsgi unix socket -# Default is /tmp/uwsgi.sock. -# uwsgi_socket_mode (int): Set the mode of the socket. -# Default is 660. -# uwsgi_socket_owner (str): Set the owner of the socket. -# Default is uwsgi:www. -# uwsgi_emperor (bool): Set it to "YES" to run uwsgi in emperor mode -# Default is "NO". -# uwsgi_configfile (path): Set the path to the config file -# Default is %%PREFIX%%/etc/uwsgi/uwsgi.ini. -# uwsgi_vassals_dir (path): Set the path to the vassals directory -# Default is %%PREFIX%%/etc/uwsgi/vassals. -# uwsgi_logfile (path): Set the path to the uwsgi log file -# Default is /var/log/uwsgi.log. -# uwsgi_pidfile (path): Set the path to the uwsgi pid file -# Default is /var/run/uwsgi.pid. -# uwsgi_uid (int): Set the UID of the process to run with -# Default is uwsgi. -# uwsgi_gid (int): Set the GID of the process to run with -# Default is uwsgi. -# uwsgi_flags (str): Set the uwsgi command line arguments -# Default is "-L". -# uwsgi_procname (str): Define to "uWSGI" if you start uwsgi with -# --auto-procname option. -# -# If you would like to have multiple uWSGI instances running, you can -# define multiple profiles: -# -# uwsgi_profiles (str): Set the list of uwsgi profiles -# Default is "". -# -# For each profile you can then define different options (except for -# uwsgi_enable) using the syntax uwsgi_<profile>_<option> - -. /etc/rc.subr - -name="uwsgi" -rcvar=uwsgi_enable - -load_rc_config $name - -command=%%PREFIX%%/bin/uwsgi-%%PYTHON_VER%% - -: ${uwsgi_enable="NO"} -: ${uwsgi_socket="/tmp/${name}.sock"} -: ${uwsgi_socket_mode="660"} -: ${uwsgi_socket_owner="uwsgi:www"} -: ${uwsgi_configfile="%%PREFIX%%/etc/uwsgi/uwsgi.ini"} -: ${uwsgi_profiles=""} -: ${uwsgi_logfile="/var/log/${name}.log"} -: ${uwsgi_pidfile="/var/run/${name}.pid"} -: ${uwsgi_uid="uwsgi"} -: ${uwsgi_gid="uwsgi"} -: ${uwsgi_flags="-L"} -: ${uwsgi_emperor="NO"} -: ${uwsgi_vassals_dir="%%PREFIX%%/etc/uwsgi/vassals"} - -is_uwsgi_profile() { - local profile - - for profile in $uwsgi_profiles; do - if [ "$profile" = "$1" ]; then - return 0 - fi - done - - return 1 -} - -if [ -n "${uwsgi_profiles}" ]; then - if [ -n "$2" ]; then - profile="$2" - if ! is_uwsgi_profile $profile; then - echo "$0: no such profile defined in uwsgi_profiles." - exit 1 - fi - eval uwsgi_socket=\${uwsgi_${profile}_socket:-"/tmp/${name}-${profile}.sock"} - eval uwsgi_socket_mode=\${uwsgi_${profile}_socket_mode:-${uwsgi_socket_mode}} - eval uwsgi_socket_owner=\${uwsgi_${profile}_socket_owner:-${uwsgi_socket_owner}} - eval uwsgi_logfile=\${uwsgi_${profile}_logfile:-"/var/log/${name}-${profile}.log"} - eval uwsgi_pidfile=\${uwsgi_${profile}_pidfile:-"/var/run/${name}-${profile}.pid"} - eval uwsgi_uid=\${uwsgi_${profile}_uid:-"${uwsgi_uid}"} - eval uwsgi_gid=\${uwsgi_${profile}_gid:-"${uwsgi_gid}"} - eval uwsgi_flags=\${uwsgi_${profile}_flags:-"${uwsgi_flags}"} - eval uwsgi_procname=\${uwsgi_${profile}_procname:-"${uwsgi_procname}"} - eval uwsgi_emperor=\${uwsgi_${profile}_emperor:-"${uwsgi_emperor}"} - eval uwsgi_vassals_dir=\${uwsgi_${profile}_vassals_dir:-"${uwsgi_vassals_dir}"} - eval uwsgi_configfile=\${uwsgi_${profile}_configfile:-"${uwsgi_configfile}"} - elif [ -n "$1" ]; then - for profile in ${uwsgi_profiles}; do - echo "Processing ${name} profile: ${profile}" - %%PREFIX%%/etc/rc.d/uwsgi $1 ${profile} - done - exit 0 - fi -fi - -pidfile=${uwsgi_pidfile} -start_precmd=start_precmd -stop_postcmd=stop_postcmd -reload_precmd=reload_precmd -brutalreload_cmd=brutalreload_cmd -sig_stop="INT" -extra_commands="reload brutalreload" -procname=${uwsgi_procname} - -start_precmd() -{ - rc_flags="" - if [ -e ${uwsgi_configfile} ]; then - rc_flags="--ini ${uwsgi_configfile} " - fi - - if checkyesno uwsgi_emperor; then - echo "Running uWSGI as Emperor. Vassals loaded from "$uwsgi_vassals_dir - required_dirs=${uwsgi_vassals_dir} - rc_flags=${rc_flags}"--emperor-pidfile ${uwsgi_pidfile} -d ${uwsgi_logfile} --emperor ${uwsgi_vassals_dir}" - rc_flags=${rc_flags}" --vassals-set uid=${uwsgi_uid} --vassals-set gid=${uwsgi_gid}" - rc_flags=${rc_flags}" --vassals-set chmod-socket=${uwsgi_socket_mode} --vassals-set chown-socket=${uwsgi_socket_owner}" - else - rc_flags=${rc_flags}"--master --uid ${uwsgi_uid} --gid ${uwsgi_gid} --pidfile ${uwsgi_pidfile} -d ${uwsgi_logfile}" - rc_flags=${rc_flags}" -s ${uwsgi_socket} --chmod-socket=${uwsgi_socket_mode} --chown-socket=${uwsgi_socket_owner}" - fi - - rc_flags=${rc_flags}" ${uwsgi_flags}" -} - -stop_postcmd() -{ - rm -f ${uwsgi_pidfile} ${uwsgi_socket} -} - -reload_precmd() -{ - echo "Gracefully reloading ${name} without closing the main sockets." -} - -brutalreload_cmd() -{ - echo "Reloading ${name} without closing the main sockets." - - reload_precmd="" - sig_reload="TERM" - run_rc_command ${rc_prefix}reload $rc_extra_args || return 1 -} - -run_rc_command "$1"
--- a/pkg-descr Sat Mar 08 19:34:51 2025 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -uWSGI is a fast (pure C), self-healing, developer-friendly WSGI server, -aimed for professional python webapps deployment and development. Over -time it has evolved in a complete stack for networked/clustered python -applications, implementing message/object passing, RPC and process -management.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-gevent3/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,12 @@ +# Created by: Franz Glasner <freebsd-dev-@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-${PLUGIN_NAME} + +COMMENT= Python3 gevent plugin for ${UWSGI_NAME} + +PLUGIN_NAME= gevent3 +PLUGIN_SOURCE= plugins/gevent + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-gevent3/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python3 gevent plugin for uwsginl. +Links to the default Python3 version on the system.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-gevent38/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,14 @@ +# Created by: Franz Glasner <freebsd-dev-@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-${PLUGIN_NAME} + +COMMENT= Python3.8 gevent plugin for ${UWSGI_NAME} + +USES= python:3.8 gettext-runtime + +PLUGIN_NAME= gevent38 +PLUGIN_SOURCE= plugins/gevent + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-gevent38/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python3.8 gevent plugin for uwsginl. +Links to Python 3.8.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-gevent39/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,14 @@ +# Created by: Franz Glasner <freebsd-dev-@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-${PLUGIN_NAME} + +COMMENT= Python3.9 gevent plugin for ${UWSGI_NAME} + +USES= python:3.9 gettext-runtime + +PLUGIN_NAME= gevent39 +PLUGIN_SOURCE= plugins/gevent + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-gevent39/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python3.9 gevent plugin for uwsginl. +Links to Python 3.9.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-graylog2/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,14 @@ +# Created by: Franz Glasner <freebsd-dev-@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-graylog2 + +COMMENT= Graylog2 plugin for uwsginl + +USES= + +PLUGIN_NAME= graylog2 +PLUGIN_SOURCE= plugins/graylog2 + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-graylog2/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Graylog2 plugin for uwsginl. +Allows uwsginl to log to a Graylog2 server in its native GELF format.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-greenlet3/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,15 @@ +# Created by: Franz Glasner <freebsd-dev-@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-${PLUGIN_NAME} + +COMMENT= Python3 greenlet plugin for ${UWSGI_NAME} + +RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}greenlet>=0.4:devel/py-greenlet@${PY_FLAVOR} +BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}greenlet>=0.4:devel/py-greenlet@${PY_FLAVOR} + +PLUGIN_NAME= greenlet3 +PLUGIN_SOURCE= plugins/greenlet + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-greenlet3/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python3 greenlet plugin for uwsginl. +Links to the default Python3 version on the system.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-greenlet38/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,17 @@ +# Created by: Franz Glasner <freebsd-dev-@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-${PLUGIN_NAME} + +COMMENT= Python3.8 gevent plugin for ${UWSGI_NAME} + +USES= python:3.8 gettext-runtime + +RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}greenlet>=0.4:devel/py-greenlet@${PY_FLAVOR} +BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}greenlet>=0.4:devel/py-greenlet@${PY_FLAVOR} + +PLUGIN_NAME= greenlet38 +PLUGIN_SOURCE= plugins/greenlet + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-greenlet38/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python3.8 greenlet plugin for uwsginl. +Links to Python 3.8.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-greenlet39/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,17 @@ +# Created by: Franz Glasner <freebsd-dev-@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-${PLUGIN_NAME} + +COMMENT= Python3.9 gevent plugin for ${UWSGI_NAME} + +USES= python:3.9 gettext-runtime + +RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}greenlet>=0.4:devel/py-greenlet@${PY_FLAVOR} +BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}greenlet>=0.4:devel/py-greenlet@${PY_FLAVOR} + +PLUGIN_NAME= greenlet39 +PLUGIN_SOURCE= plugins/greenlet + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-greenlet39/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python3.9 greenlet plugin for uwsginl. +Links to Python 3.9.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-php71/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,28 @@ +# Created by: Franz Glasner <freebsd-dev@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-lang-php71 +CATEGORIES= www lang devel + +COMMENT= Language plugin for PHP 7.1 + +LIB_DEPENDS+= libxml2.so:textproc/libxml2 \ + libpcre.so:devel/pcre + +USES= php:build,embed +USE_PHP= session:build xml:build +PHP_VER= 71 +DEFAULT_VERSIONS+= php=${PHP_VER} + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +PLUGIN_NAME= php71 +PLUGIN_SOURCE= plugins/php + +# +# Check whether uwsginl has been built with both libpcre and libxml2 +# +pre-build: + @( ${UWSGI_PATH} --no-server --cflags | ${GREP} -- '-DUWSGI_XML_LIBXML2' >/dev/null ) || ( echo "Error: ${UWSGI_PATH} needs to be built with XML support (libxml2)" && exit 1 ) + @( ${UWSGI_PATH} --no-server --cflags | ${GREP} -- '-DUWSGI_PCRE' >/dev/null ) || ( echo "Error: ${UWSGI_PATH} needs to be built with PCRE support (libpcre)" && exit 1 ) + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-php71/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,1 @@ +PHP7.1 language plugin (interpreter) for uwsginl.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-php74/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,28 @@ +# Created by: Franz Glasner <freebsd-dev@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-lang-php74 +CATEGORIES= www lang devel + +COMMENT= Language plugin for PHP 7.4 + +LIB_DEPENDS+= libxml2.so:textproc/libxml2 \ + libpcre.so:devel/pcre + +USES= php:build,embed +USE_PHP= session:build xml:build +PHP_VER= 74 +DEFAULT_VERSIONS+= php=${PHP_VER} + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +PLUGIN_NAME= php74 +PLUGIN_SOURCE= plugins/php + +# +# Check whether uwsginl has been built with both libpcre and libxml2 +# +pre-build: + @( ${UWSGI_PATH} --no-server --cflags | ${GREP} -- '-DUWSGI_XML_LIBXML2' >/dev/null ) || ( echo "Error: ${UWSGI_PATH} needs to be built with XML support (libxml2)" && exit 1 ) + @( ${UWSGI_PATH} --no-server --cflags | ${GREP} -- '-DUWSGI_PCRE' >/dev/null ) || ( echo "Error: ${UWSGI_PATH} needs to be built with PCRE support (libpcre)" && exit 1 ) + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-php74/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,1 @@ +PHP7.4 language plugin (interpreter) for uwsginl.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py2/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,14 @@ +# Created by: Franz Glasner <freebsd-dev@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-lang-py2 + +COMMENT= Language plugin for Python 2 (OS default) + +USES= python:2.7 gettext-runtime + +PLUGIN_NAME= python2 +PLUGIN_SOURCE= plugins/python + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py2/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python2 language plugin for uwsginl. +Links to the default Python2 version on the system.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py27/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,14 @@ +# Created by: Franz Glasner <freebsd-dev@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-lang-py27 + +COMMENT= Language plugin for Python 2.7 + +USES= python:2.7 gettext-runtime + +PLUGIN_NAME= python27 +PLUGIN_SOURCE= plugins/python + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py27/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python2.7 language plugin for uwsginl. +Links to python2.7.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py3/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,70 @@ +# Created by: Franz Glasner <freebsd-dev@dom66.de> + +PORTNAME?= ${UWSGI_NAME}-plugin-lang-py3 +#DISTVERSION= 2.0.20 +PORTVERSION= 2.1.pl7.g${MYGH_TAG_DATE} +PORTREVISION?= 0 +CATEGORIES?= www python +# Use GitHub id for now (before official 2.1); see below +#MASTER_SITES= https://projects.unbit.it/downloads/ +#DISTNAME= uwsgi-${DISTVERSION} + +MAINTAINER?= freebsd-dev@dom66.de +COMMENT?= Language plugin for Python 3 (OS default) +WWW?= https://projects.unbit.it/uwsgi/ + +LICENSE= GPLv2-WITH-LINKING-EXCEPTION +LICENSE_GROUPS= FSF GPL OSI +LICENSE_NAME= GPLv2 with linking exception +LICENSE_FILE= ${WRKSRC}/LICENSE +LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept + +BUILD_DEPENDS+= ${UWSGI_NAME}==${PORTVERSION}:www/uwsginl +RUN_DEPENDS+= ${UWSGI_NAME}==${PORTVERSION}:www/uwsginl + +# This specific python version is built +USES?= python:3.8+ gettext-runtime +# Some python version is also needed when building +USES+= cpe python:build pkgconfig +CPE_VENDOR= unbit + +.include "${.CURDIR}/../uwsginl/Makefile.gh" + +PLIST_FILES= ${PLUGIN_DIR}/${PLUGIN_FILENAME} + +MAKE_ENV+= UWSGI_PROFILE_OVERRIDE="plugin_build_dir=${STAGEDIR}${PREFIX}/${PLUGIN_DIR};plugin_dir=${PREFIX}/${PLUGIN_DIR}" PYTHON=${PYTHON_CMD} + +# by default it uses the MASTERDIR's description +DESCR?= ${.CURDIR}/pkg-descr + +UWSGI_NAME= uwsginl +UWSGI_PATH= ${LOCALBASE}/bin/${UWSGI_NAME} +PLUGIN_DIR= lib/${UWSGI_NAME}/plugins + +# The name of the plugin to be created (to eventually distingush py2 and py3) +PLUGIN_NAME?= python3 +# Where to find the sources for the plugin (defaults to plugins/${PLUGIN_NAME}) +.if defined(MASTERDIR) +.if !defined(PLUGIN_SOURCE) || empty(PLUGIN_SOURCE) +PLUGIN_SOURCE= plugins/${PLUGIN_NAME} +.endif +.else +PLUGIN_SOURCE= plugins/python +.endif +# The complete basename of the plugin +PLUGIN_FILENAME= ${PLUGIN_NAME}_plugin.so + +# Use the PATCHDIR of the binary executable by default +PATCHDIR?= ${.CURDIR}/../uwsginl/files + +do-configure: + @${DO_NADA} + +do-build: + @${MKDIR} ${STAGEDIR}${PREFIX}/${PLUGIN_DIR} + @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${UWSGI_PATH} --build-plugin "${PLUGIN_SOURCE} ${PLUGIN_NAME}") + +do-install: + ${INSTALL_LIB} ${BUILD_WRKSRC}/${PLUGIN_FILENAME} ${STAGEDIR}${PREFIX}/${PLUGIN_DIR} + +.include <bsd.port.mk>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py3/distinfo Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,3 @@ +TIMESTAMP = 1734750335 +SHA256 (unbit-uwsgi-2.0.28_GH0.tar.gz) = 4bb0762c5becb0414352cca664957206df4d6847e9a1c472e87708dc2cdad610 +SIZE (unbit-uwsgi-2.0.28_GH0.tar.gz) = 815887
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py3/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python3 language plugin for uwsginl. +Links to the default Python3 version on the system.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py310/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,14 @@ +# Created by: Franz Glasner <freebsd-dev@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-lang-py310 + +COMMENT= Language plugin for Python 3.10 + +USES= python:3.10 gettext-runtime + +PLUGIN_NAME= python310 +PLUGIN_SOURCE= plugins/python + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py310/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python3.10 language plugin for uwsginl. +Links to python3.10.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py311/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,14 @@ +# Created by: Franz Glasner <freebsd-dev@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-lang-py311 + +COMMENT= Language plugin for Python 3.11 + +USES= python:3.11 gettext-runtime + +PLUGIN_NAME= python311 +PLUGIN_SOURCE= plugins/python + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py311/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python3.11 language plugin for uwsginl. +Links to python3.11.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py38/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,14 @@ +# Created by: Franz Glasner <freebsd-dev@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-lang-py38 + +COMMENT= Language plugin for Python 3.8 + +USES= python:3.8 gettext-runtime + +PLUGIN_NAME= python38 +PLUGIN_SOURCE= plugins/python + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py38/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python3.8 language plugin for uwsginl. +Links to python3.8.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py39/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,14 @@ +# Created by: Franz Glasner <freebsd-dev@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-lang-py39 + +COMMENT= Language plugin for Python 3.9 + +USES= python:3.9 gettext-runtime + +PLUGIN_NAME= python39 +PLUGIN_SOURCE= plugins/python + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-py39/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python3.9 language plugin for uwsginl. +Links to python3.9.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-pypy3/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,93 @@ +# Created by: Franz Glasner <freebsd-dev@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-lang-pypy3 +#DISTVERSION= 2.0.20 +PORTVERSION= 2.1.pl7.g${MYGH_TAG_DATE} +CATEGORIES= www python +# Use GitHub id for now (before official 2.1); see below +#MASTER_SITES= https://projects.unbit.it/downloads/ +#DISTNAME= uwsgi-${DISTVERSION} + +MAINTAINER= freebsd-dev@dom66.de +COMMENT= Language plugin for PyPy 3 +WWW= https://projects.unbit.it/uwsgi/ + +LICENSE= GPLv2-WITH-LINKING-EXCEPTION +LICENSE_GROUPS= FSF GPL OSI +LICENSE_NAME= GPLv2 with linking exception +LICENSE_FILE= ${WRKSRC}/LICENSE +LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept + +FLAVORS= pypy3 pypy39 pypy310 +FLAVOR?= pypy310 + +PKGNAMEPREFIX= ${FLAVOR}- + +BUILD_DEPENDS+= ${UWSGI_NAME}==${PORTVERSION}:www/uwsginl +BUILD_DEPENDS+= ${PYPY_PACKAGE}>=7:lang/${PYPY_PACKAGE} +RUN_DEPENDS+= ${UWSGI_NAME}==${PORTVERSION}:www/uwsginl +RUN_DEPENDS+= ${PYPY_PACKAGE}>=7:lang/${PYPY_PACKAGE} + +USES= cpe gettext-runtime pkgconfig +CPE_VENDOR= unbit + +.include "${.CURDIR}/../uwsginl/Makefile.gh" + +EXTRA_PATCHES= ${.CURDIR}/files/extra + +PLIST_FILES= ${PLUGIN_DIR}/${PLUGIN_FILENAME} + +.if ${FLAVOR} == pypy3 +PLUGIN_NAME= pypy3 +PYPY_PACKAGE= pypy310 +PYPY_EXECUTABLE= pypy3.10 +PYPY_LDLIBRARY= libpypy3.10-c.so +PYPY_LIBDIR= lib/pypy3.10 +.elif ${FLAVOR} == pypy39 +PLUGIN_NAME= pypy39 +PYPY_PACKAGE= pypy39 +PYPY_EXECUTABLE= pypy3.9 +PYPY_LDLIBRARY= libpypy3.9-c.so +PYPY_LIBDIR= lib/pypy3.9 +.elif ${FLAVOR} == pypy310 +PLUGIN_NAME= pypy310 +PYPY_PACKAGE= pypy310 +PYPY_EXECUTABLE= pypy3.10 +PYPY_LDLIBRARY= libpypy3.10-c.so +PYPY_LIBDIR= lib/pypy3.10 +.endif + +CFLAGS+= -DPYPY_LDLIBRARY="${PYPY_LDLIBRARY}" -DPYPY_LIBDIR="${PYPY_LIBDIR}" -DPYPY_PLUGIN_NAME="${PLUGIN_NAME}" + +MAKE_ENV+= UWSGI_PROFILE_OVERRIDE="plugin_build_dir=${STAGEDIR}${PREFIX}/${PLUGIN_DIR};plugin_dir=${PREFIX}/${PLUGIN_DIR}" PYTHON=${LOCALBASE}/bin/pypy3 + +DESCR= pkg-descr + +UWSGI_NAME= uwsginl +UWSGI_PATH= ${LOCALBASE}/bin/${UWSGI_NAME} +PLUGIN_DIR= lib/${UWSGI_NAME}/plugins + +# Where to find the sources for the plugin (defaults to plugins/${PLUGIN_NAME}) +PLUGIN_SOURCE= plugins/pypy +# The complete basename of the plugin +PLUGIN_FILENAME= ${PLUGIN_NAME}_plugin.so + +# Use the PATCHDIR of the binary executable by default +PATCHDIR?= ${.CURDIR}/../uwsginl/files + +.if ${PLUGIN_NAME} != pypy3 && ${PLUGIN_NAME} != pypy38 +post-patch: + ${REINPLACE_CMD} -i '' -e 's/pypy3_plugin/${PLUGIN_NAME}_plugin/g' ${WRKSRC}/${PLUGIN_SOURCE}/pypy_setup.py +.endif + +do-configure: + @${DO_NADA} + +do-build: + @${MKDIR} ${STAGEDIR}${PREFIX}/${PLUGIN_DIR} + @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${UWSGI_PATH} --build-plugin "${PLUGIN_SOURCE} ${PLUGIN_NAME}") + +do-install: + ${INSTALL_LIB} ${BUILD_WRKSRC}/${PLUGIN_FILENAME} ${STAGEDIR}${PREFIX}/${PLUGIN_DIR} + +.include <bsd.port.mk>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-pypy3/distinfo Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,3 @@ +TIMESTAMP = 1734750335 +SHA256 (unbit-uwsgi-2.0.28_GH0.tar.gz) = 4bb0762c5becb0414352cca664957206df4d6847e9a1c472e87708dc2cdad610 +SIZE (unbit-uwsgi-2.0.28_GH0.tar.gz) = 815887
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-pypy3/files/extra/patch-plugins_pypy_pypy__plugin.c Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,166 @@ +--- plugins/pypy/pypy_plugin.c.orig 2022-09-21 14:46:45 UTC ++++ plugins/pypy/pypy_plugin.c +@@ -9,6 +9,24 @@ + + #include <uwsgi.h> + ++#if !defined(PYPY_PLUGIN_NAME) ++#error PYPY_PLUGIN_NAME not defined ++#endif ++#if !defined(PYPY_LDLIBRARY) ++#error PYPY_LDLIBRARY not defined ++#endif ++#if !defined(PYPY_LIBDIR) ++#error PYPY_LIBDIR not defined ++#endif ++ ++#define STR2(__x) #__x ++ ++#define STR(__x) STR2(__x) ++ ++#define CONCAT2(__x, __y) __x##__y ++ ++#define CONCAT(__x, __y) CONCAT2(__x, __y) ++ + struct uwsgi_pypy { + void *handler; + char *lib; +@@ -42,9 +60,10 @@ void (*uwsgi_pypy_hook_paste_loader)(char *); + void (*uwsgi_pypy_hook_pythonpath)(char *); + void (*uwsgi_pypy_hook_request)(void *, int); + void (*uwsgi_pypy_post_fork_hook)(void); ++void (*uwsgi_pypy_hook_atexit)(void); + + extern struct uwsgi_server uwsgi; +-struct uwsgi_plugin pypy_plugin; ++struct uwsgi_plugin CONCAT(PYPY_PLUGIN_NAME, _plugin); + + static int uwsgi_pypy_init() { + +@@ -58,7 +77,7 @@ static int uwsgi_pypy_init() { + } + + if (dlsym(RTLD_DEFAULT, "rpython_startup_code")) { +- uwsgi_log("PyPy runtime detected, skipping libpypy-c loading\n"); ++ uwsgi_log("PyPy runtime detected, skipping " STR(PYPY_LDLIBRARY) " loading\n"); + goto ready; + } + else if (upypy.lib) { +@@ -68,26 +87,26 @@ static int uwsgi_pypy_init() { + if (upypy.home) { + // first try with /bin way: + #ifdef __CYGWIN__ +- char *libpath = uwsgi_concat2(upypy.home, "/bin/libpypy-c.dll"); ++ char *libpath = uwsgi_concat2(upypy.home, "/bin/" STR(PYPY_LDLIBRARY)); + #elif defined(__APPLE__) +- char *libpath = uwsgi_concat2(upypy.home, "/bin/libpypy-c.dylib"); ++ char *libpath = uwsgi_concat2(upypy.home, "/bin/" STR(PYPY_LDLIBRARY)); + #else +- char *libpath = uwsgi_concat2(upypy.home, "/bin/libpypy-c.so"); ++ char *libpath = uwsgi_concat2(upypy.home, "/bin/" STR(PYPY_LDLIBRARY)); + #endif + if (uwsgi_file_exists(libpath)) { +- upypy.handler = dlopen(libpath, RTLD_NOW | RTLD_GLOBAL); +- } +- free(libpath); ++ upypy.handler = dlopen(libpath, RTLD_NOW | RTLD_GLOBAL); ++ } ++ free(libpath); + + // fallback to old-style way + if (!upypy.handler) { + + #ifdef __CYGWIN__ +- char *libpath = uwsgi_concat2(upypy.home, "/libpypy-c.dll"); ++ char *libpath = uwsgi_concat2(upypy.home, "/" STR(PYPY_LDLIBRARY)); + #elif defined(__APPLE__) +- char *libpath = uwsgi_concat2(upypy.home, "/libpypy-c.dylib"); ++ char *libpath = uwsgi_concat2(upypy.home, "/" STR(PYPY_LDLIBRARY)); + #else +- char *libpath = uwsgi_concat2(upypy.home, "/libpypy-c.so"); ++ char *libpath = uwsgi_concat2(upypy.home, "/" STR(PYPY_LDLIBRARY)); + #endif + if (uwsgi_file_exists(libpath)) { + upypy.handler = dlopen(libpath, RTLD_NOW | RTLD_GLOBAL); +@@ -98,11 +117,11 @@ static int uwsgi_pypy_init() { + // fallback to standard library search path + if (!upypy.handler) { + #ifdef __CYGWIN__ +- upypy.handler = dlopen("libpypy-c.dll", RTLD_NOW | RTLD_GLOBAL); ++ upypy.handler = dlopen(STR(PYPY_LDLIBRARY), RTLD_NOW | RTLD_GLOBAL); + #elif defined(__APPLE__) +- upypy.handler = dlopen("libpypy-c.dylib", RTLD_NOW | RTLD_GLOBAL); ++ upypy.handler = dlopen(STR(PYPY_LDLIBRARY), RTLD_NOW | RTLD_GLOBAL); + #else +- upypy.handler = dlopen("libpypy-c.so", RTLD_NOW | RTLD_GLOBAL); ++ upypy.handler = dlopen(STR(PYPY_LDLIBRARY), RTLD_NOW | RTLD_GLOBAL); + #endif + } + } +@@ -126,7 +145,7 @@ static int uwsgi_pypy_init() { + + u_pypy_init_threads = dlsym(upypy.handler, "pypy_init_threads"); + if (!u_pypy_init_threads) { +- uwsgi_log("!!! WARNING your libpypy-c does not export pypy_init_threads, multithreading will not work !!!\n"); ++ uwsgi_log("!!! WARNING your " STR(PYPY_LDLIBRARY) " does not export pypy_init_threads, multithreading will not work !!!\n"); + } + + u_rpython_startup_code(); +@@ -140,7 +159,7 @@ static int uwsgi_pypy_init() { + } + + if (u_pypy_setup_home(upypy.home, 0)) { +- char *retry = uwsgi_concat2(upypy.home, "/lib_pypy"); ++ char *retry = uwsgi_concat2(upypy.home, "/" STR(PYPY_LIBDIR)); + if (uwsgi_is_dir(retry)) { + // this time we use debug + if (!u_pypy_setup_home(retry, 1)) { +@@ -161,7 +180,7 @@ ready: + + u_pypy_thread_attach = dlsym(upypy.handler, "pypy_thread_attach"); + if (!u_pypy_thread_attach) { +- uwsgi_log("!!! WARNING your libpypy-c does not export pypy_thread_attach, multithreading will not work !!!\n"); ++ uwsgi_log("!!! WARNING your " STR(PYPY_LDLIBRARY) " does not export pypy_thread_attach, multithreading will not work !!!\n"); + } + + if (upypy.setup) { +@@ -266,13 +285,17 @@ static void uwsgi_pypy_init_apps() { + } + } + +-/* ++ + static void uwsgi_pypy_atexit() { +- if (pypy_debug_file) +- fflush(pypy_debug_file); ++ /* NOTE: this function is NOT called when "skip-atexit = true" is configured */ ++ if (!uwsgi_pypy_hook_atexit) { ++ uwsgi_log("!!! Your pypy setup does not define a uwsgi_pypy_atexit !!!\n"); ++ return; ++ } ++ uwsgi_pypy_hook_atexit(); + } +-*/ + ++ + static void uwsgi_opt_pypy_ini_paste(char *opt, char *value, void *foobar) { + uwsgi_opt_load_ini(opt, value, NULL); + upypy.paste = value; +@@ -372,8 +395,8 @@ static int uwsgi_pypy_mule(char *opt) { + } + + +-struct uwsgi_plugin pypy_plugin = { +- .name = "pypy", ++struct uwsgi_plugin CONCAT(PYPY_PLUGIN_NAME, _plugin) = { ++ .name = STR(PYPY_PLUGIN_NAME), + .modifier1 = 0, + .on_load = uwsgi_pypy_onload, + .init = uwsgi_pypy_init, +@@ -388,4 +411,6 @@ struct uwsgi_plugin pypy_plugin = { + .rpc = uwsgi_pypy_rpc, + .post_fork = uwsgi_pypy_post_fork, + .mule = uwsgi_pypy_mule, ++ ++ .atexit = uwsgi_pypy_atexit, + };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-pypy3/files/extra/patch-plugins_pypy_pypy__setup.py Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,227 @@ +--- plugins/pypy/pypy_setup.py.orig 2022-09-21 14:46:45 UTC ++++ plugins/pypy/pypy_setup.py +@@ -31,8 +31,15 @@ extern void (*uwsgi_pypy_hook_paste_loader)(char *); + extern void (*uwsgi_pypy_hook_pythonpath)(char *); + extern void (*uwsgi_pypy_hook_request)(struct wsgi_request *); + extern void (*uwsgi_pypy_post_fork_hook)(void); ++extern void (*uwsgi_pypy_hook_atexit)(void); + ''' + ++ ++# Convert a byte string to a native string using the default encoding ++def n(b): ++ return b.decode() ++ ++ + # here we load CFLAGS and uwsgi.h from the binary + defines0 = ''' + char *uwsgi_get_cflags(); +@@ -46,7 +53,7 @@ lib0 = ffi.verify(defines0) + # basically it build a list of #define from binary CFLAGS + uwsgi_cdef = [] + uwsgi_defines = [] +-uwsgi_cflags = ffi.string(lib0.uwsgi_get_cflags()).split() ++uwsgi_cflags = n(ffi.string(lib0.uwsgi_get_cflags())).split() + for cflag in uwsgi_cflags: + if cflag.startswith('-D'): + line = cflag[2:] +@@ -57,8 +64,14 @@ for cflag in uwsgi_cflags: + else: + uwsgi_cdef.append('#define %s ...' % line) + uwsgi_defines.append('#define %s 1' % line) +-uwsgi_dot_h = ffi.string(lib0.uwsgi_get_dot_h()) ++uwsgi_dot_h = n(ffi.string(lib0.uwsgi_get_dot_h())) + ++# ++# Replace #include <pcre.h> on FreeBSD because it is found on a non-standard ++# location for cffi. ++# ++uwsgi_dot_h = uwsgi_dot_h.replace('#include <pcre.h>', '#include "/usr/local/include/pcre.h"') ++ + # uwsgi definitions + cdefines = ''' + %s +@@ -110,6 +123,8 @@ struct uwsgi_worker { + uint64_t running_time; + uint64_t avg_response_time; + uint64_t tx; ++ ++ int hijacked; + ...; + }; + +@@ -164,11 +179,14 @@ struct uwsgi_server { + struct wsgi_request *wsgi_req; + + struct uwsgi_plugin *p[]; ++ ++ int skip_atexit_teardown; ++ + ...; + }; + struct uwsgi_server uwsgi; + +-struct uwsgi_plugin pypy_plugin; ++struct uwsgi_plugin pypy3_plugin; + + const char *uwsgi_pypy_version; + +@@ -269,7 +287,7 @@ const char *uwsgi_pypy_version = UWSGI_VERSION; + %s + + extern struct uwsgi_server uwsgi; +-extern struct uwsgi_plugin pypy_plugin; ++extern struct uwsgi_plugin pypy3_plugin; + %s + ''' % ('\n'.join(uwsgi_defines), uwsgi_dot_h, hooks) + +@@ -286,7 +304,7 @@ wsgi_application = None + + # fix argv if needed + if len(sys.argv) == 0: +- sys.argv.insert(0, ffi.string(lib.uwsgi_binary_path())) ++ sys.argv.insert(0, n(ffi.string(lib.uwsgi_binary_path()))) + + + @ffi.callback("void(char *)") +@@ -305,7 +323,7 @@ def uwsgi_pypy_loader(module): + load a wsgi module + """ + global wsgi_application +- m = ffi.string(module) ++ m = n(ffi.string(module)) + c = 'application' + if ':' in m: + m, c = m.split(':') +@@ -322,7 +340,7 @@ def uwsgi_pypy_file_loader(filename): + load a mod_wsgi compliant .wsgi file + """ + global wsgi_application +- w = ffi.string(filename) ++ w = n(ffi.string(filename)) + c = 'application' + mod = imp.load_source('uwsgi_file_wsgi', w) + wsgi_application = getattr(mod, c) +@@ -334,7 +352,7 @@ def uwsgi_pypy_paste_loader(config): + load a .ini paste app + """ + global wsgi_application +- c = ffi.string(config) ++ c = n(ffi.string(config)) + if c.startswith('config:'): + c = c[7:] + if c[0] != '/': +@@ -358,12 +376,47 @@ def uwsgi_pypy_post_fork_hook(): + uwsgi.post_fork_hook() + + ++@ffi.callback("void()") ++def uwsgi_pypy_atexit(): ++ """ ++ .atexit handler implementation ++ ++ Modelled after python_plugin.c ++ """ ++ mywid = lib.uwsgi.mywid ++ if mywid > 0: ++ # if hijacked do not run atexit hooks ++ if lib.uwsgi.workers[mywid].hijacked: ++ return ++ # if busy do not run atexit hooks ++ if lib.uwsgi_worker_is_busy(mywid): ++ return ++ # managing atexit in async mode is a real pain...skip it for now ++ if getattr(lib.uwsgi, "async") > 0: ++ return ++ ++ import uwsgi ++ uahandler = getattr(uwsgi, "atexit", None) ++ if callable(uahandler): ++ uahandler() ++ ++ if lib.uwsgi.skip_atexit_teardown: ++ return ++ ++ import atexit ++ aefn = getattr(atexit, "_run_exitfuncs", None) ++ if callable(aefn): ++ aefn() ++ else: ++ print("!!! atexit._run_exitfuncs() not found !!!") ++ ++ + @ffi.callback("void(char *)") + def uwsgi_pypy_pythonpath(item): + """ + add an item to the pythonpath + """ +- path = ffi.string(item) ++ path = n(ffi.string(item)) + sys.path.append(path) + print("added %s to pythonpath" % path) + +@@ -470,15 +523,17 @@ def uwsgi_pypy_wsgi_handler(wsgi_req): + def start_response(status, headers, exc_info=None): + if exc_info: + traceback.print_exception(*exc_info) ++ status = status.encode("latin1") + lib.uwsgi_response_prepare_headers(wsgi_req, ffi.new("char[]", status), len(status)) + for hh in headers: ++ hh = (hh[0].encode("latin1"), hh[1].encode("latin1")) + lib.uwsgi_response_add_header(wsgi_req, ffi.new("char[]", hh[0]), len(hh[0]), ffi.new("char[]", hh[1]), len(hh[1])) + return writer + + environ = {} + iov = wsgi_req.hvec + for i in range(0, wsgi_req.var_cnt, 2): +- environ[ffi.string(ffi.cast("char*", iov[i].iov_base), iov[i].iov_len)] = ffi.string(ffi.cast("char*", iov[i+1].iov_base), iov[i+1].iov_len) ++ environ[ffi.string(ffi.cast("char*", iov[i].iov_base), iov[i].iov_len).decode("latin1")] = ffi.string(ffi.cast("char*", iov[i+1].iov_base), iov[i+1].iov_len).decode("latin1") + + environ['wsgi.version'] = (1, 0) + scheme = 'http' +@@ -523,6 +578,7 @@ lib.uwsgi_pypy_hook_paste_loader = uwsgi_pypy_paste_lo + lib.uwsgi_pypy_hook_pythonpath = uwsgi_pypy_pythonpath + lib.uwsgi_pypy_hook_request = uwsgi_pypy_wsgi_handler + lib.uwsgi_pypy_post_fork_hook = uwsgi_pypy_post_fork_hook ++lib.uwsgi_pypy_hook_atexit = uwsgi_pypy_atexit + + """ + Here we define the "uwsgi" virtual module +@@ -537,7 +593,7 @@ uwsgi.hostname = ffi.string(lib.uwsgi.hostname) + def uwsgi_pypy_uwsgi_register_signal(signum, kind, handler): + cb = ffi.callback('void(int)', handler) + uwsgi_gc.append(cb) +- if lib.uwsgi_register_signal(signum, ffi.new("char[]", kind), cb, lib.pypy_plugin.modifier1) < 0: ++ if lib.uwsgi_register_signal(signum, ffi.new("char[]", kind), cb, lib.pypy3_plugin.modifier1) < 0: + raise Exception("unable to register signal %d" % signum) + uwsgi.register_signal = uwsgi_pypy_uwsgi_register_signal + +@@ -562,7 +618,7 @@ def uwsgi_pypy_uwsgi_register_rpc(name, func, argc=0): + rpc_func = uwsgi_pypy_RPC(func) + cb = ffi.callback("int(int, char*[], int[], char**)", rpc_func) + uwsgi_gc.append(cb) +- if lib.uwsgi_register_rpc(ffi.new("char[]", name), ffi.addressof(lib.pypy_plugin), argc, cb) < 0: ++ if lib.uwsgi_register_rpc(ffi.new("char[]", name), ffi.addressof(lib.pypy3_plugin), argc, cb) < 0: + raise Exception("unable to register rpc func %s" % name) + uwsgi.register_rpc = uwsgi_pypy_uwsgi_register_rpc + +@@ -598,8 +654,8 @@ uwsgi.rpc = uwsgi_pypy_rpc + + def uwsgi_pypy_call(func, *args): + node = None +- if '@' in func: +- (func, node) = func.split('@') ++ if b'@' in func: ++ (func, node) = func.split(b'@') + return uwsgi_pypy_rpc(node, func, *args) + uwsgi.call = uwsgi_pypy_call + +@@ -1067,7 +1123,7 @@ def uwsgi_pypy_continulet_switch(wsgi_req): + + + def uwsgi_pypy_setup_continulets(): +- if lib.uwsgi.async < 1: ++ if getattr(lib.uwsgi, "async") < 1: + raise Exception("pypy continulets require async mode !!!") + lib.uwsgi.schedule_to_main = uwsgi_pypy_continulet_switch + lib.uwsgi.schedule_to_req = uwsgi_pypy_continulet_schedule
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-pypy3/misc/make-extra-patches.sh Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,5 @@ +#!/bin/sh + +diff -u --show-c-function plugins/pypy/pypy_plugin.c.orig plugins/pypy/pypy_plugin.c >../../files/extra/patch-plugins_pypy_pypy__plugin.c + +diff -u plugins/pypy/pypy_setup.py.orig plugins/pypy/pypy_setup.py >../../files/extra/patch-plugins_pypy_pypy__setup.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-lang-pypy3/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,3 @@ +PyPy3 language plugin for uwsginl. +Dynamically links to PyPy3's libpypy3-c.so. +Contains a PY3 compatible pypy_setup.py already.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-pam/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,14 @@ +# Created by: Franz Glasner <freebsd-dev-@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-pam + +COMMENT= PAM plugin for uwsginl + +USES= + +PLUGIN_NAME= pam +PLUGIN_SOURCE= plugins/pam + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-pam/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +PAM plugin for uwsginl. +Allows uwsginl to use FreeBSD's libpam in the base system.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-tornado3/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,15 @@ +# Created by: Franz Glasner <freebsd-dev-@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-${PLUGIN_NAME} + +COMMENT= Python3 tornado plugin for ${UWSGI_NAME} + +RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}tornado>=5.0:devel/py-tornado@${PY_FLAVOR} +BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}tornado>=5.0:devel/py-tornado@${PY_FLAVOR} + +PLUGIN_NAME= tornado3 +PLUGIN_SOURCE= plugins/tornado + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-tornado3/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python3 tornado plugin for uwsginl. +Links to the default Python3 version on the system.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-tornado38/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,17 @@ +# Created by: Franz Glasner <freebsd-dev-@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-${PLUGIN_NAME} + +COMMENT= Python3.8 tornado plugin for ${UWSGI_NAME} + +USES= python:3.8 gettext-runtime + +RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}tornado>=5.0:devel/py-tornado@${PY_FLAVOR} +BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}tornado>=5.0:devel/py-tornado@${PY_FLAVOR} + +PLUGIN_NAME= tornado38 +PLUGIN_SOURCE= plugins/tornado + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-tornado38/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python3.8 tornado plugin for uwsginl. +Links to Python 3.8.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-tornado39/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,17 @@ +# Created by: Franz Glasner <freebsd-dev-@dom66.de> + +PORTNAME= ${UWSGI_NAME}-plugin-${PLUGIN_NAME} + +COMMENT= Python3.9 tornado plugin for ${UWSGI_NAME} + +USES= python:3.9 gettext-runtime + +RUN_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}tornado>=5.0:devel/py-tornado@${PY_FLAVOR} +BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}tornado>=5.0:devel/py-tornado@${PY_FLAVOR} + +PLUGIN_NAME= tornado39 +PLUGIN_SOURCE= plugins/tornado + +MASTERDIR= ${.CURDIR}/../uwsginl-plugin-lang-py3 + +.include "${MASTERDIR}/Makefile"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl-plugin-tornado39/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,2 @@ +Python3.9 tornado plugin for uwsginl. +Links to Python 3.9.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl/Makefile Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,91 @@ +# Based on www/uwsgi by: Daniel Gerzo <danger@FreeBSD.org> + +PORTNAME= uwsginl +#DISTVERSION= 2.0.28 +# "pl" sorts before .a .b .dev ... +PORTVERSION= 2.1.pl7.g${MYGH_TAG_DATE} +CATEGORIES= www +# Use GitHub id for now (before official 2.1); see below +#MASTER_SITES= https://projects.unbit.it/downloads/ +#DISTNAME= uwsgi-${DISTVERSION} + +MAINTAINER= freebsd-dev@dom66.de +COMMENT= WSGI server which uses the uwsgi protocol (nolang profile) +WWW= https://projects.unbit.it/uwsgi/ + +LICENSE= GPLv2-WITH-LINKING-EXCEPTION +LICENSE_GROUPS= FSF GPL OSI +LICENSE_NAME= GPLv2 with linking exception +LICENSE_FILE= ${WRKSRC}/LICENSE +LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept + +USES= cpe pkgconfig python:3.8-3.13,build +USE_RC_SUBR= uwsginl +CPE_VENDOR= unbit + +.include "Makefile.gh" + +MAKE_ENV+= CPUCOUNT=${MAKE_JOBS_NUMBER} UWSGI_PROFILE=nolang.ini UWSGI_BIN_NAME=${PORTNAME} UWSGI_EMBED_PLUGINS=cgi,clock_realtime,clock_monotonic,echo,logpipe,pty,forkptyrouter UWSGI_PROFILE_OVERRIDE="plugin_dir=${PREFIX}/${PLUGIN_DIR};${EXTRA_PROFILE_OVERRIDE:S/ /;/gW}" + +USERS= uwsgi +GROUPS= uwsgi + +PLIST_SUB= PORTNAME=${PORTNAME} PLUGIN_DIR=${PLUGIN_DIR} + +OPTIONS_DEFINE= DEBUGSYM UWSGIDEBUG JSON PCRE XML SSL +OPTIONS_DEFAULT= SSL BUILTINYAML + +OPTIONS_RADIO= YAML +OPTIONS_RADIO_YAML= BUILTINYAML LIBYAML + +DEBUGSYM_DESC= Build with debug symbols +DEBUGSYM_VARS= EXTRA_BUILDARGS+=--debug + +UWSGIDEBUG_DESC= Enable uwsgi debugging (def UWSGI_DEBUG, implies DEBUG) +UWSGIDEBUG_VARS= BUILDCONF_DEBUG=true + +JSON_DESC= JSON file/format/parser support (with libjansson) +JSON_VARS= BUILDCONF_JSON=jansson +JSON_LIB_DEPENDS= libjansson.so:devel/jansson + +PCRE_VARS= BUILDCONF_PCRE=true +PCRE_LIB_DEPENDS= libpcre.so:devel/pcre + +XML_VARS= BUILDCONF_XML=libxml2 +XML_LIB_DEPENDS= libxml2.so:textproc/libxml2 + +SSL_VARS= BUILDCONF_SSL=true +SSL_USES= ssl +SSL_CFLAGS= -I${OPENSSLINC} +SSL_LDFLAGS= ${OPENSSL_LDFLAGS} + +YAML_DESC= Select YAML support (or none) + +BUILTINYAML_DESC= Enable built-in basic YAML support +BUILTINYAML_VARS= BUILDCONF_YAML=true + +LIBYAML_DESC= Use external libyaml for proper YAML support +LIBYAML_VARS= BUILDCONF_YAML=libyaml +LIBYAML_CFLAGS= -I${LOCALBASE}/include +LIBYAML_LDFLAGS= -L${LOCALBASE}/lib +LIBYAML_LIB_DEPENDS= libyaml.so:textproc/libyaml + +.include <bsd.port.options.mk> + +PLUGIN_DIR= lib/${PORTNAME}/plugins + +.for bcvar in DEBUG YAML JSON PCRE XML SSL +EXTRA_PROFILE_OVERRIDE+= ${bcvar:tl}=${BUILDCONF_${bcvar}:Ufalse} +.endfor + +do-configure: + @${DO_NADA} + +do-build: + @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${PYTHON_CMD} uwsgiconfig.py --build ${EXTRA_BUILDARGS} --verbose) + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/ + ${MKDIR} ${STAGEDIR}${PREFIX}/${PLUGIN_DIR} + +.include <bsd.port.mk>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl/Makefile.gh Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,8 @@ +# Common GitHug-related definitions for uwsginl and related plugin builds when plugins are **not** slave builds + +USE_GITHUB= yes +GH_ACCOUNT= unbit +GH_PROJECT= uwsgi +GH_TAGNAME= d95638bf70f382d44c23c13324e589696d9e49bd + +MYGH_TAG_DATE= 20231226
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl/distinfo Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,3 @@ +TIMESTAMP = 1734750335 +SHA256 (unbit-uwsgi-2.0.28_GH0.tar.gz) = 4bb0762c5becb0414352cca664957206df4d6847e9a1c472e87708dc2cdad610 +SIZE (unbit-uwsgi-2.0.28_GH0.tar.gz) = 815887
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl/files/patch-core-logging.c Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,32 @@ +--- core/logging.c.orig 2022-09-21 14:46:45 UTC ++++ core/logging.c +@@ -549,13 +549,23 @@ void uwsgi_log_do_rotate(char *logfile, char *rotatedf + uwsgi_error_open(logfile); + exit(1); + } +- else { +- if (dup2(fd, log_fd) < 0) { +- // this could be lost :( +- uwsgi_error("uwsgi_log_do_rotate()/dup2()"); +- exit(1); +- } ++ if (dup2(fd, log_fd) < 0) { ++ // this could be lost :( ++ uwsgi_error("uwsgi_log_do_rotate()/dup2()"); + close(fd); ++ exit(1); ++ } ++ close(fd); ++ ++ if (uwsgi.chmod_logfile_value) { ++ if (fchmod(log_fd, uwsgi.chmod_logfile_value)) { ++ uwsgi_error("fchmod()"); ++ } ++ } ++ if (uwsgi.logfile_chown) { ++ if (fchown(log_fd, uwsgi.uid, uwsgi.gid)) { ++ uwsgi_error("fchown()"); ++ } + } + } + else {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl/files/patch-core_socket.c Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,48 @@ +Fix SOCK_NONBLOCK handling for FreeBSD, copied from NetBSD. +--- core/socket.c.orig 2024-06-05 01:53:18 UTC ++++ core/socket.c +@@ -413,7 +413,7 @@ static int connect_to_unix(char *socket_name, int time + memcpy(uws_addr.sun_path, socket_name, UMIN(strlen(socket_name), 102)); + } + +-#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) ++#if (defined(__linux__) || defined(__FreeBSD__)) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) + uwsgi_poll.fd = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK, 0); + #else + uwsgi_poll.fd = socket(AF_UNIX, SOCK_STREAM, 0); +@@ -453,7 +453,7 @@ static int connect_to_tcp(char *socket_name, int port, + uws_addr.sin_addr.s_addr = inet_addr(socket_name); + } + +-#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) ++#if (defined(__linux__) || defined(__FreeBSD__)) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) + uwsgi_poll.fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0); + #else + uwsgi_poll.fd = socket(AF_INET, SOCK_STREAM, 0); +@@ -827,7 +827,7 @@ int timed_connect(struct pollfd *fdpoll, const struct + int cnt; + /* set non-blocking socket */ + +-#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) ++#if (defined(__linux__) || defined(__FreeBSD__)) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) + // hmm, nothing to do, as we are already non-blocking + #else + int arg = fcntl(fdpoll->fd, F_GETFL, NULL); +@@ -861,7 +861,7 @@ int timed_connect(struct pollfd *fdpoll, const struct + } + + +-#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) ++#if (defined(__linux__) || defined(__FreeBSD__)) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) + uwsgi_socket_b(fdpoll->fd); + #else + /* re-set blocking socket */ +@@ -1907,7 +1907,7 @@ int uwsgi_accept(int server_fd) { + struct sockaddr_un client_src; + memset(&client_src, 0, sizeof(struct sockaddr_un)); + socklen_t client_src_len = 0; +-#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) ++#if (defined(__linux__) || defined(__FreeBSD__)) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) + return accept4(server_fd, (struct sockaddr *) &client_src, &client_src_len, SOCK_NONBLOCK); + #elif defined(__linux__) + int client_fd = accept(server_fd, (struct sockaddr *) &client_src, &client_src_len);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl/files/patch-plugins_corerouter_corerouter.c Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,12 @@ +Fix SOCK_NONBLOCK handling for FreeBSD, copied from NetBSD. +--- plugins/corerouter/corerouter.c.orig 2024-06-05 01:59:02 UTC ++++ plugins/corerouter/corerouter.c +@@ -822,7 +822,7 @@ void uwsgi_corerouter_loop(int id, void *data) { + while (ugs) { + if (ugs->gateway == &ushared->gateways[id] && ucr->interesting_fd == ugs->fd) { + if (!ugs->subscription) { +-#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) ++#if (defined(__linux__) || defined(__FreeBSD__)) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) + new_connection = accept4(ucr->interesting_fd, (struct sockaddr *) &cr_addr, &cr_addr_len, SOCK_NONBLOCK); + if (new_connection < 0) { + taken = 1;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl/files/patch-plugins_greenlet_greenlet.c Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,16 @@ +--- plugins/greenlet/greenlet.c.orig 2022-09-26 21:13:25 UTC ++++ plugins/greenlet/greenlet.c +@@ -35,11 +35,11 @@ end: + } + + static void gil_greenlet_get() { +- pthread_setspecific(up.upt_gil_key, (void *) PyGILState_Ensure()); ++ pthread_setspecific(up.upt_gil_key, (void *) (uintptr_t) PyGILState_Ensure()); + } + + static void gil_greenlet_release() { +- PyGILState_Release((PyGILState_STATE) pthread_getspecific(up.upt_gil_key)); ++ PyGILState_Release((PyGILState_STATE) (uintptr_t) pthread_getspecific(up.upt_gil_key)); + } + + static PyObject *py_uwsgi_greenlet_request(PyObject * self, PyObject *args) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl/files/patch-plugins_tornado_tornado.c Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,16 @@ +--- plugins/tornado/tornado.c.orig 2022-09-26 21:23:21 UTC ++++ plugins/tornado/tornado.c +@@ -35,11 +35,11 @@ static struct uwsgi_option tornado_options[] = { + }; + + static void gil_tornado_get() { +- pthread_setspecific(up.upt_gil_key, (void *) PyGILState_Ensure()); ++ pthread_setspecific(up.upt_gil_key, (void *) (uintptr_t) PyGILState_Ensure()); + } + + static void gil_tornado_release() { +- PyGILState_Release((PyGILState_STATE) pthread_getspecific(up.upt_gil_key)); ++ PyGILState_Release((PyGILState_STATE) (uintptr_t) pthread_getspecific(up.upt_gil_key)); + } + + static int uwsgi_tornado_wait_read_hook(int fd, int timeout) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl/files/patch-proto_base.c Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,12 @@ +Fix SOCK_NONBLOCK handling for FreeBSD, copied from NetBSD. +--- proto/base.c.orig 2024-06-05 02:00:36 UTC ++++ proto/base.c +@@ -97,7 +97,7 @@ int uwsgi_proto_base_accept(struct wsgi_request *wsgi_ + int uwsgi_proto_base_accept(struct wsgi_request *wsgi_req, int fd) { + + wsgi_req->c_len = sizeof(struct sockaddr_un); +-#if defined(__linux__) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) ++#if (defined(__linux__) ||defined(__FreeBSD__)) && defined(SOCK_NONBLOCK) && !defined(OBSOLETE_LINUX_KERNEL) + return accept4(fd, (struct sockaddr *) &wsgi_req->client_addr, (socklen_t *) & wsgi_req->c_len, SOCK_NONBLOCK); + #elif defined(__linux__) + int client_fd = accept(fd, (struct sockaddr *) &wsgi_req->client_addr, (socklen_t *) & wsgi_req->c_len);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl/files/patch-uwsgiconfig.py Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,40 @@ +--- uwsgiconfig.py.orig 2023-12-26 11:13:58 UTC ++++ uwsgiconfig.py +@@ -1494,7 +1494,8 @@ def build_plugin(path, uc, cflags, ldflags, libs, name + gcc_list.append(path + '/' + cfile) + for bfile in up.get('BINARY_LIST', []): + try: +- binary_link_cmd = "ld -r -b binary -o %s/%s.o %s/%s" % (path, bfile[1], path, bfile[1]) ++ # See https://svnweb.freebsd.org/base/vendor/lld/dist-release_80/ELF/Driver.cpp?revision=344173&view=markup ++ binary_link_cmd = "ld -r -b binary %s -o %s/%s.o %s/%s" % (get_default_target_emulation(), path, bfile[1], path, bfile[1]) + print(binary_link_cmd) + if subprocess.call(binary_link_cmd, shell=True) != 0: + raise Exception('unable to link binary file') +@@ -1592,6 +1593,18 @@ def build_plugin(path, uc, cflags, ldflags, libs, name + print("*** %s plugin built and available in %s ***" % (name, plugin_dest + '.so')) + + ++def get_default_target_emulation(): ++ """Need a target emulation on FreeBSD (ld, ld.lld when linking binary/raw""" ++ emul = "" ++ if uwsgi_cpu in ("amd64", "x86-64", "x86_64"): ++ emul = "elf_amd64" ++ elif uwsgi_cpu in ("i386", "x86"): ++ emul = "elf_i386" ++ if emul: ++ return "-m %s" % emul ++ return "" ++ ++ + def vararg_callback(option, opt_str, value, parser): + assert value is None + value = [] +@@ -1681,7 +1694,7 @@ if __name__ == "__main__": + print("*** uWSGI building and linking plugin %s ***" % options.plugin[0]) + build_plugin(options.plugin[0], uc, cflags, ldflags, libs, name) + elif options.extra_plugin: +- print("*** uWSGI building and linking plugin from %s ***" % options.extra_plugin[0]) ++ print("*** uWSGI building and linking extra plugin from %s ***" % options.extra_plugin[0]) + cflags = os.environ['UWSGI_PLUGINS_BUILDER_CFLAGS'].split() + os.environ.get("CFLAGS", "").split() + cflags.append('-I.uwsgi_plugins_builder/') + ldflags = os.environ.get("LDFLAGS", "").split()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl/files/uwsginl.in Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,178 @@ +#!/bin/sh + +# PROVIDE: uwsginl +# REQUIRE: DAEMON +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable uwsgi: +# +# uwsginl_enable (bool): Set it to "YES" to enable uwsgi +# Default is "NO". +# uwsginl_emperor (bool): Set it to "YES" to run uwsgi in emperor mode +# Default is "NO". +# uwsginl_configfile (path): Set the path to the config file +# Default is %%PREFIX%%/etc/uwsginl/uwsginl.ini. +# uwsginl_vassals_dir (path): Set the path to the vassals directory +# Default is %%PREFIX%%/etc/uwsginl/vassals. +# uwsginl_logfile (path): Set the path to the uwsgi log file +# Default is /var/log/uwsginl.log. +# uwsginl_pidfile (path): Set the path to the uwsgi pid file +# Default is /var/run/uwsginl.pid. +# uwsginl_uid (int): Set the UID of the process to run with +# Default is uwsgi. +# uwsginl_gid (int): Set the GID of the process to run with +# Default is uwsgi. +# uwsginl_flags (str): Set the uwsgi command line arguments +# Default is "--disable-logging". +# uwsginl_procname (str): Set the procname. On FreeBSD this should +# be exactly one word; otherwise stopping does +# not work. +# Default is empty (""). +# +# If you would like to have multiple uWSGI instances running, you can +# define multiple profiles: +# +# uwsginl_profiles (str): Set the list of uwsgi profiles +# Default is "". +# +# For each profile you can then define different options (except for +# uwsginl_enable) using the syntax uwsginl_<profile>_<option> + +. /etc/rc.subr + +name="uwsginl" +rcvar=uwsginl_enable + +load_rc_config $name + +command=%%PREFIX%%/bin/uwsginl + +: ${uwsginl_enable:="NO"} +: ${uwsginl_profiles=""} +: ${uwsginl_configfile="%%PREFIX%%/etc/uwsginl/uwsginl.ini"} +: ${uwsginl_logfile="/var/log/${name}.log"} +: ${uwsginl_pidfile="/var/run/${name}.pid"} +: ${uwsginl_uid:="uwsgi"} +: ${uwsginl_gid:="uwsgi"} +: ${uwsginl_flags="--disable-logging"} +: ${uwsginl_emperor:="NO"} +: ${uwsginl_vassals_dir:="%%PREFIX%%/etc/uwsginl/vassals"} +: ${uwsginl_procname=""} + +is_uwsginl_profile() { + local profile + + for profile in $uwsginl_profiles; do + if [ "$profile" = "$1" ]; then + return 0 + fi + done + return 1 +} + +# Echo name of uWSGI option for handling of configuration file with given +# extension. +get_config_filetype() +{ + case "$1" in + *.ini) + echo ini + ;; + *.json|*.js) + echo json + ;; + *.xml) + echo xml + ;; + *.yaml|*.yml) + echo yaml + ;; + *) + warn "Unknown configuration file type for \`$1'" + echo ini + return 1 + ;; + esac +} + +if [ -n "${uwsginl_profiles}" ]; then + if [ -n "$2" ]; then + profile="$2" + profilecfg="$(echo -n "${profile}" | /usr/bin/tr -- '-:.@/$*+~=!()|' '_')" + if ! is_uwsginl_profile $profile ; then + echo "$0: no such profile defined in uwsginl_profiles." + exit 1 + fi + eval uwsginl_configfile="\"\${uwsginl_${profilecfg}_configfile:-%%PREFIX%%/etc/uwsginl/uwsginl-${profile}.ini}\"" + eval uwsginl_logfile="\"\${uwsginl_${profilecfg}_logfile:-/var/log/${name}-${profile}.log}\"" + eval uwsginl_pidfile="\"\${uwsginl_${profilecfg}_pidfile:-/var/run/${name}-${profile}.pid}\"" + eval uwsginl_uid="\"\${uwsginl_${profilecfg}_uid:-${uwsginl_uid}}\"" + eval uwsginl_gid="\"\${uwsginl_${profilecfg}_gid:-${uwsginl_gid}}\"" + eval uwsginl_flags="\"\${uwsginl_${profilecfg}_flags-${uwsginl_flags}}\"" + eval uwsginl_emperor="\"\${uwsginl_${profilecfg}_emperor:-${uwsginl_emperor}}\"" + eval uwsginl_vassals_dir="\"\${uwsginl_${profilecfg}_vassals_dir:-%%PREFIX%%/etc/uwsginl/vassals-${profile}/}\"" + eval uwsginl_procname="\"\${uwsginl_${profilecfg}_procname:-}\"" + elif [ -n "$1" ]; then + for profile in ${uwsginl_profiles}; do + echo "Processing ${name} profile: ${profile}" + %%PREFIX%%/etc/rc.d/uwsginl $1 ${profile} + done + exit 0 + fi +fi + +pidfile="${uwsginl_pidfile}" +start_precmd=start_precmd +stop_postcmd=stop_postcmd +reload_precmd=reload_precmd +brutalreload_cmd=brutalreload_cmd +sig_stop="QUIT" +extra_commands="reload brutalreload" +procname="${uwsginl_procname}" + +start_precmd() +{ + if checkyesno uwsginl_emperor; then + echo "Running uWSGI as Emperor. Vassals loaded from "$uwsginl_vassals_dir + required_dirs=${uwsginl_vassals_dir} + rc_flags="--emperor-pidfile ${uwsginl_pidfile} --daemonize ${uwsginl_logfile} --emperor ${uwsginl_vassals_dir}" + rc_flags=${rc_flags}" --vassals-set uid=${uwsginl_uid} --vassals-set gid=${uwsginl_gid}" + if [ -n "${uwsginl_procname}" ]; then + rc_flags=${rc_flags}" --emperor-procname \"${uwsginl_procname}\"" + fi + else + rc_flags="--master --uid ${uwsginl_uid} --gid ${uwsginl_gid} --pidfile ${uwsginl_pidfile} --daemonize ${uwsginl_logfile}" + if [ -n "${uwsginl_procname}" ]; then + rc_flags=${rc_flags}" --procname-master \"${uwsginl_procname}\"" + fi + + fi + + rc_flags=${rc_flags}" ${uwsginl_flags}" + + # put the configfile last so that all given options can be overwritten + if [ -e "${uwsginl_configfile}" ]; then + rc_flags=${rc_flags}" --$(get_config_filetype "${uwsginl_configfile}") ${uwsginl_configfile}" + fi +} + +stop_postcmd() +{ + rm -f "${uwsginl_pidfile}" +} + +reload_precmd() +{ + echo "Gracefully reloading ${name} without closing the main sockets." +} + +brutalreload_cmd() +{ + echo "Reloading ${name} without closing the main sockets." + + reload_precmd="" + sig_reload="TERM" + run_rc_command ${rc_prefix}reload $rc_extra_args || return 1 +} + +run_rc_command "$1"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uwsginl/pkg-descr Sat Mar 08 20:46:03 2025 +0100 @@ -0,0 +1,217 @@ +uWSGI is a fast (pure C), self-healing, developer-friendly WSGI server, +aimed for professional python webapps deployment and development. Over +time it has evolved in a complete stack for networked/clustered python +applications, implementing message/object passing, RPC and process +management. + +*** uWSGI loaded generic plugins *** +nagios +rrdtool +carbon +corerouter +fastrouter +http +ugreen +syslog +rsyslog +logsocket +router_uwsgi +router_redirect +router_basicauth +zergpool +redislog +mongodblog +router_rewrite +router_http +logfile +router_cache +rawrouter +router_static +sslrouter +cheaper_busyness +transformation_tofile +transformation_gzip +transformation_chunked +transformation_offload +router_memcached +router_redis +router_hash +router_expires +router_metrics +transformation_template +stats_pusher_socket +router_fcgi +clock_realtime +clock_monotonic +logpipe +pty +forkptyrouter + +*** uWSGI loaded request plugins *** +9: cgi +17: spooler +18: symcall +100: ping +101: echo +110: signal +111: cache +173: rpc +--- end of plugins list --- + +*** uWSGI loaded clocks *** +unix +realtime +monotonic +--- end of clocks list --- + +*** uWSGI loaded loggers *** +syslog +rsyslog +socket +redislog +mongodblog +file +fd +stdio +pipe +--- end of loggers list --- + +*** uWSGI loaded alarms *** +signal +cmd +mule +log +--- end of alarms list --- + +*** uWSGI loaded cheaper algorithms *** +busyness +spare +spare2 +backlog +manual +--- end of cheaper algorithms list --- + +*** uWSGI loaded loop engines *** +simple +async +--- end of loop engines list --- + +*** uWSGI loaded routers (when built with PCRE) *** +continue +last +break +return +break-with-status +log +donotlog +donotoffload +logvar +goto +addvar +addheader +delheader +remheader +clearheaders +resetheaders +disableheaders +signal +send +send-crnl +chdir +setapp +setuser +sethome +setfile +setscriptname +setmethod +seturi +setremoteaddr +setpathinfo +fixpathinfo +setdocroot +setscheme +setprocname +alarm +setmodifier1 +setmodifier2 ++ +- +* +/ +flush +fixcl +forcecl +harakiri +call +rpc +rpcret +rpcblob +rpcnext +rpcraw +rpcvar +uwsgi +proxyuwsgi +redirect +redirect-302 +redirect-permanent +redirect-301 +basicauth +basicauth-next +rewrite +rewrite-last +http +httpdumb +proxyhttp +httpconnect +proxyhttpconnect +cache +cache-continue +cachevar +cacheset +cachestore +cache-store +cacheinc +cachedec +cachemul +cachediv +static +static-next +file +file-next +sendfile +sendfile-next +fastfile +fastfile-next +symcall +symcall-next +tofile +to-file +gzip +chunked +offload +memcached +memcached-continue +memcachedstore +memcached-store +redis +redis-continue +redisstore +redis-store +hash +expires +metricinc +metricdec +metricmul +metricdiv +metricset +template +fcgiauth +fcgi +cgi +cgihelper +--- end of routers list --- + +*** uWSGI loaded imperial monitors *** +dir +glob +--- end of imperial monitors list ---
