SUMMARY="EPUB generator for librevenge"
DESCRIPTION="libepubgen is an EPUB generator for librevenge. It supports \
librevenge's text document interface and--currently in a very limited \
way--presentation and vector drawing interfaces."
HOMEPAGE="https://sourceforge.net/projects/libepubgen/"
COPYRIGHT="2014-2018 David Tardon"
LICENSE="MPL v2.0"
REVISION="2"
SOURCE_URI="https://downloads.sourceforge.net/libepubgen/libepubgen-$portVersion.tar.xz"
CHECKSUM_SHA256="03e084b994cbeffc8c3dd13303b2cb805f44d8f2c3b79f7690d7e3fc7f6215ad"

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

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

PROVIDES="
	libepubgen$secondaryArchSuffix = $portVersion
	lib:libepubgen_$portVers$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libboost_system$secondaryArchSuffix
	lib:librevenge_0.0$secondaryArchSuffix
	lib:librevenge_generators_0.0$secondaryArchSuffix
	lib:librevenge_stream_0.0$secondaryArchSuffix
	"

PROVIDES_devel="
	libepubgen${secondaryArchSuffix}_devel = $portVersion
	devel:libepubgen_$portVers$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libepubgen$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_system$secondaryArchSuffix >= 1.69.0
	devel:libcppunit$secondaryArchSuffix
	devel:librevenge_0.0$secondaryArchSuffix
	devel:librevenge_generators_0.0$secondaryArchSuffix
	devel:librevenge_stream_0.0$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:autoheader
	cmd:automake
	cmd:awk
	cmd:diff
	cmd:g++$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libepubgen$secondaryArchSuffix \
	"$libDir"/libepubgen-$portVers.so.$libVersion

BUILD()
{
	autoreconf -fi
	runConfigure ./configure --without-docs --disable-werror
	make $jobArgs
}

INSTALL()
{
	make install

	rm -f "$libDir"/libepubgen-$portVers.la

	prepareInstalledDevelLib libepubgen-$portVers
	fixPkgconfig
	packageEntries devel $developDir
}

TEST()
{
	make check
}
