# Template file for 'davmail'
pkgname=davmail
version=4.8.2
revision=1
_build=2524
only_for_archs="i686 x86_64"
wrksrc="${pkgname}-src-${version}-${_build}"
hostmakedepends="openjdk apache-ant"
short_desc="DavMail is a POP/IMAP/SMTP/Caldav/Carddav/LDAP exchange gateway"
maintainer="Anachron <Anachron14@gmx.de>"
license="GPL-2"
homepage="http://davmail.sourceforge.net"
distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}-src-${version}-${_build}.tgz"
checksum=672c7bcf62d0ed710dcaf89cd1b858a94d73959bfc80c708c3e308d4a8a299f0

do_build() {
	ant
}

do_install() {
	case $XBPS_TARGET_MACHINE in
		i686) _arch="x86";;
		x86_64) _arch="x86_64";;
	esac
	_src="dist/$pkgname-linux-${_arch}-${version}-trunk.tgz"

	mkdir -p install
	tar -xzf "${_src}" -C install

	find install -type f -name \*.exe -delete
	vmkdir usr/share/$pkgname
	mv install/$pkgname-linux-${_arch}-${version}/* "${DESTDIR}"/usr/share/$pkgname

	vmkdir usr/bin
	ln -s ../share/$pkgname/$pkgname.sh "${DESTDIR}"/usr/bin/$pkgname
}
