diff --git a/www/hiawatha/Makefile b/www/hiawatha/Makefile index 8fa4f92d4868..1df719bdde60 100644 --- a/www/hiawatha/Makefile +++ b/www/hiawatha/Makefile @@ -1,70 +1,69 @@ PORTNAME= hiawatha -PORTVERSION= 10.12 -PORTREVISION= 3 +PORTVERSION= 11.2 CATEGORIES= www MASTER_SITES= https://www.hiawatha-webserver.org/files/ MAINTAINER= nc@FreeBSD.org COMMENT= Advanced and secure webserver for Unix LICENSE= GPLv2 LICENSE_FILE= ${WRKSRC}/LICENSE LIB_DEPENDS= libmbedtls.so:security/mbedtls USES= cmake:insource compiler:c11 cpe localbase:ldflags shebangfix CPE_VENDOR= ${PORTNAME}-webserver USE_RC_SUBR= hiawatha SHEBANG_FILES= extra/letsencrypt/lefh.in CMAKE_ARGS= -DCMAKE_INSTALL_LOCALSTATEDIR=/var \ -DWEBROOT_DIR=${WWWDIR} \ -DWORK_DIR=/var/db/${PORTNAME} CMAKE_ON= USE_SYSTEM_MBEDTLS OPTIONS_DEFINE= CACHE CGIWRAPPER LEFH LOADCHECK MONITOR RPROXY TOMAHAWK \ TOOLKIT XSLT OPTIONS_DEFAULT= CACHE CGIWRAPPER RPROXY TOOLKIT XSLT OPTIONS_SUB= yes CACHE_DESC= Caching support CGIWRAPPER_DESC= Install cgi-wrapper(1) (needs setuid bit) LEFH_DESC= Install Let's Encrypt For Hiawatha script LOADCHECK_DESC= Load check support (experimental) MONITOR_DESC= Hiawatha Monitor support RPROXY_DESC= Reverse proxy support TOMAHAWK_DESC= Tomahawk command shell support TOOLKIT_DESC= URL toolkit support XSLT_DESC= XSLT support CACHE_CMAKE_BOOL= ENABLE_CACHE LEFH_USES= php:cli LOADCHECK_CMAKE_BOOL= ENABLE_LOADCHECK MONITOR_CMAKE_BOOL= ENABLE_MONITOR RPROXY_CMAKE_BOOL= ENABLE_RPROXY TOMAHAWK_CMAKE_BOOL= ENABLE_TOMAHAWK TOOLKIT_CMAKE_BOOL= ENABLE_TOOLKIT XSLT_USES= gnome XSLT_USE= GNOME=libxslt XSLT_CMAKE_BOOL= ENABLE_XSLT post-patch: @${REINPLACE_CMD} -e 's|/usr/bin/ssi-cgi|${PREFIX}/bin/ssi-cgi|g' \ -e 's|/usr/bin|${LOCALBASE}/bin|g' \ ${WRKSRC}/config/cgi-wrapper.conf \ ${WRKSRC}/config/hiawatha.conf.in @${REINPLACE_CMD} -e 's|/usr/sbin|${PREFIX}/sbin|g' \ -e 's|/etc/hiawatha|${ETCDIR}|g' \ ${WRKSRC}/man/hiawatha.1.in post-install: -.for f in hiawatha.conf mimetype.conf cgi-wrapper.conf toolkit.conf \ - error.xslt index.xslt +.for f in hiawatha.conf mimetype.conf cgi-wrapper.conf toolkit.conf error.xslt \ + index.xslt ${INSTALL_DATA} ${WRKSRC}/config/${f} \ ${STAGEDIR}${PREFIX}/etc/hiawatha/${f}.sample .endfor @${MKDIR} ${STAGEDIR}${WWWDIR} ${INSTALL_DATA} ${WRKSRC}/extra/index.html \ ${STAGEDIR}${WWWDIR}/index.html.sample .include diff --git a/www/hiawatha/distinfo b/www/hiawatha/distinfo index 15a940c01607..3352a5fbd423 100644 --- a/www/hiawatha/distinfo +++ b/www/hiawatha/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1617048335 -SHA256 (hiawatha-10.12.tar.gz) = 61bf41146c51244769984135529fcffd0f6cb92be18dc12d460effc42f19f50d -SIZE (hiawatha-10.12.tar.gz) = 1454134 +TIMESTAMP = 1661965966 +SHA256 (hiawatha-11.2.tar.gz) = 99c64f76927f93469f062ab76b74eb79a397ea4be12da86bf746b2bb57cf1bc5 +SIZE (hiawatha-11.2.tar.gz) = 1583611 diff --git a/www/hiawatha/files/patch-CMakeLists.txt b/www/hiawatha/files/patch-CMakeLists.txt index 8dbbd214729d..fc0ccada759f 100644 --- a/www/hiawatha/files/patch-CMakeLists.txt +++ b/www/hiawatha/files/patch-CMakeLists.txt @@ -1,12 +1,12 @@ ---- CMakeLists.txt.orig 2018-09-11 05:44:11 UTC +--- CMakeLists.txt.orig 2022-06-01 21:01:35 UTC +++ CMakeLists.txt -@@ -39,7 +39,8 @@ include(FindZLIB) +@@ -36,7 +36,8 @@ include(cmake/CopyIfNotExists.cmake) include(cmake/CopyIfNotExists.cmake) # Settings -if(EXISTS "/proc/loadavg") +check_function_exists(getloadavg HAVE_GETLOADAVG) +if(HAVE_GETLOADAVG OR EXISTS "/proc/loadavg") option(ENABLE_LOADCHECK "Enable the ability to check for server load." on) endif() set(CONFIG_DIR ${CMAKE_INSTALL_FULL_SYSCONFDIR}/hiawatha CACHE STRING "Configuration directory") diff --git a/www/hiawatha/files/patch-config.h.in b/www/hiawatha/files/patch-config.h.in index 8efdf0534fc8..b71043215465 100644 --- a/www/hiawatha/files/patch-config.h.in +++ b/www/hiawatha/files/patch-config.h.in @@ -1,10 +1,10 @@ ---- config.h.in.orig 2017-03-13 19:58:34 UTC +--- config.h.in.orig 2022-01-23 19:44:44 UTC +++ config.h.in -@@ -46,6 +46,7 @@ +@@ -43,6 +43,7 @@ /* Functions */ #cmakedefine HAVE_CRYPT_R ${HAVE_CRYPT_R} +#cmakedefine HAVE_GETLOADAVG ${HAVE_GETLOADAVG} #cmakedefine HAVE_SETENV ${HAVE_SETENV} #cmakedefine HAVE_UNSETENV ${HAVE_UNSETENV} #cmakedefine HAVE_CLEARENV ${HAVE_CLEARENV} diff --git a/www/hiawatha/files/patch-src_hiawatha.c b/www/hiawatha/files/patch-src_hiawatha.c index e345ec2ec194..4aa62c339cf9 100644 --- a/www/hiawatha/files/patch-src_hiawatha.c +++ b/www/hiawatha/files/patch-src_hiawatha.c @@ -1,45 +1,45 @@ ---- src/hiawatha.c.orig 2018-09-16 08:22:32 UTC +--- src/hiawatha.c.orig 2021-07-22 15:18:13 UTC +++ src/hiawatha.c -@@ -156,8 +156,12 @@ void task_runner(t_config *config) { +@@ -141,8 +141,12 @@ void task_runner(t_config *config) { int delay = 0; time_t now; #ifdef ENABLE_LOADCHECK +#ifdef HAVE_GETLOADAVG + double loadavg[1]; +#else FILE *load_fp = NULL; char load_str[50], *c; +#endif #ifdef ENABLE_MONITOR int load_monitor_timer = 0; #endif -@@ -228,6 +232,21 @@ void task_runner(t_config *config) { +@@ -213,6 +217,21 @@ void task_runner(t_config *config) { #ifdef ENABLE_LOADCHECK if (config->max_server_load > 0) { +#ifdef HAVE_GETLOADAVG + if (getloadavg(loadavg, 1) >= 1) { + current_server_load = loadavg[0]; +#ifdef ENABLE_MONITOR + if (config->monitor_enabled) { + if ((current_server_load > config->max_server_load) && (load_monitor_timer == 0)) { + monitor_event("High server load (%0.2f)", current_server_load); + load_monitor_timer = 60; + } + } +#endif + } else { + current_server_load = 0; + } +#else if ((load_fp = fopen("/proc/loadavg", "r")) != NULL) { if (fgets(load_str, 49, load_fp) != NULL) { load_str[49] = '\0'; -@@ -253,6 +272,7 @@ void task_runner(t_config *config) { +@@ -238,6 +257,7 @@ void task_runner(t_config *config) { } else { current_server_load = 0; } +#endif #ifdef ENABLE_MONITOR if (load_monitor_timer > 0) {