SUMMARY=" The G Structured File Library"
DESCRIPTION=" The project aims to provide an efficient extensible i/o abstraction for \
dealing with different structured file formats."
HOMEPAGE="https://github.com/GNOME/libgsf"
COPYRIGHT="2002-2020 Jody Goldberg"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://github.com/GNOME/libgsf/archive/LIBGSF_1_14_47.tar.gz"
CHECKSUM_SHA256="ca958db8b91113804e1c8ec772adb7cb3e44f81d404cf941330d47f3e25ccbe7"
SOURCE_FILENAME="libgsf-$portVersion.tar.gz"
SOURCE_DIR="libgsf-LIBGSF_1_14_47"

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

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

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

PROVIDES="
	libgsf$secondaryArchSuffix = $portVersion
	lib:libgsf_1$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libgio_2.0$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libgobject_2.0$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	libgsf${secondaryArchSuffix}_devel
	devel:libgsf_1$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	haiku${secondaryArchSuffix}_devel
	libgsf$secondaryArchSuffix == $portVersion base
	"

PROVIDES_tools="
	libgsf${secondaryArchSuffix}_tools
	cmd:gsf_office_thumbnailer$commandSuffix = $portVersion
	cmd:gsf_vba_dump$commandSuffix = $portVersion
	cmd:gsf$commandSuffix = $portVersion
	"
REQUIRES_tools="
	libgsf$secondaryArchSuffix == $portVersion base
	haiku$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libgio_2.0$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libgobject_2.0$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libbz2$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:gcc$secondaryArchSuffix
	cmd:gtkdocize
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

TEST_REQUIRES="
	xml_parser
	"

defineDebugInfoPackage libgsf$secondaryArchSuffix \
	$libDir/libgsf-1.so.$libVersion

BUILD()
{
	NOCONFIGURE=1 ./autogen.sh
	runConfigure --omit-dirs binDir ./configure \
		--bindir=$commandBinDir
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/*.la

	prepareInstalledDevelLib libgsf-1
	fixPkgconfig

	packageEntries devel \
		$developDir
	packageEntries tools \
		$commandBinDir \
		$dataDir/thumbnailers \
		$manDir
}

TEST()
{
	make check
}
