SUMMARY="Easily extensible archiver"
DESCRIPTION="The XAR project aims to provide an easily extensible archive \
format. Important design decisions include an easily extensible XML table of \
contents for random access to archived files, storing the toc at the \
beginning of the archive to allow for efficient handling of streamed \
archives, the ability to handle files of arbitrarily large sizes, the ability \
to choose independent encodings for individual files in the archive, the \
ability to store checksums for individual files in both compressed and \
uncompressed form, and the ability to query the table of content's rich \
meta-data."
HOMEPAGE="https://mackyle.github.io/xar/"
COPYRIGHT="2005 Rob Braun"
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://github.com/downloads/mackyle/xar/xar-$portVersion.tar.gz"
CHECKSUM_SHA256="ee46089968457cf710b8cf1bdeb98b7ef232eb8a4cdeb34502e1f16ef4d2153e"
PATCHES="xar-$portVersion.patchset"

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

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

PROVIDES="
	xar$secondaryArchSuffix = $portVersion compat = 1.5.2
	cmd:xar$commandSuffix = $portVersion compat = 1.5.2
	lib:libxar$secondaryArchSuffix = $portVersion compat = 1.5.2
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:liblzma$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	xar${secondaryArchSuffix}_devel = $portVersion compat = 1.5.2
	devel:libxar$secondaryArchSuffix = $portVersion compat = 1.5.2
	"
REQUIRES_devel="
	xar$secondaryArchSuffix == $portVersion
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libbz2$secondaryArchSuffix
	devel:libcrypto$secondaryArchSuffix
	devel:liblzma$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	libtoolize --force --copy --install
	aclocal
	autoconf
	runConfigure --omit-dirs binDir ./configure --bindir=$commandBinDir
	make
}

INSTALL()
{
	make install

	# remove libtool file
	rm $libDir/libxar.la

	prepareInstalledDevelLib libxar

	packageEntries devel \
	$developDir
}
