aboutsummaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
Diffstat (limited to 'www')
-rw-r--r--www/hiawatha/Makefile75
-rw-r--r--www/hiawatha/files/patch-CMakeLists.txt12
-rw-r--r--www/hiawatha/files/patch-config.h.in10
-rw-r--r--www/hiawatha/files/patch-src_hiawatha.c45
-rw-r--r--www/hiawatha/files/pkg-message.in4
-rw-r--r--www/hiawatha/pkg-help51
-rw-r--r--www/hiawatha/pkg-plist4
7 files changed, 157 insertions, 44 deletions
diff --git a/www/hiawatha/Makefile b/www/hiawatha/Makefile
index 8ca3340bfd05..320f0054e386 100644
--- a/www/hiawatha/Makefile
+++ b/www/hiawatha/Makefile
@@ -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_DEFAULT= CACHE RPROXY MBEDTLS 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
-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_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_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
-
-MBEDTLS_LIB_DEPENDS= libmbedtls.so:security/mbedtls
-MBEDTLS_USES= localbase:ldflags
+XSLT_USES= gnome
+XSLT_USE= GNOME=libxslt
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|/etc/hiawatha|${ETCDIR}|g' \
- ${WRKSRC}/man/hiawatha.1.in ${WRKSRC}/man/cgi-wrapper.1.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
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>
diff --git a/www/hiawatha/files/patch-CMakeLists.txt b/www/hiawatha/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..8dbbd214729d
--- /dev/null
+++ b/www/hiawatha/files/patch-CMakeLists.txt
@@ -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")
diff --git a/www/hiawatha/files/patch-config.h.in b/www/hiawatha/files/patch-config.h.in
new file mode 100644
index 000000000000..8efdf0534fc8
--- /dev/null
+++ b/www/hiawatha/files/patch-config.h.in
@@ -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}
diff --git a/www/hiawatha/files/patch-src_hiawatha.c b/www/hiawatha/files/patch-src_hiawatha.c
new file mode 100644
index 000000000000..e345ec2ec194
--- /dev/null
+++ b/www/hiawatha/files/patch-src_hiawatha.c
@@ -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) {
diff --git a/www/hiawatha/files/pkg-message.in b/www/hiawatha/files/pkg-message.in
index d9b4c4794967..dec596ceffce 100644
--- a/www/hiawatha/files/pkg-message.in
+++ b/www/hiawatha/files/pkg-message.in
@@ -2,7 +2,3 @@ Edit the configuration files in %%ETCDIR%% to suit your needs.
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
diff --git a/www/hiawatha/pkg-help b/www/hiawatha/pkg-help
new file mode 100644
index 000000000000..af5846898963
--- /dev/null
+++ b/www/hiawatha/pkg-help
@@ -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.
diff --git a/www/hiawatha/pkg-plist b/www/hiawatha/pkg-plist
index a7889fcbeebf..4083e61255b1 100644
--- a/www/hiawatha/pkg-plist
+++ b/www/hiawatha/pkg-plist
@@ -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