SUMMARY="An ODF export library"
DESCRIPTION="libodfgen is an ODF export library for projects using librevenge."
HOMEPAGE="https://sourceforge.net/p/libwpd/wiki/libodfgen/"
COPYRIGHT="2004-2015 Fridrich Strba
	2011-2018 Laurent Alonso
	2013-2018 David Tardon"
LICENSE="MPL v2.0
	GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://downloads.sourceforge.net/libwpd/libodfgen-$portVersion.tar.xz"
CHECKSUM_SHA256="323e491f956c8ca2abb12c998e350670930a32317bf9662b0615dd4b3922b831"

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

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

PROVIDES="
	libodfgen$secondaryArchSuffix = $portVersion
	lib:libodfgen_$portVers$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:librevenge_0.0$secondaryArchSuffix
	lib:librevenge_generators_0.0$secondaryArchSuffix
	lib:librevenge_stream_0.0$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	libodfgen${secondaryArchSuffix}_devel = $portVersion
	devel:libodfgen_$portVers$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libodfgen$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	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:automake
	cmd:autoheader
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

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

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

INSTALL()
{
	make install

	rm -f "$libDir"/libodfgen-$portVers.la
	prepareInstalledDevelLib libodfgen-$portVers
	fixPkgconfig

	packageEntries devel $developDir
}

TEST()
{
	make check
}
