SUMMARY="The free WPG library, converter and viewer"
DESCRIPTION="
	libwpg project is a collection of library and tools to work with graphics \
	in WPG (WordPerfect Graphics) format.
	"
HOMEPAGE="http://libwpg.sourceforge.net"
SOURCE_URI="http://downloads.sourceforge.net/project/libwpg/libwpg/libwpg-0.2.2/libwpg-0.2.2.tar.gz"
LICENSE="
	MPL v2.0
	GNU LGPL v2.1
	"
COPYRIGHT="
	Marc Oude Kotte
	Marc Maurer
	Ariya Hidayat
	Fridrich Strba
	"
REVISION="2"
CHECKSUM_SHA256="d5260dd46a9f2bb8ace90379b8afc47fe78f26048bb32abb982b900ef2fb2aa3"

ARCHITECTURES="x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	$portName$secondaryArchSuffix = $portVersion
	cmd:wpg2raw$secondaryArchSuffix
	cmd:wpg2svg$secondaryArchSuffix
	cmd:wpg2svgbatch.pl$secondaryArchSuffix
	lib:libwpg_0.2$secondaryArchSuffix = 2.0.2 compat >= 2
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libwpd_0.9$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"
BUILD_REQUIRES="
	devel:libwpd_0.9$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	pkgconfig$secondaryArchSuffix >= 0.27
	cmd:aclocal
	cmd:libtoolize
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

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

INSTALL()
{
	make install

	prepareInstalledDevelLibs libwpg-0.2
	fixPkgconfig

	packageEntries devel $developDir
}

PROVIDES_devel="
	libwpg${secondaryArchSuffix}_devel = $portVersion
	devel:libwpg_0.2$secondaryArchSuffix = 2.0.2 compat >= 2
	"
REQUIRES_devel="
	$portName$secondaryArchSuffix == $portVersion base
	"
