SUMMARY="KDiff3 is a diff and merge program"
DESCRIPTION="
KDiff3 is a diff and merge program that:
* compares or merges two or three text input files or directories,
* shows the differences line by line and character by character (!),
* provides an automatic merge-facility and
* an integrated editor for comfortable solving of merge-conflicts,
* supports Unicode, UTF-8 and other codecs, autodetection via byte-order-mark \
'BOM'
* supports KIO on KDE (allows accessing ftp, sftp, fish, smb etc.),
* Printing of differences,
* Manual alignment of lines,
* Automatic merging of version control history ($Log$),
* and has an intuitive graphical user interface.
"
HOMEPAGE="http://kdiff3.sourceforge.net/"
SRC_URI="http://sourceforge.net/projects/kdiff3/files/kdiff3/0.9.97/kdiff3-0.9.97.tar.gz"
CHECKSUM_MD5="30a71b474956c369ed7b38c6db080fc4"
COPYRIGHT="2002-2012 by Joachim Eibl"
LICENSE="GNU GPL v2"
REVISION="1"
ARCHITECTURES="x86"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES ?x86_gcc2"
else
	ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	kdiff3$secondaryArchSuffix = $portVersion
	cmd:kdiff3$secondaryArchSuffix = $portVersion
	"

REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	lib:libQtGui$secondaryArchSuffix
	lib:libQtCore$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"

BUILD_PREREQUIRES="
	cmd:make
	cmd:qmake$secondaryArchSuffix
	cmd:g++$secondaryArchSuffix
	"

PATCHES="kdiff3-0.9.97.patchset"

BUILD()
{
	mkdir build
	cd build
	qmake$secondaryArchSuffix CONFIG+=release ../src-QT4/kdiff3.pro
	make $jobArgs

	rc $portDir/additional-files/kdiff3.rdef \
		-o $sourceDir/build/kdiff3.rsrc

	xres -o kdiff3 kdiff3.rsrc
	mimeset -f kdiff3
}

INSTALL()
{
	mkdir -p $binDir
	cp -af build/kdiff3 $binDir

	addAppDeskbarSymlink $binDir/kdiff3 KDiff3

	mkdir -p $docDir
	cp -af doc/* $docDir
	rm -f $docDir/CMakeLists.txt $docDir/*/CMakeLists.txt
}
