SUMMARY="Utilities to access MS-DOS disks without mounting"
DESCRIPTION="Mtools is a collection of utilities to access MS-DOS disks from \
GNU and Unix without mounting them. It supports Win'95 style long file names, \
OS/2 Xdf disks and 2m disks (store up to 1992k on a high density 3 1/2 disk). \
In addition to file access, it supports many FAT-specific features: volume \
labels, FAT-specific file attributes (hidden, system, ...), \"bad block\" map \
maintenance, access to remote floppy drives, Iomega ZIP disk protection, \
\"secure\" erase, display of file's on-disk layout, etc."
HOMEPAGE="https://www.gnu.org/software/mtools/"
COPYRIGHT="1997-2018 Alain Knaff"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://ftpmirror.gnu.org/mtools/mtools-$portVersion.tar.lz
	https://ftp.gnu.org/gnu/mtools/mtools-$portVersion.tar.lz"
CHECKSUM_SHA256="d09cff66d7277ad36a7573fc3e9803bfa558cdda83baabaafbf7761317462283"

ARCHITECTURES="all"

GLOBAL_WRITABLE_FILES="
	settings/mtools.conf auto-merge
	"

PROVIDES="
	mtools = $portVersion
	cmd:amuFormat.sh
	cmd:lz
	cmd:mattrib
	cmd:mbadblocks
	cmd:mcat
	cmd:mcd
	cmd:mcheck
	cmd:mclasserase
	cmd:mcomp
	cmd:mcopy
	cmd:mdel
	cmd:mdeltree
	cmd:mdir
	cmd:mdu
	cmd:mformat
	cmd:minfo
	cmd:mkmanifest
	cmd:mlabel
	cmd:mmd
	cmd:mmount
	cmd:mmove
	cmd:mpartition
	cmd:mrd
	cmd:mren
	cmd:mshortname
	cmd:mshowfat
	cmd:mtools
	cmd:mtoolstest
	cmd:mtype
	cmd:mxtar
	cmd:mzip
	cmd:tgz
	cmd:uz
	"
REQUIRES="
	haiku
	"

BUILD_REQUIRES="
	haiku_devel
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc
	cmd:make
	"

defineDebugInfoPackage mtools \
	"$binDir"/mkmanifest \
	"$binDir"/mtools \


BUILD()
{
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install
	install -m 644 mtools.conf "$settingsDir"
	sed -i \
		-e "s|$sysconfDir/|`finddir B_SYSTEM_SETTINGS_DIRECTORY`/|g;" \
		"$manDir"/man1/mtools.1 \
		"$manDir"/man5/mtools.5 \

	sed -i -e "s/^SAMPLE FILE/#&/;" "$settingsDir"/mtools.conf
}
