SUMMARY="A multi-platform Git client"
DESCRIPTION="GitQlient, pronounced as git+client (/gɪtˈklaɪənt/) is a \
multi-platform Git client originally forked from QGit.
Nowadays, it goes beyond of just a fork and adds a lot of new functionality.
Some of the major features you can find are:

* Easy access to remote actions like: push, pull, submodule management and \
branches
* Branch management
* Tag and stash management
* Submodule handling
* Open several repositories in the same window
* Better visualization of the commits and the work in progress
* Better visualization of the repository view
* Improved UI experience
* Easy access to the main Git actions
* Better code separation between Views and Models
* Simplification of different options, keeping it to what a Git client is \
suposed to be."
HOMEPAGE="https://francescmm.github.io/GitQlient/"
COPYRIGHT="2020 Francesc Martinez"
LICENSE="GNU LGPL v2.1"
REVISION="2"
baseUrl="https://codeload.github.com/francescmm"
bmtCommitHash="44dde32d9e79c075a03190bc86753102b14ac663"
qlCommitHash="049bf73c50ceeadd5de989f76258d94d97b1dce8"
qpwCommitHash="4a9d3af084194b803dc8e2b89640b9a97043dab7"
SOURCE_URI="https://github.com/francescmm/GitQlient/archive/v1.2.0-rc.tar.gz"
CHECKSUM_SHA256="2bfd11994c89961c7af4b5cfd90e7d112c38898e60555fc694f9e057ddf51e5e"
SOURCE_DIR="GitQlient-1.2.0-rc"
SOURCE_URI_2="$baseUrl/BenchmarkTool/zip/$bmtCommitHash"
SOURCE_DIR_2="BenchmarkTool-$bmtCommitHash"
SOURCE_FILE_2="BenchmarkTool.zip"
CHECKSUM_SHA256_2="3ced0371b1380787141eb8e382dc38ccc978891c6f2796a1c92d8d7633d120d2"
SOURCE_URI_3="$baseUrl/QLogger/zip/$qlCommitHash"
SOURCE_DIR_3="QLogger-$qlCommitHash"
SORUCE_FILE_3="QLogger.zip"
CHECKSUM_SHA256_3="170dc02d91e9e17c8b900e4fc693fc38fe9dad1aba4602da821ce8d81f135666"
SOURCE_URI_4="$baseUrl/QPinnableTabWidget/zip/$qpwCommitHash"
SOURCE_DIR_4="QPinnableTabWidget-$qpwCommitHash"
SOURCE_FILE_4="QPinnableTabWidget.zip"
CHECKSUM_SHA256_4="ebde7f5c0ff92050a660b85af02d1aee988b7054e78bc1ba1eb3a70e5dbc4d22"
ADDITIONAL_FILES="gitqlient.rdef.in"
PATCHES="gitqlient-1.2.0.patchset"

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

PROVIDES="
	gitqlient$secondaryArchSuffix = $portVersion
	app:GitQlient
	"
REQUIRES="
	haiku$secondaryArchSuffix
	cmd:file
	cmd:git
	lib:libGL$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:sed
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	"

defineDebugInfoPackage gitqlient$secondaryArchSuffix \
	$appsDir/GitQlient

BUILD()
{
	cd $sourceDir

	cp -rf /$sourceDir2/* $sourceDir/BenchmarkTool
	cp -rf /$sourceDir3/* $sourceDir/QLogger
	cp -rf /$sourceDir4/* $sourceDir/QPinnableTabWidget

	qmake GitQlient.pro
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir
	cp GitQlient $appsDir

	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`echo "$portVersion" | cut -d. -f3 | cut -d~ -f1`"

	sed \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@MINOR@|$MINOR|" \
		$portDir/additional-files/gitqlient.rdef.in > gitqlient.rdef

	addResourcesToBinaries gitqlient.rdef $appsDir/GitQlient
	addAppDeskbarSymlink $appsDir/GitQlient
}
