SUMMARY="Tool to convert (compressed) UIF images created by MagicISO"
DESCRIPTION="UIF2ISO is a command-line tool for converting single and \
multipart UIF images to the original ISO format.
The Universal Image Format (UIF), which is a compressed CD/DVD image format, \
was created in 2006 by the authors of MagicISO. Although later versions of \
MagicISO have tried to obfuscate the UIF format by using encryption, UIF2ISO \
is still able to convert these images."
HOMEPAGE="http://aluigi.org/mytoolz.htm#uif2iso"
COPYRIGHT="2007-2009 Luigi Auriemma"
LICENSE="GNU GPL v2"
REVISION="4"
SOURCE_URI="http://aluigi.altervista.org/mytoolz/uif2iso.zip"
CHECKSUM_SHA256="b78dde3e8bc28559f73e2feb46d41c8f57b511ddbe25d63ada704ef8697528ec"
SOURCE_FILENAME="uif2iso-$portVersion.zip"
SOURCE_DIR=""
SOURCE_URI_2="http://httpredir.debian.org/debian/pool/main/u/uif2iso/uif2iso_0.1.7a-1.diff.gz#noarchive"
CHECKSUM_SHA256_2="60e91e4a3c7b64d18a144b0e2bc0499c1ab10db3676c099725aca820ff429594"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

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

PROVIDES="
	uif2iso$secondaryArchSuffix = $portVersion
	cmd:uif2iso$commandSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:install
	cmd:make
	cmd:patch
	cmd:zcat
	"

BUILD()
{
	cd src
	make CFLAGS="-DNOLFS -O2 -s"
}

INSTALL()
{
	make -C src install prefix="$prefix" bindir="$commandBinDir"
	install -d -m 755 $docDir $manDir/man1
	install -t $docDir -c -m 444 uif2iso.txt README
	zcat $sourceDir2/uif2iso_0.1.7a-1.diff.gz | patch -p1
	install -t $manDir/man1 -c -m 444 debian/uif2iso.1
}
