SUMMARY="Copy data between file or block devices with read-error recovery"
DESCRIPTION="GNU ddrescue is a data recovery tool. It copies data from one \
file or block device (hard disc, cdrom, etc) to another, trying to rescue the \
good parts first in case of read errors."
HOMEPAGE="http://www.gnu.org/software/ddrescue/"
SOURCE_URI="http://ftpmirror.gnu.org/ddrescue/ddrescue-1.19.tar.lz"
CHECKSUM_SHA256="ed8d0c9d9aac80a9110e9cb0d0a91a7390d3bf9f816b67a62ca4eb140f4747b8"
REVISION="1"
COPYRIGHT="
	2004-2014 Antonio Diaz Diaz
	"
LICENSE="GNU GPL v2"

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="
	ddrescue$secondaryArchSuffix = $portVersion
	cmd:ddrescue = $portVersion
	cmd:ddrescuelog = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:lzip
	cmd:make
	cmd:gcc$secondaryArchSuffix
	"

PATCHES="ddrescue-1.19.patchset"

BUILD()
{
	./configure --prefix=$prefix \
		--bindir=$commandBinDir \
		--datarootdir=$dataRootDir \
		--infodir=$infoDir \
		--mandir=$manDir
	make $jobArgs
}

INSTALL()
{
	make install
}

TEST()
{
	make check
}
