SUMMARY="Microsoft Publisher import library"
DESCRIPTION="libmspub is a library that parses the file format of Microsoft \
Publisher documents of all versions."
HOMEPAGE="https://wiki.documentfoundation.org/DLP/Libraries/libmspub"
COPYRIGHT="2012-2013 Brennan Vincent
	2012-2018 David Tardon
	2012-2014, 2017 Fridrich Štrba
	2013 Franz Schmid"
LICENSE="MPL v2.0"
REVISION="3"
SOURCE_URI="https://dev-www.libreoffice.org/src/libmspub/libmspub-$portVersion.tar.xz"
CHECKSUM_SHA256="ef36c1a1aabb2ba3b0bedaaafe717bf4480be2ba8de6f3894be5fd3702b013ba"

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

libVersion="1.0.4"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
portVers="${portVersion%.*}"
portVersionCompat="$portVersion compat >= $portVers"

PROVIDES="
	libmspub$secondaryArchSuffix = $portVersionCompat
	cmd:pub2raw$secondaryArchSuffix = $portVersionCompat
	cmd:pub2xhtml$secondaryArchSuffix = $portVersionCompat
	lib:libmspub_$portVers$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libboost_system$secondaryArchSuffix
	lib:libicudata$secondaryArchSuffix >= 66
	lib:libicui18n$secondaryArchSuffix >= 66
	lib:libicuuc$secondaryArchSuffix >= 66
	lib:librevenge_0.0$secondaryArchSuffix
	lib:librevenge_generators_0.0$secondaryArchSuffix
	lib:librevenge_stream_0.0$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	libmspub${secondaryArchSuffix}_devel = $portVersionCompat
	devel:libmspub_$portVers$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libmspub$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_system$secondaryArchSuffix >= 1.69.0
	devel:libicudata$secondaryArchSuffix >= 66
	devel:libicui18n$secondaryArchSuffix >= 66
	devel:libicuuc$secondaryArchSuffix >= 66
	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:automake
	cmd:autoreconf
	cmd:g++$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libmspub$secondaryArchSuffix \
	"$binDir"/pub2raw \
	"$binDir"/pub2xhtml \
	"$libDir"/libmspub-$portVers.so.$libVersion

BUILD()
{
	autoreconf -fi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm -f "$libDir"/libmspub*.la

	prepareInstalledDevelLib libmspub-$portVers
	fixPkgconfig

	packageEntries devel $developDir
}
