SUMMARY="LibreCAD is a 2D CAD drawing tool"
DESCRIPTION="LibreCAD is a 2D CAD drawing tool based on the community edition \
of QCAD (http://www.qcad.org).

LibreCAD has been re-structured, ported to new Qt versions and works natively \
cross platform between OS X, Windows, Linux and Haiku."
HOMEPAGE="http://librecad.org"
SOURCE_URI="git+https://github.com/LibreCAD/LibreCAD#fc30396"
REVISION="1"
LICENSE="GNU GPL v2"
COPYRIGHT="2015 LibreCAD"

ARCHITECTURES="x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
	ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	librecad$secondaryArchSuffix = $portVersion
	app:LibreCAD$secondaryArchSuffix = $portVersion
	cmd:ttf2lff$secondaryArchSuffix = $portVersion
	"

REQUIRES="
	haiku${secondaryArchSuffix}
	libqt4$secondaryArchSuffix >= 4.8.0
	lib:libfreetype$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
	"

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	libqt4${secondaryArchSuffix}_devel >= 4.8.0
	boost${secondaryArchSuffix}_devel
	devel:libfreetype$secondaryArchSuffix
	"

PATCHES="librecad_x86-2.0.7.patchset"

BUILD()
{
	qmake
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir/LibreCAD $binDir

	cd unix
	strip librecad
	addResourcesToBinaries ../haiku/LibreCAD.rdef librecad

	cp librecad $appsDir/LibreCAD/LibreCAD
	cp -R appdata resources $appsDir/LibreCAD
	cp ttf2lff $binDir

	addAppDeskbarSymlink $appsDir/LibreCAD/LibreCAD "LibreCAD"
}
