SUMMARY="Create electric diagrams"
DESCRIPTION="QElectroTech is an application to create primarily, electrical, \
electronics, automation and control circuits. However, QElectroTech can be \
exploited to create mechanical objects to illustrate processes, \
instrumentation drawings among various creative possibilities. QElectroTech \
is a good professional quality drafting application for various drawings that \
form a project.

QElectroTech has a large collection of standard and custom symbols, referred \
to as elements, that describe most of the commonly used components in \
electrical, hydraulic, pneumatic, computer systems. These elements can be \
selected drag dropped with mouse on to a diagram editor and connected with \
lines to represent or describe a system. A large number of such diagrams can \
be drafted under a project.

QElectroTech also consists of an inbuilt element editor that permits creation \
of newer elements that do not exist in the collection. Elements in the QET \
collection are not editable i.e read only. But, once the element is drag \
dropped into a diagram, it is automatically added to “imported” collection in \
a duplicate copy. This copy of the element will be available for editing to \
effect suitable changes to create customized symbols."
HOMEPAGE="https://qelectrotech.org"
COPYRIGHT="2008-2019 Laurent Trinques, Joshua Claveau, Ronny Desmedt, Cyril Frausty, Abhishek Bansal"
LICENSE="GNU GPL v2"
REVISION="2"
SOURCE_URI="https://git.tuxfamily.org/qet/qet.git/snapshot/qet-$portVersion.tar.gz"
CHECKSUM_SHA256="d9d7de46c26f9ab9076d02463e9abd9b4b01e4e77202dc22ccecfe08d9bdd2c4"
SOURCE_DIR="qet-$portVersion"
PATCHES="qelectrotech-$portVersion.patchset"
ADDITIONAL_FILES="qelectrotech.rdef.in"

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

PROVIDES="
	qelectrotech$secondaryArchSuffix = $portVersion
	app:QElectrotech$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libKF5CoreAddons$secondaryArchSuffix
	lib:libKF5WidgetsAddons$secondaryArchSuffix
	lib:libQt5Concurrent$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Sql$secondaryArchSuffix
	lib:libQt5Svg$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= 5.55
	devel:libGL$secondaryArchSuffix
	devel:libKF5CoreAddons$secondaryArchSuffix
	devel:libKF5WidgetsAddons$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	cmd:qmake$secondaryArchSuffix >= 5
	"

BUILD()
{
	qmake -r \
		prefix=$appsDir/QElectrotech \
		INCLUDEPATH="/system/$relativeIncludeDir/KF5/KWidgetsAddons /system/$relativeIncludeDir/KF5/KCoreAddons"
	make $jobArgs
}

INSTALL()
{
	mkdir -p $dataDir/appdata $docDir/man
	make install

	cd $appsDir/QElectrotech
	mv qelectrotech QElectrotech
	rm -f *.xml *.desktop
	rm -rf $appsDir/share

	local APP_SIGNATURE="application/x-vnd.qelectrotech"
	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`echo "$portVersion" | cut -d. -f3`"
	local LONG_INFO="$SUMMARY"
	sed \
		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@MINOR@|$MINOR|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		$portDir/additional-files/qelectrotech.rdef.in > \
			$sourceDir/qelectrotech.rdef

	addResourcesToBinaries $sourceDir/qelectrotech.rdef \
		$appsDir/QElectrotech/QElectrotech

	addAppDeskbarSymlink $appsDir/QElectrotech/QElectrotech
}
