SUMMARY="A 2D CAD drawing program"
DESCRIPTION="LibreCAD is a cross-platform 2D CAD program written in C++11 \
using the Qt framework. It can read DXF and DWG files and can write DXF, PDF \
and SVG files. The user interface is highly customizable, and has dozens of \
translations."
HOMEPAGE="https://librecad.org/"
COPYRIGHT="2017 LibreCAD"
LICENSE="GNU GPL v2"
REVISION="5"
SOURCE_URI="https://github.com/LibreCAD/LibreCAD/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="74c4ede409b13d0365c65c0cd52dba04f1049530f6df706dc905443d5e60db06"
SOURCE_DIR="LibreCAD-$portVersion"
PATCHES="librecad-$portVersion.patchset"

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

PROVIDES="
	librecad$secondaryArchSuffix = $portVersion
	app:LibreCAD$secondaryArchSuffix = $portVersion
	cmd:ttf2lff$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libmuparser$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Svg$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_system$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libmuparser$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5PrintSupport$secondaryArchSuffix
	devel:libQt5Svg$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	cmd:which
	"

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
}
