SUMMARY="A Corel Draw import library"
DESCRIPTION="libcdr is a library that parses the file format of CorelDRAW \
documents of all versions."
HOMEPAGE="https://wiki.documentfoundation.org/DLP/Libraries/libcdr"
COPYRIGHT="Fridrich Strba, David Tardon"
LICENSE="MPL v2.0"
REVISION="1"
SOURCE_URI="http://dev-www.libreoffice.org/src/libcdr/libcdr-$portVersion.tar.bz2"
CHECKSUM_SHA256="ae613caeb7e0e539cbc1b08ea5169bddaed8d2021d25ef66b39ddc0aa72c2902"

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

PROVIDES="
	libcdr$secondaryArchSuffix = $portVersion
	cmd:cdr2raw$secondaryArchSuffix
	cmd:cdr2text$secondaryArchSuffix
	cmd:cdr2xhtml$secondaryArchSuffix
	cmd:cmx2raw$secondaryArchSuffix
	cmd:cmx2text$secondaryArchSuffix
	cmd:cmx2xhtml$secondaryArchSuffix
	lib:libcdr_0.1$secondaryArchSuffix = 1.0.7 compat >= 1
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libicudata$secondaryArchSuffix
	lib:libicui18n$secondaryArchSuffix
	lib:libicuuc$secondaryArchSuffix
	lib:liblcms2$secondaryArchSuffix
	lib:librevenge_0.0$secondaryArchSuffix
	lib:librevenge_generators_0.0$secondaryArchSuffix
	lib:librevenge_stream_0.0$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	libcdr${secondaryArchSuffix}_devel = $portVersion
	devel:libcdr_0.1$secondaryArchSuffix = 1.0.7 compat >= 1
	"
REQUIRES_devel="
	libcdr$secondaryArchSuffix == $portVersion base
	devel:liblcms2$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_system$secondaryArchSuffix
	devel:libcppunit$secondaryArchSuffix
	devel:libicui18n$secondaryArchSuffix >= 66
	devel:liblcms2$secondaryArchSuffix
	devel:librevenge_0.0$secondaryArchSuffix
	devel:librevenge_generators_0.0$secondaryArchSuffix
	devel:librevenge_stream_0.0$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:autoheader
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:icu_config$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	libtoolize --force --copy --install
	aclocal
	autoheader
	automake -a -c --foreign
	autoconf
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libcdr-0.1.la

	prepareInstalledDevelLibs libcdr-0.1
	fixPkgconfig

	packageEntries devel $developDir
}

TEST()
{
	make check
}
