SUMMARY="A calendar and scheduling application for the command line"
DESCRIPTION="calcurse is a calendar and scheduling application for the \
command line. It helps keep track of events, appointments and everyday tasks. \
A configurable notification system reminds user of upcoming deadlines, the \
curses based interface can be customized to suit user needs and a very \
powerful set of command line options can be used to filter and format \
appointments, making it suitable for use in scripts."
HOMEPAGE="https://calcurse.org/"
COPYRIGHT="2005-2017 calcurse Development Team"
LICENSE="BSD (2-clause)"
REVISION="2"
SOURCE_URI="http://calcurse.org/files/calcurse-$portVersion.tar.gz"
CHECKSUM_SHA256="c372ef16abcacb33a1aca99d0d4eba7c5cc8121fa96360f9d6edc0506e655cee"
PATCHES="calcurse-$portVersion.patchset"

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

if [ "$targetArchitecture" != x86_gcc2 ]
then
	commandBinDir=$binDir
	commandSuffix=$secondaryArchSuffix
else
	commandBinDir=$prefix/bin
	commandSuffix=
fi

PROVIDES="
	calcurse$secondaryArchSuffix = $portVersion
	cmd:calcurse$commandSuffix
	cmd:calcurse_caldav$commandSuffix
	cmd:calcurse_upgrade$commandSuffix
	cmd:calcurse_vdir$commandSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libncursesw$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libncursesw$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:autopoint
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	autoreconf -vfi
	# define _BSD_SOURCE for /boot/system/develop/headers/bsd/paths.h
	CFLAGS="-D_BSD_SOURCE" runConfigure --omit-dirs binDir ./configure \
		--bindir=$commandBinDir
	make $jobArgs
}

INSTALL()
{
	make install
}

TEST()
{
	make check
}
