SUMMARY="Parses the file format of QuarkXPress"
DESCRIPTION="libqxp is a library that parses the file format of QuarkXPress \
documents. Currently it only understands documents created by QuarkXPress \
3.1 to 4.1."
HOMEPAGE="https://wiki.documentfoundation.org/DLP/Libraries/libqxp"
COPYRIGHT="2017-2018 David Tardon, Aleksas Pantechovski"
LICENSE="MPL v2.0"
REVISION="3"
SOURCE_URI="http://dev-www.libreoffice.org/src/libqxp/libqxp-$portVersion.tar.xz"
CHECKSUM_SHA256="e137b6b110120a52c98edd02ebdc4095ee08d0d5295a94316a981750095a945c"

ARCHITECTURES="all ?x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

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

libVersion=0.0.2
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	libqxp$secondaryArchSuffix = $portVersion
	lib:libqxp_0.0$secondaryArchSuffix = $libVersionCompat
	cmd:qxp2raw$commandSuffix = $portVersion
	cmd:qxp2svg$commandSuffix = $portVersion
	cmd:qxp2text$commandSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	icu66$secondaryArchSuffix
	lib:libboost_system$secondaryArchSuffix
	lib:librevenge_0.0$secondaryArchSuffix
	"

PROVIDES_devel="
	libqxp${secondaryArchSuffix}_devel = $portVersion
	devel:libqxp_0.0$secondaryArchSuffix = $libVersion
	"
REQUIRES_devel="
	libqxp$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	icu66${secondaryArchSuffix}_devel
	devel:libboost_system$secondaryArchSuffix >= 1.69.0
	devel:libcppunit$secondaryArchSuffix
	devel:librevenge_0.0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:cmp
	cmd:diff
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libqxp$secondaryArchSuffix \
	$libDir/libqxp-0.0.so.$libVersion

BUILD()
{
	runConfigure --omit-dirs binDir ./configure --bindir=$commandBinDir \
		--without-docs
	make $jobArgs
}

INSTALL()
{
	make install

	rm -f $libDir/*.la

	prepareInstalledDevelLib libqxp-0.0
	fixPkgconfig

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
