SUMMARY="Apple's fsx and fstorture programs"
DESCRIPTION="Apple's fsx and fstorture programs. They are very good at finding\
 issues with various system calls and in particular overlapping reads/writes."
HOMEPAGE="https://github.com/thedrgreenthumb/fstools/"
COPYRIGHT="1998 Christian Starkjohann
	1998-2001, 2009 Apple Inc.
	"
LICENSE="
	GNU GPL v2
	APSL v2
	"
REVISION="2"
srcGitRev="d8fd8ae20a0d3bfe4695b0a6e0a6b45a456eb15b"
SOURCE_URI="https://github.com/thedrgreenthumb/fstools/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="d50cfdfc7d15d39dc9dde3ccf5cafb74f4667f58d995159607528e5cb0123967"
SOURCE_DIR="fstools-$srcGitRev"
PATCHES="fstools-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
if [ "$targetArchitecture" = x86_gcc2 ]; then
SECONDARY_ARCHITECTURES="x86"
fi

# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandBinDir=$prefix/bin
fi

PROVIDES="
	fstools$secondaryArchSuffix = $portVersion
	cmd:fstorture = $portVersion
	cmd:fsx = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libuuid$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libuuid$secondaryArchSuffix >= 1.3
	"
BUILD_PREREQUIRES="
	makefile_engine
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	cd src/fstorture
	make $jobArgs
	cd ../fsx
	make $jobArgs
}

INSTALL()
{
	mkdir -p $commandBinDir
	cd src/fstorture
	cp fstorture $commandBinDir/
	cd ../fsx
	cp objects*/fsx $commandBinDir/
}
