SUMMARY="ISO 9660 Rock Ridge Filesystem Manipulator"
DESCRIPTION="xorriso is a program which copies file objects from POSIX \
compliant filesystems into Rock Ridge enhanced ISO 9660 filesystems and \
allows session-wise manipulation of such filesystems. It can load the \
management information of existing ISO images and it writes the session \
results to optical media or to filesystem objects.
Vice versa xorriso is able to restore file objects from ISO 9660 filesystems."
HOMEPAGE="https://www.gnu.org/software/xorriso/"
COPYRIGHT="2007-2019 Thomas Schmitt libburnia project"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://www.gnu.org/software/xorriso/xorriso-${portVersion/\~/.}.tar.gz"
CHECKSUM_SHA256="3ec7393d4a9dcbf5f74309c28a415f55227ec62770b95ae993ac8d7a3b152972"
SOURCE_DIR="xorriso-${portVersion/\~pl02/}"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

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

PROVIDES="
	xorriso$secondaryArchSuffix = $portVersion
	cmd:osirrox$commandSuffix
	cmd:xorrecord$commandSuffix
	cmd:xorriso$commandSuffix
	cmd:xorrisofs$commandSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libedit$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libbz2$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libedit$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoheader
	cmd:automake
	cmd:autoreconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:makeinfo
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	export LIBS="-lbsd"
	autoreconf -vfi
	runConfigure --omit-dirs binDir ./configure --bindir=$commandBinDir
	make $jobArgs
}

INSTALL()
{
	make install

	# remove useless tool xorriso_tcltk (needs tk which doesn't work)
	rm $commandBinDir/xorriso-tcltk
}

TEST()
{
	make check
}
