SUMMARY="A library to handle Apple Property Lists in binary or XML"
DESCRIPTION="libplist is a library for reading and writing the Apple binary \
and XML property list format. It is part of the libimobiledevice stack \
providing access to iDevices."
HOMEPAGE="http://www.libimobiledevice.org/"
COPYRIGHT="2008-2010 Jonathan Beck
	2009-2014 Nikias Bassen
	2009-2014 Martin Szulecki
	2008 Matt Colyer"
LICENSE="GNU GPL v2
	GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://github.com/libimobiledevice/libplist/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="7e654bdd5d8b96f03240227ed09057377f06ebad08e1c37d0cfa2abe6ba0cee2"
SOURCE_FILENAME="libplist-$portVersion.tar.gz"

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

PROVIDES="
	libplist$secondaryArchSuffix = $portVersion compat >= 1
	lib:libplist_2.0$secondaryArchSuffix = 3.3.0 compat >= 3
	lib:libplist++_2.0$secondaryArchSuffix = 3.3.0 compat >= 3
	"
if [ -z "$secondaryArchSuffix" ]; then
	PROVIDES="$PROVIDES
		cmd:plistutil = $portVersion compat >= 1
		"
fi

REQUIRES="
	haiku$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	libplist${secondaryArchSuffix}_devel = $portVersion compat >= 1
	devel:libplist_2.0$secondaryArchSuffix = 3.3.0 compat >= 3
	devel:libplist++_2.0$secondaryArchSuffix = 3.3.0 compat >= 3
	"
REQUIRES_devel="
	libplist$secondaryArchSuffix == $portVersion base
	devel:libxml2$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libxml2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:python3
	cmd:which
	"

BUILD()
{
	if [ -n "$secondaryArchSuffix" ]; then
		maybe_without_cython=--without-cython
	else
		maybe_without_cython=
	fi

	autoreconf -fi
	runConfigure ./configure $maybe_without_cython

	make $jobArgs
}

INSTALL()
{
	make install

	# remove libtool files
	rm $libDir/lib*.la $libDir/lib*.a

	if [ -n "$secondaryArchSuffix" ]; then
		rm -rf $binDir
	fi

	prepareInstalledDevelLibs libplist-2.0 libplist++-2.0
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir \

}

TEST()
{
	make check
}
