SUMMARY="Programs to create, check and label file systems of the FAT family"
DESCRIPTION="mkfs, checkfs, and fatlabel for FAT partitions."
HOMEPAGE="https://github.com/dosfstools/dosfstools"
COPYRIGHT="1991 Linus Torvalds
1992-1993 Remy Card
1993-1994 David Hudson
1999-2005 Roman Hodek
1999-2005 Werner Almesberger
1999-2005 Roman Hodek
2008-2014 Daniel Baumann
2015-2016 Andreas Bombe"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/dosfstools/dosfstools/releases/download/v$portVersion/dosfstools-$portVersion.tar.xz"
CHECKSUM_SHA256="e6b2aca70ccc3fe3687365009dd94a2e18e82b688ed4e260e04b7412471cc173"

ARCHITECTURES="all !x86_gcc2 ?x86 !ppc !m68k"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	dosfstools$secondaryArchSuffix = $portVersion
	cmd:fatlabel
	cmd:fsck.fat
	cmd:mkfs.fat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libiconv$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	# FIXME only works for little-endian architectures
	export CFLAGS="-Dhtole32\(x\)=x -Dhtole16\(x\)=x -Dle32toh\(x\)=x -Dle16toh\(x\)=x"
	export LDFLAGS=-liconv
	runConfigure --omit-dirs binDir,sbinDir ./configure --bindir=$prefix/bin --sbindir=$prefix/bin
	make $jobArgs
}

INSTALL()
{
	make install
}
