Date: Fri, 30 Nov 2018 10:09:50 +0000 (UTC) From: Tobias Kortkamp <tobik@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r486242 - in head/www/hiawatha: . files Message-ID: <201811301009.wAUA9o2R078703@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tobik Date: Fri Nov 30 10:09:50 2018 New Revision: 486242 URL: https://svnweb.freebsd.org/changeset/ports/486242 Log: www/hiawatha: Add WebServerLoad support and cleanup port - Sort options helpers and add pkg-help to describe options better - Add CGIWRAPPER option which when turned off will turn off packaging of the setuid cgi-wrapper(1) binary - Cleanup post-patch; use LOCALBASE where appropriate - Drop incidental variables - Do not install useless documentation; README.md is a copy of pkg-descr; ChangeLog does not contain any juicy information either - Trim pkg-message further Added: head/www/hiawatha/files/patch-CMakeLists.txt (contents, props changed) head/www/hiawatha/files/patch-config.h.in (contents, props changed) head/www/hiawatha/files/patch-src_hiawatha.c (contents, props changed) head/www/hiawatha/pkg-help (contents, props changed) Modified: head/www/hiawatha/Makefile head/www/hiawatha/files/pkg-message.in head/www/hiawatha/pkg-plist Modified: head/www/hiawatha/Makefile ============================================================================== --- head/www/hiawatha/Makefile Fri Nov 30 09:39:50 2018 (r486241) +++ head/www/hiawatha/Makefile Fri Nov 30 10:09:50 2018 (r486242) @@ -3,6 +3,7 @@ PORTNAME= hiawatha PORTVERSION= 10.8.3 +PORTREVISION= 1 CATEGORIES= www MASTER_SITES= https://www.hiawatha-webserver.org/files/ @@ -12,62 +13,60 @@ COMMENT= Advanced and secure webserver for Unix LICENSE= GPLv2 LICENSE_FILE= ${WRKSRC}/LICENSE -PORTDOCS= ChangeLog README.md -CONFIG_FILES= hiawatha.conf mimetype.conf cgi-wrapper.conf toolkit.conf \ - error.xslt index.xslt - -SUB_FILES= pkg-message USES= cmake compiler:c11 -USE_LDCONFIG= yes USE_RC_SUBR= hiawatha -CMAKE_ARGS+= -DCMAKE_INSTALL_LOCALSTATEDIR=/var \ - -DCMAKE_INSTALL_MANDIR=${PREFIX}/man \ +CMAKE_ARGS= -DCMAKE_INSTALL_LOCALSTATEDIR=/var \ -DWEBROOT_DIR=${WWWDIR} \ -DWORK_DIR=/var/db/${PORTNAME} +SUB_FILES= pkg-message -OPTIONS_DEFINE= CACHE DOCS IPV6 MONITOR RPROXY MBEDTLS TOMAHAWK TOOLKIT XSLT +OPTIONS_DEFINE= CACHE CGIWRAPPER IPV6 LOADCHECK MBEDTLS MONITOR \ + RPROXY TOMAHAWK TOOLKIT XSLT +OPTIONS_DEFAULT= CACHE CGIWRAPPER MBEDTLS RPROXY TOOLKIT XSLT +OPTIONS_SUB= yes -OPTIONS_DEFAULT= CACHE RPROXY MBEDTLS TOOLKIT XSLT +CACHE_DESC= Caching support +CGIWRAPPER_DESC= Install cgi-wrapper(1) (needs setuid bit) +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_DESC= Enable cache support -MONITOR_DESC= Enable Hiawatha Monitor -RPROXY_DESC= Enable reverse proxy -TOMAHAWK_DESC= Enable Tomahawk command channel -TOOLKIT_DESC= Enable URL toolkit -XSLT_DESC= Enable XSLT support - CACHE_CMAKE_BOOL= ENABLE_CACHE -TOMAHAWK_CMAKE_BOOL= ENABLE_TOMAHAWK IPV6_CMAKE_BOOL= ENABLE_IPV6 +LOADCHECK_CMAKE_BOOL= ENABLE_LOADCHECK +MBEDTLS_CMAKE_BOOL= ENABLE_TLS USE_SYSTEM_MBEDTLS +MBEDTLS_LIB_DEPENDS= libmbedtls.so:security/mbedtls +MBEDTLS_USES= localbase:ldflags MONITOR_CMAKE_BOOL= ENABLE_MONITOR RPROXY_CMAKE_BOOL= ENABLE_RPROXY -MBEDTLS_CMAKE_BOOL= ENABLE_TLS USE_SYSTEM_MBEDTLS +TOMAHAWK_CMAKE_BOOL= ENABLE_TOMAHAWK TOOLKIT_CMAKE_BOOL= ENABLE_TOOLKIT -XSLT_USE= GNOME=libxslt XSLT_CMAKE_BOOL= ENABLE_XSLT +XSLT_USES= gnome +XSLT_USE= GNOME=libxslt -MBEDTLS_LIB_DEPENDS= libmbedtls.so:security/mbedtls -MBEDTLS_USES= localbase:ldflags - post-patch: - @${REINPLACE_CMD} -e 's|/usr|${PREFIX}|g' \ - ${WRKSRC}/man/hiawatha.1.in ${WRKSRC}/man/cgi-wrapper.1.in \ - ${WRKSRC}/config/cgi-wrapper.conf ${WRKSRC}/config/hiawatha.conf.in + @${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 \ + ${WRKSRC}/man/cgi-wrapper.1.in - @${REINPLACE_CMD} -e 's|/etc/hiawatha|${ETCDIR}|g' \ - ${WRKSRC}/man/hiawatha.1.in ${WRKSRC}/man/cgi-wrapper.1.in - post-install: -.for FILE in ${CONFIG_FILES} - ${INSTALL_DATA} ${WRKSRC}/config/${FILE} ${STAGEDIR}${PREFIX}/etc/hiawatha/${FILE}.sample +.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 - -post-install-DOCS-on: - @${MKDIR} ${STAGEDIR}${DOCSDIR} - ${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR}/ + @${MKDIR} ${STAGEDIR}${WWWDIR} + ${INSTALL_DATA} ${WRKSRC}/extra/index.html \ + ${STAGEDIR}${WWWDIR}/index.html.sample .include <bsd.port.mk> Added: head/www/hiawatha/files/patch-CMakeLists.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/hiawatha/files/patch-CMakeLists.txt Fri Nov 30 10:09:50 2018 (r486242) @@ -0,0 +1,12 @@ +--- CMakeLists.txt.orig 2018-09-11 05:44:11 UTC ++++ CMakeLists.txt +@@ -39,7 +39,8 @@ include(FindZLIB) + 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") Added: head/www/hiawatha/files/patch-config.h.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/hiawatha/files/patch-config.h.in Fri Nov 30 10:09:50 2018 (r486242) @@ -0,0 +1,10 @@ +--- config.h.in.orig 2017-03-13 19:58:34 UTC ++++ config.h.in +@@ -46,6 +46,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} Added: head/www/hiawatha/files/patch-src_hiawatha.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/hiawatha/files/patch-src_hiawatha.c Fri Nov 30 10:09:50 2018 (r486242) @@ -0,0 +1,45 @@ +--- src/hiawatha.c.orig 2018-09-16 08:22:32 UTC ++++ src/hiawatha.c +@@ -156,8 +156,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) { + + #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) { + } else { + current_server_load = 0; + } ++#endif + + #ifdef ENABLE_MONITOR + if (load_monitor_timer > 0) { Modified: head/www/hiawatha/files/pkg-message.in ============================================================================== --- head/www/hiawatha/files/pkg-message.in Fri Nov 30 09:39:50 2018 (r486241) +++ head/www/hiawatha/files/pkg-message.in Fri Nov 30 10:09:50 2018 (r486242) @@ -2,7 +2,3 @@ Edit the configuration files in %%ETCDIR%% to suit you Run sysrc hiawatha_enable="YES" and start Hiawatha by running: service hiawatha start - -If you configured Hiawatha with Monitor, download and install the -respective files needed to monitor your webserver: -https://www.hiawatha-webserver.org/monitor Added: head/www/hiawatha/pkg-help ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/www/hiawatha/pkg-help Fri Nov 30 10:09:50 2018 (r486242) @@ -0,0 +1,51 @@ +CACHE +Enable caching support. It is required for the CacheMaxFilesize, +CacheRProxyExtension, CacheSize settings. CacheRProxyExtension +requires that RPROXY is also enabled. With this option enabled +Hiawatha can cache the output of CGI applications, which can control +caching with the X-Hiawatha-Cache and X-Hiawatha-Cache-Remove +headers. + +CGIWRAPPER +Install cgi-wrapper(1), which can be used to run certain CGI programs +with a different user than the webserver's user. To function +properly, the CGI wrapper binary needs to have the setuid bit set. + +LOADCHECK +Enable experimental support for MaxServerLoad. When the host has +a load higher than that value, Hiawatha will drop incoming connections. +Officially this feature is only available on Linux. FreeBSD support +is largely untested. + +MBEDTLS +Enable TLS support via security/mbedtls. It is required for the +MinTLSversion, PublicKeyPins, RequiredCA, RequireTLS, and TLScertFile +settings. + +MONITOR +Enable Hiawatha Monitor support. The MonitorServer setting enables +logging of statistical information to a remote monitor server running +www/hiawatha-monitor. CGI scripts can log additional events via +the X-Hiawatha-Monitor header. + +RPROXY +Enable reverse proxy support. It is required for the CacheRProxyExtension, +CustomHeaderBackend, and ReverseProxy settings. CacheRProxyExtension +requires that CACHE is also enabled. ReverseProxy can be used to +forward requests with URLs that match POSIX regular expressions to +other webserver + +TOMAHAWK +Enable support for the Tomahawk command shell. It is exposed via +a Telnet service and can be used to view server statistics, to +ban/unban clients, to clear the cache, etc. + +TOOLKIT +Enable URL toolkit support, a DSL to do URL transformations. It +is required for the UseToolkit settings and UrlToolkit directives. + +XSLT +With this option enabled, Hiawatha can do XSL transformation via +textproc/libxslt when an XML file is requested and an XSLT sheet +is present. It is required for the ErrorXSLTfile, UseXSLT settings, +and XSLT support in ShowIndex. Modified: head/www/hiawatha/pkg-plist ============================================================================== --- head/www/hiawatha/pkg-plist Fri Nov 30 09:39:50 2018 (r486241) +++ head/www/hiawatha/pkg-plist Fri Nov 30 10:09:50 2018 (r486242) @@ -5,11 +5,11 @@ bin/ssi-cgi @sample %%ETCDIR%%/index.xslt.sample @sample %%ETCDIR%%/mimetype.conf.sample @sample %%ETCDIR%%/toolkit.conf.sample -man/man1/cgi-wrapper.1.gz +%%CGIWRAPPER%%man/man1/cgi-wrapper.1.gz man/man1/hiawatha.1.gz man/man1/ssi-cgi.1.gz man/man1/wigwam.1.gz -sbin/cgi-wrapper +%%CGIWRAPPER%%sbin/cgi-wrapper sbin/hiawatha sbin/wigwam @sample %%WWWDIR%%/index.html.sample
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811301009.wAUA9o2R078703>