diff --git a/www-servers/lighttpd/additional-files/create_directories.sh b/www-servers/lighttpd/additional-files/create_directories.sh
new file mode 100755
index 000000000..0f4b16b86
--- /dev/null
+++ b/www-servers/lighttpd/additional-files/create_directories.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+mkdir -p var/www/htdocs
+
+if [ ! -e var/www/htdocs/index.shtml ]; then
+ ln -s /system/data/lighttpd/www/htdocs/index.shtml var/www/htdocs
+fi
+
+if [ ! -e var/www/htdocs/index.lighttpd.html ]; then
+ ln -s /system/data/lighttpd/www/htdocs/index.lighttpd.html var/www/htdocs
+fi
+
+mkdir -p var/log/lighttpd var/lib/lighttpd var/cache/lighttpd
diff --git a/www-servers/lighttpd/additional-files/index.template b/www-servers/lighttpd/additional-files/index.template
new file mode 100644
index 000000000..12d30e389
--- /dev/null
+++ b/www-servers/lighttpd/additional-files/index.template
@@ -0,0 +1,19 @@
+
+
+
+Webserver testpage for lighttpd on Haiku
+
+
+
+This is only a test page for
lighttpd on
Haiku.
+Haiku is not responsible for the contents of this server or domain.
+
+| Operating system: | @SYSTEM@ |
+| Architecture: | @GETARCH@ |
+| Host: | @HOSTNAME@ |
+| Webserver version: | @LIGHTTPD_VERSION@ |
+
+
+
+
diff --git a/www-servers/lighttpd/lighttpd-1.4.39.recipe b/www-servers/lighttpd/lighttpd-1.4.39.recipe
index 22c613f3d..e6422d33b 100644
--- a/www-servers/lighttpd/lighttpd-1.4.39.recipe
+++ b/www-servers/lighttpd/lighttpd-1.4.39.recipe
@@ -9,12 +9,16 @@ solution for every server that is suffering load problems."
HOMEPAGE="https://www.lighttpd.net/"
COPYRIGHT="2003-2016 Jan Kneschke"
LICENSE="BSD (3-clause)"
-REVISION="1"
+REVISION="2"
SOURCE_URI="https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-$portVersion.tar.gz"
CHECKSUM_SHA256="bc5f910f78b8cbae3e8fe1a1d8558259f09dbe50dd3907db771404bfab27bb2e"
PATCHES="lighttpd-$portVersion.patch"
+ADDITIONAL_FILES="
+ create_directories.sh
+ index.template
+ "
-ARCHITECTURES="x86_gcc2 ?x86 ?x86_64 ?arm ?ppc"
+ARCHITECTURES="x86_gcc2 x86 x86_64 ?arm ?ppc"
PROVIDES="
lighttpd = $portVersion
@@ -58,44 +62,14 @@ REQUIRES="
lib:libbz2
lib:libcrypto
lib:libpcre
+ lib:libsqlite3
lib:libssl
+ lib:libxml2
lib:libz
"
PROVIDES_devel="
lighttpd_devel = $portVersion
- devel:mod_access
- devel:mod_accesslog
- devel:mod_alias
- devel:mod_auth
- devel:mod_cgi
- devel:mod_cml
- devel:mod_compress
- devel:mod_dirlisting
- devel:mod_evasive
- devel:mod_evhost
- devel:mod_expire
- devel:mod_extforward
- devel:mod_fastcgi
- devel:mod_flv_streaming
- devel:mod_indexfile
- devel:mod_magnet
- devel:mod_mysql_vhost
- devel:mod_proxy
- devel:mod_redirect
- devel:mod_rewrite
- devel:mod_rrdtool
- devel:mod_scgi
- devel:mod_secdownload
- devel:mod_setenv
- devel:mod_simple_vhost
- devel:mod_ssi
- devel:mod_staticfile
- devel:mod_status
- devel:mod_trigger_b4_dl
- devel:mod_userdir
- devel:mod_usertrack
- devel:mod_webdav
"
REQUIRES_devel="
lighttpd == $portVersion base
@@ -105,41 +79,172 @@ BUILD_REQUIRES="
haiku_devel
devel:libbz2
devel:libpcre
+ devel:libsqlite3
devel:libssl
+ devel:libxml2
devel:libz
"
BUILD_PREREQUIRES="
cmd:aclocal
+ cmd:autoconf
cmd:autom4te
cmd:automake
cmd:awk
cmd:gcc
- cmd:git
cmd:make
cmd:perl
cmd:pkg_config
+ cmd:sed
+ cmd:uname
cmd:which
"
+GLOBAL_WRITABLE_FILES="
+ settings/lighttpd/lighttpd.conf keep-old
+ settings/lighttpd/modules.conf keep-old
+ settings/lighttpd/conf.d/access_log.conf keep-old
+ settings/lighttpd/conf.d/auth.conf keep-old
+ settings/lighttpd/conf.d/cgi.conf keep-old
+ settings/lighttpd/conf.d/cml.conf keep-old
+ settings/lighttpd/conf.d/compress.conf keep-old
+ settings/lighttpd/conf.d/debug.conf keep-old
+ settings/lighttpd/conf.d/dirlisting.conf keep-old
+ settings/lighttpd/conf.d/evhost.conf keep-old
+ settings/lighttpd/conf.d/expire.conf keep-old
+ settings/lighttpd/conf.d/fastcgi.conf keep-old
+ settings/lighttpd/conf.d/geoip.conf keep-old
+ settings/lighttpd/conf.d/magnet.conf keep-old
+ settings/lighttpd/conf.d/mime.conf keep-old
+ settings/lighttpd/conf.d/mysql_vhost.conf keep-old
+ settings/lighttpd/conf.d/proxy.conf keep-old
+ settings/lighttpd/conf.d/rrdtool.conf keep-old
+ settings/lighttpd/conf.d/scgi.conf keep-old
+ settings/lighttpd/conf.d/secdownload.conf keep-old
+ settings/lighttpd/conf.d/simple_vhost.conf keep-old
+ settings/lighttpd/conf.d/ssi.conf keep-old
+ settings/lighttpd/conf.d/status.conf keep-old
+ settings/lighttpd/conf.d/trigger_b4_dl.conf keep-old
+ settings/lighttpd/conf.d/userdir.conf keep-old
+ settings/lighttpd/conf.d/webdav.conf keep-old
+ "
+
+USER_SETTINGS_FILES="
+ settings/lighttpd directory
+ settings/lighttpd/conf.d directory
+ "
+
+POST_INSTALL_SCRIPTS="
+ $relativePostInstallDir/create_directories.sh
+ "
+
BUILD()
{
aclocal
+ autoconf
automake
- runConfigure ./configure --with-openssl
+ runConfigure --omit-dirs libDir ./configure --libdir=$libDir/lighttpd \
+ --with-openssl --with-zlib --with-bzip2 --with-pcre \
+ --with-webdav-props
make $jobArgs
}
INSTALL()
{
make install
+ mkdir -p $postInstallDir
+ cp -f $portDir/additional-files/create_directories.sh $postInstallDir
+ rm $libDir/lighttpd/mod_*.la
+ mkdir -p \
+ $localStateDir/cache/lighttpd \
+ $localStateDir/lib/lighttpd \
+ $localStateDir/log/lighttpd \
+ $localStateDir/www/htdocs \
+ $settingsDir/lighttpd/conf.d
- prepareInstalledDevelLibs mod_access mod_accesslog mod_alias mod_auth \
- mod_cgi mod_cml mod_compress mod_dirlisting mod_evasive mod_evhost \
- mod_expire mod_extforward mod_fastcgi mod_flv_streaming mod_indexfile \
- mod_magnet mod_mysql_vhost mod_proxy mod_redirect mod_rewrite \
- mod_rrdtool mod_scgi mod_secdownload mod_setenv mod_simple_vhost \
- mod_ssi mod_staticfile mod_status mod_trigger_b4_dl mod_userdir \
- mod_usertrack mod_webdav
+# Tweak lighttpd.conf to have a working config with mod_ssi enabled.
+# Tweak ssi.conf to add index.shtml as index-file.names for mod_indexfile.
+# Tweak modules.conf to also add index.lighttpd.html as index-file.names.
+# This ensures a default main page will still be available if the user later
+# choses to disable SSI.
+
+ cp doc/config/lighttpd.conf $settingsDir/lighttpd
+ sed \
+ -e "/^var\.log_root/ \
+ s|\"/var\(/log/lighttpd\"\)|\"$localStateDir\1|" \
+ -e "/^var\.server_root/ \
+ s|\"/srv/www\"|\"$dataDir/lighttpd/www\"|" \
+ -e "/^var\.server_root/ \
+ a #var.server_root = \"/$relativeSharedStateDir/www\"" \
+ -e "/^var\.state_dir/ s|\"/var/run\"|\"$localStateDir\"|" \
+ -e "/^var\.home_dir/ \
+ s|\"/var/lib/lighttpd\"|\"$localStateDir/lib/lighttpd\"|" \
+ -e "/^var\.conf_dir/ \
+ s|\"/etc\(/lighttpd\"\)|\"/system/$relativeSettingsDir\1|" \
+ -e "/^var\.cache_dir/ \
+ s|\"/var\(/cache/lighttpd\"\)|\"$localStateDir\1|" \
+ -e "/^server\.use-ipv6 / s|\"enable\"|\"disable\"|" \
+ -e "s|^server\.username |#&|" \
+ -e "s|^server\.groupname |#&|" \
+ -e "s|^server\.max-fds |#&|" \
+ -e "s|^server\.max-connections |#&|" \
+ -e "s|^server\.network-backend |#&|" \
+ -e "/^server\.event-handler/ \
+ s|\"linux-sysepoll\"|\"select\"|" \
+ -e "/^server\.upload-dirs/ \
+ s|\"/var/tmp\"|\"$localStateDir/tmp\"|" \
+ -e "/^#ssl\.pemfile/ \
+ s|\"/etc/ssl\(/private/lighttpd.pem\"\)|\"$dataDir\1|" \
+ -e "/^include \"modules\.conf\"/ \
+ a index-file.names += ( \"index.lighttpd.html\" )" \
+ -i $settingsDir/lighttpd/lighttpd.conf
+
+ cp doc/config/modules.conf $settingsDir/lighttpd
+ sed \
+ -e "s|^#\(include \"conf\.d/ssi\.conf\"\)|\1|" \
+ -i $settingsDir/lighttpd/modules.conf
+
+ cp doc/config/conf.d/*.conf $settingsDir/lighttpd/conf.d
+ sed \
+ -e "/^ssi\.extension/ \
+ a index-file.names += ( \"index.shtml\" )" \
+ -i $settingsDir/lighttpd/conf.d/ssi.conf
+
+ mkdir -p $dataDir/lighttpd/www/htdocs
+
+# Create and install a static index.lighttpd.html test page from the template.
+
+ cp $portDir/additional-files/index.template \
+ $dataDir/lighttpd/www/htdocs/index.lighttpd.html
+ sed \
+ -e "s|@SYSTEM@|`uname -a`|" \
+ -e "s|@GETARCH@|`getarch`|" \
+ -e "s|@HOSTNAME@|`uname -n`|" \
+ -e "s|@LIGHTTPD_VERSION@|lighttpd/$portVersion|" \
+ -i $dataDir/lighttpd/www/htdocs/index.lighttpd.html
+
+# Create and install the SSI index.shtml test page from the template.
+
+ cp $portDir/additional-files/index.template \
+ $dataDir/lighttpd/www/htdocs/index.shtml
+ sed \
+ -e "s|@SYSTEM@||" \
+ -e "s|@GETARCH@||" \
+ -e "s|@HOSTNAME@||" \
+ -e "s|@LIGHTTPD_VERSION@||" \
+ -i $dataDir/lighttpd/www/htdocs/index.shtml
+
+# Install headers in develop/headers/lighttpd/ for building third-party modules.
+ mkdir -p $developDir/headers/lighttpd
+ cp -p src/*.h $developDir/headers/lighttpd
+# Remove those headers that won't ever be needed for building a module.
+ for i in \
+ configparser.h \
+ network.h \
+ proc_open.h \
+ request.h
+ do
+ rm -f $developDir/headers/lighttpd/$i
+ done
packageEntries devel $developDir
}
diff --git a/www-servers/lighttpd/patches/lighttpd-1.4.39.patch b/www-servers/lighttpd/patches/lighttpd-1.4.39.patch
index 7d17f8615..ac1e88ebe 100644
--- a/www-servers/lighttpd/patches/lighttpd-1.4.39.patch
+++ b/www-servers/lighttpd/patches/lighttpd-1.4.39.patch
@@ -1,6 +1,17 @@
+diff -upr lighttpd-1.4.39/configure.ac lighttpd-1.4.39-haiku/configure.ac
--- lighttpd-1.4.39/configure.ac 2015-12-05 14:17:22.000000000 +0000
+++ lighttpd-1.4.39-haiku/configure.ac
-@@ -690,7 +690,7 @@ AM_CONDITIONAL(CHECK_WITH_FASTCGI, test
+@@ -279,6 +279,9 @@ AC_SEARCH_LIBS(socket,socket)
+ AC_SEARCH_LIBS(gethostbyname,nsl socket)
+ AC_SEARCH_LIBS(hstrerror,resolv)
+
++dnl On Haiku the accept function is in libnetwork
++AC_SEARCH_LIBS(accept,network)
++
+ save_LIBS=$LIBS
+ AC_SEARCH_LIBS(dlopen,dl,[
+ AC_CHECK_HEADERS([dlfcn.h],[
+@@ -690,7 +693,7 @@ AM_CONDITIONAL(CHECK_WITH_FASTCGI, test
dnl check for extra compiler options (warning options)
if test "${GCC}" = "yes"; then
TRY_CFLAGS([-Wall -W -Wshadow -pedantic])
@@ -9,25 +20,3 @@
fi
AC_ARG_ENABLE(extra-warnings,
---- lighttpd-1.4.39/configure 2016-01-02 11:47:11.000000000 +0000
-+++ lighttpd-1.4.39-haiku/configure
-@@ -16726,8 +16726,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLA
- ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -std=gnu99" >&5
--$as_echo_n "checking if $CC supports -std=gnu99... " >&6; }
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC supports -std=gnu9x" >&5
-+$as_echo_n "checking if $CC supports -std=gnu9x... " >&6; }
- ac_ext=c
- ac_cpp='$CPP $CPPFLAGS'
- ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-@@ -16735,7 +16735,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLA
- ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
- ac_try_cflags_saved_cflags="${CFLAGS}"
-- CFLAGS="${CFLAGS} -std=gnu99"
-+ CFLAGS="${CFLAGS} -std=gnu9x"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h. */
-