diff --git a/www/uwsgi/Makefile b/www/uwsgi/Makefile index 403d4f8fe20b..13afa802ef5f 100644 --- a/www/uwsgi/Makefile +++ b/www/uwsgi/Makefile @@ -1,85 +1,86 @@ PORTNAME= uwsgi PORTVERSION= 2.0.26 +PORTREVISION= 1 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 diff --git a/www/uwsgi/files/patch-core_socket.c b/www/uwsgi/files/patch-core_socket.c new file mode 100644 index 000000000000..323b47236506 --- /dev/null +++ b/www/uwsgi/files/patch-core_socket.c @@ -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); diff --git a/www/uwsgi/files/patch-plugins_corerouter_corerouter.c b/www/uwsgi/files/patch-plugins_corerouter_corerouter.c new file mode 100644 index 000000000000..91fa5f7a228a --- /dev/null +++ b/www/uwsgi/files/patch-plugins_corerouter_corerouter.c @@ -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; diff --git a/www/uwsgi/files/patch-proto_base.c b/www/uwsgi/files/patch-proto_base.c new file mode 100644 index 000000000000..9b3f6abe60c5 --- /dev/null +++ b/www/uwsgi/files/patch-proto_base.c @@ -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);