SUMMARY="An implementation of iCalendar protocols and data formats"
DESCRIPTION="Libical is an Open Source implementation of the iCalendar \
protocols and protocol data units. The iCalendar specification describes how \
calendar clients can communicate with calendar servers so users can store \
their calendar data and arrange meetings with other users."
HOMEPAGE="http://libical.github.io/libical/"
COPYRIGHT="1999-2015 Eric Busboom"
LICENSE="MPL v1.0
	GNU LGPL v2.1"
REVISION="4"
SOURCE_URI="https://github.com/libical/libical/releases/download/v$portVersion/libical-$portVersion.tar.gz"
CHECKSUM_SHA256="654c11f759c19237be39f6ad401d917e5a05f36f1736385ed958e60cf21456da"
PATCHES="libical-$portVersion.patchset"

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

PROVIDES="
	libical$secondaryArchSuffix = $portVersion compat >= 2
	lib:libical$secondaryArchSuffix = $portVersion compat >= 2
	lib:libical_cxx$secondaryArchSuffix = $portVersion compat >= 2
	lib:libicalss$secondaryArchSuffix = $portVersion compat >= 2
	lib:libicalss_cxx$secondaryArchSuffix = $portVersion compat >= 2
	lib:libicalvcal$secondaryArchSuffix = $portVersion compat >= 2
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libicui18n$secondaryArchSuffix >= 66
	lib:libicuuc$secondaryArchSuffix >= 66
	"

PROVIDES_devel="
	libical${secondaryArchSuffix}_devel = $portVersion compat >= 2
	devel:libical$secondaryArchSuffix = $portVersion compat >= 2
	devel:libical_cxx$secondaryArchSuffix = $portVersion compat >= 2
	devel:libicalss$secondaryArchSuffix = $portVersion compat >= 2
	devel:libicalss_cxx$secondaryArchSuffix = $portVersion compat >= 2
	devel:libicalvcal$secondaryArchSuffix = $portVersion compat >= 2
	"
REQUIRES_devel="
	libical$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libicui18n$secondaryArchSuffix >= 66
	devel:libicuuc$secondaryArchSuffix >= 66
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:perl
	"

BUILD()
{
	cmake . \
		-DCMAKE_INSTALL_PREFIX=$prefix \
		-DCMAKE_INSTALL_LIBDIR=$libDir \
		-DCMAKE_INSTALL_INCLUDEDIR=$incDir \
		-DCMAKE_INSTALL_DATAROOTDIR=$dataDir \
 		-DUSE_BUILTIN_TZDATA=true
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs \
		libical \
		libical_cxx \
		libicalss \
		libicalss_cxx \
		libicalvcal
	fixPkgconfig

	packageEntries devel \
		$developDir \
		$libDir/cmake
}

TEST()
{
	make test
}
