SUMMARY="An open source IMAP and POP3 email server"
DESCRIPTION="Dovecot is an open source IMAP and POP3 email server \
for Linux/UNIX-like systems, written with security primarily in mind. \
Dovecot is an excellent choice for both small and large installations. \
It's fast, simple to set up, requires no special administration and it \
uses very little memory."
HOMEPAGE="https://dovecot.org/"
COPYRIGHT="2002-2016 Timo Sirainen"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://dovecot.org/releases/2.3/dovecot-$portVersion.tar.gz"
CHECKSUM_SHA256="d3d9ea9010277f57eb5b9f4166a5d2ba539b172bd6d5a2b2529a6db524baafdc"
PATCHES="dovecot-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

GLOBAL_WRITABLE_FILES="
	settings/dovecot/README auto-merge
	"
USER_SETTINGS_FILES="
	settings/dovecot directory manual
	"

PROVIDES="
	dovecot$secondaryArchSuffix = $portVersion
	cmd:doveadm$secondaryArchSuffix = $portVersion
	cmd:doveconf$secondaryArchSuffix = $portVersion
	cmd:dovecot$secondaryArchSuffix = $portVersion
	cmd:dovecot_sysreport$secondaryArchSuffix = $portVersion
	cmd:dsync$secondaryArchSuffix = $portVersion
	lib:libdovecot$secondaryArchSuffix = 0.0.0
	lib:libdovecot_storage$secondaryArchSuffix = 0.0.0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libiconv$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:autoreconf
	cmd:awk
	cmd:diff
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:gettext
	cmd:ld$secondaryArchSuffix
	cmd:libtool$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	export LDFLAGS="-lnetwork"
	autoreconf -fi
	CFLAGS=-D_BSD_SOURCE runConfigure ./configure \
		--libexecdir=$libDir/libexec --with-ssl=openssl \
		--disable-hardening
	make
}

INSTALL()
{
	make install
}
