SUMMARY="The Number One HTTP Server On The Internet"
DESCRIPTION="The Apache HTTP Server Project is a collaborative software \
development effort aimed at creating a robust, commercial-grade, featureful, \
and freely-available source code implementation of an HTTP (Web) server"
HOMEPAGE="https://httpd.apache.org/"
COPYRIGHT="1995-2016 The Apache Software Foundation."
LICENSE="Apache v2"
REVISION="2"
SOURCE_URI="https://archive.apache.org/dist/httpd/httpd-$portVersion.tar.gz"
CHECKSUM_SHA256="948e4a11278a5954698b880b30f401b1e9ab743713ee2c7280a54dd4ddd87085"
SOURCE_DIR="httpd-$portVersion"
PATCHES="apache-$portVersion.patchset"

ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	apache2$secondaryArchSuffix = $portVersion
	cmd:ab$secondaryArchSuffix
	cmd:apachectl$secondaryArchSuffix
	cmd:apxs$secondaryArchSuffix
	cmd:checkgid$secondaryArchSuffix
	cmd:dbmmanage$secondaryArchSuffix
	cmd:envvars$secondaryArchSuffix
	cmd:envvars_std$secondaryArchSuffix
	cmd:fcgistarter$secondaryArchSuffix
	cmd:htcacheclean$secondaryArchSuffix
	cmd:htdbm$secondaryArchSuffix
	cmd:htdigest$secondaryArchSuffix
	cmd:htpasswd$secondaryArchSuffix
	cmd:httpd$secondaryArchSuffix
	cmd:httxt2dbm$secondaryArchSuffix
	cmd:logresolve$secondaryArchSuffix
	cmd:rotatelogs$secondaryArchSuffix
	lib:mod_access_compat$secondaryArchSuffix
	lib:mod_actions$secondaryArchSuffix
	lib:mod_alias$secondaryArchSuffix
	lib:mod_allowmethods$secondaryArchSuffix
	lib:mod_auth_basic$secondaryArchSuffix
	lib:mod_auth_digest$secondaryArchSuffix
	lib:mod_auth_form$secondaryArchSuffix
	lib:mod_authn_anon$secondaryArchSuffix
	lib:mod_authn_core$secondaryArchSuffix
	lib:mod_authn_dbd$secondaryArchSuffix
	lib:mod_authn_dbm$secondaryArchSuffix
	lib:mod_authn_file$secondaryArchSuffix
	lib:mod_authn_socache$secondaryArchSuffix
	lib:mod_authz_core$secondaryArchSuffix
	lib:mod_authz_dbd$secondaryArchSuffix
	lib:mod_authz_dbm$secondaryArchSuffix
	lib:mod_authz_groupfile$secondaryArchSuffix
	lib:mod_authz_host$secondaryArchSuffix
	lib:mod_authz_owner$secondaryArchSuffix
	lib:mod_authz_user$secondaryArchSuffix
	lib:mod_autoindex$secondaryArchSuffix
	lib:mod_buffer$secondaryArchSuffix
	lib:mod_cache$secondaryArchSuffix
	lib:mod_cache_disk$secondaryArchSuffix
	lib:mod_cache_socache$secondaryArchSuffix
	lib:mod_cgid$secondaryArchSuffix
	lib:mod_dav$secondaryArchSuffix
	lib:mod_dav_fs$secondaryArchSuffix
	lib:mod_dbd$secondaryArchSuffix
	lib:mod_dir$secondaryArchSuffix
	lib:mod_dumpio$secondaryArchSuffix
	lib:mod_env$secondaryArchSuffix
	lib:mod_expires$secondaryArchSuffix
	lib:mod_ext_filter$secondaryArchSuffix
	lib:mod_file_cache$secondaryArchSuffix
	lib:mod_filter$secondaryArchSuffix
	lib:mod_headers$secondaryArchSuffix
	lib:mod_include$secondaryArchSuffix
	lib:mod_info$secondaryArchSuffix
	lib:mod_lbmethod_bybusyness$secondaryArchSuffix
	lib:mod_lbmethod_byrequests$secondaryArchSuffix
	lib:mod_lbmethod_bytraffic$secondaryArchSuffix
	lib:mod_lbmethod_heartbeat$secondaryArchSuffix
	lib:mod_log_config$secondaryArchSuffix
	lib:mod_log_debug$secondaryArchSuffix
	lib:mod_logio$secondaryArchSuffix
	lib:mod_macro$secondaryArchSuffix
	lib:mod_mime$secondaryArchSuffix
	lib:mod_negotiation$secondaryArchSuffix
	lib:mod_proxy$secondaryArchSuffix
	lib:mod_proxy_ajp$secondaryArchSuffix
	lib:mod_proxy_balancer$secondaryArchSuffix
	lib:mod_proxy_connect$secondaryArchSuffix
	lib:mod_proxy_express$secondaryArchSuffix
	lib:mod_proxy_fcgi$secondaryArchSuffix
	lib:mod_proxy_fdpass$secondaryArchSuffix
	lib:mod_proxy_ftp$secondaryArchSuffix
	lib:mod_proxy_hcheck$secondaryArchSuffix
	lib:mod_proxy_http$secondaryArchSuffix
	lib:mod_proxy_scgi$secondaryArchSuffix
	lib:mod_proxy_wstunnel$secondaryArchSuffix
	lib:mod_ratelimit$secondaryArchSuffix
	lib:mod_remoteip$secondaryArchSuffix
	lib:mod_reqtimeout$secondaryArchSuffix
	lib:mod_request$secondaryArchSuffix
	lib:mod_rewrite$secondaryArchSuffix
	lib:mod_sed$secondaryArchSuffix
	lib:mod_session$secondaryArchSuffix
	lib:mod_session_cookie$secondaryArchSuffix
	lib:mod_session_dbd$secondaryArchSuffix
	lib:mod_setenvif$secondaryArchSuffix
	lib:mod_slotmem_shm$secondaryArchSuffix
	lib:mod_socache_dbm$secondaryArchSuffix
	lib:mod_socache_memcache$secondaryArchSuffix
	lib:mod_socache_shmcb$secondaryArchSuffix
	lib:mod_speling$secondaryArchSuffix
	lib:mod_ssl$secondaryArchSuffix
	lib:mod_status$secondaryArchSuffix
	lib:mod_substitute$secondaryArchSuffix
	lib:mod_unique_id$secondaryArchSuffix
	lib:mod_unixd$secondaryArchSuffix
	lib:mod_userdir$secondaryArchSuffix
	lib:mod_version$secondaryArchSuffix
	lib:mod_vhost_alias$secondaryArchSuffix
	lib:mod_watchdog$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libapr_1$secondaryArchSuffix
	lib:libaprutil_1$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libexpat$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
#	lib:libldap$secondaryArchSuffix
	lib:libpcre$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
"

GLOBAL_WRITABLE_FILES="
	settings/extra/httpd-autoindex.conf keep-old
	settings/extra/httpd-dav.conf keep-old
	settings/extra/httpd-default.conf keep-old
	settings/extra/httpd-info.conf keep-old
	settings/extra/httpd-languages.conf keep-old
	settings/extra/httpd-manual.conf keep-old
	settings/extra/httpd-mpm.conf keep-old
	settings/extra/httpd-multilang-errordoc.conf keep-old
	settings/extra/httpd-ssl.conf keep-old
	settings/extra/httpd-userdir.conf keep-old
	settings/extra/httpd-vhosts.conf keep-old
	settings/extra/proxy-html.conf keep-old
	settings/httpd.conf keep-old
	settings/magic keep-old
	settings/mime.types keep-old
	settings/original/extra/httpd-autoindex.conf keep-old
	settings/original/extra/httpd-dav.conf keep-old
	settings/original/extra/httpd-default.conf keep-old
	settings/original/extra/httpd-info.conf keep-old
	settings/original/extra/httpd-languages.conf keep-old
	settings/original/extra/httpd-manual.conf keep-old
	settings/original/extra/httpd-mpm.conf keep-old
	settings/original/extra/httpd-multilang-errordoc.conf keep-old
	settings/original/extra/httpd-ssl.conf keep-old
	settings/original/extra/httpd-userdir.conf keep-old
	settings/original/extra/httpd-vhosts.conf keep-old
	settings/original/extra/proxy-html.conf keep-old
	settings/original/httpd.conf keep-old
"

BUILD_REQUIRES="
	devel:libapr_1$secondaryArchSuffix
	devel:libaprutil_1$secondaryArchSuffix
	devel:libcrypto$secondaryArchSuffix
	devel:libexpat$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
#	devel:libldap$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:autoconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:pcre_config
	"

BUILD()
{
	libtoolize --force --copy --install
	aclocal
	autoconf

	runConfigure ./configure \
		--with-apr=/$relativeBinDir \
		--with-apr-util=/$relativeBinDir
	make $jobArgs
}

INSTALL()
{
	make install
}
