SUMMARY="A free and open-source cross-platform source explorer"
DESCRIPTION="Sourcetrail helps you get productive on unfamiliar source code"
HOMEPAGE="https://www.sourcetrail.com/"
COPYRIGHT="2019 Andreas Stallinger and others"
LICENSE="GNU GPL v3"
REVISION="2"
SOURCE_URI="https://github.com/CoatiSoftware/Sourcetrail/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="74b0f11904e5faaead94f92319001d77e23d102c7370f63f0f83a624e46312fe"
SOURCE_DIR="Sourcetrail-$portVersion"
PATCHES="sourcetrail-$portVersion.patchset"

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

PROVIDES="
	sourcetrail$secondaryArchSuffix = $portVersion
 	app:sourcetrail
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libboost_date_time$secondaryArchSuffix
	lib:libboost_filesystem$secondaryArchSuffix
	lib:libboost_program_options$secondaryArchSuffix
	lib:libboost_system$secondaryArchSuffix
	lib:libQt5$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Designer$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5Quick$secondaryArchSuffix
	lib:libQt5Test$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_date_time$secondaryArchSuffix >= 1.69.0
	devel:libboost_filesystem$secondaryArchSuffix >= 1.69.0
	devel:libboost_program_options$secondaryArchSuffix >= 1.69.0
	devel:libboost_system$secondaryArchSuffix >= 1.69.0
	devel:libQt5$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Designer$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5Quick$secondaryArchSuffix
	devel:libQt5Test$secondaryArchSuffix
	devel:libQt5Xml$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:getconf
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:python3
	"

BUILD()
{
	mkdir -p build
	cd build
	cmake -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_BUILD_TYPE="Release" \
		-DBUILD_PYTHON_LANGUAGE_PACKAGE=ON \
		-DVERSION_STRING=$portVersion ..
	make $jobArgs
}

INSTALL()
{
	cd build
	mkdir -p $appsDir/SourceTrail
	cp -rf ../bin/app/* $appsDir/SourceTrail
	cp app/Sourcetrail $appsDir/SourceTrail
	cp app/sourcetrail_indexer $appsDir/SourceTrail
	addAppDeskbarSymlink $appsDir/SourceTrail/Sourcetrail
}
