SUMMARY="A Qt git client"
DESCRIPTION="Git GUI Client
Features:
* Open Source, Free Software
* Run on Windows, macOS and Linux
* Written in C++
* Powered by Qt 5"
HOMEPAGE="https://soramimi.github.io/Guitar/"
COPYRIGHT="2020 S.Fuchita"
LICENSE="GNU GPL v2"
REVISION="2"
SOURCE_URI="https://github.com/soramimi/Guitar/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="9155fc7c8f28972ecf40ad0badc5a519b50a28e92f54e4e6ea2570ec5ecdf957"
SOURCE_FILENAME="Guitar-$portVersion-$srcGitRev.tar.gz"
SOURCE_DIR="Guitar-$portVersion"
ADDITIONAL_FILES="guitar.rdef.in"
PATCHES="guitar-$portVersion.patchset"

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

PROVIDES="
	guitar$secondaryArchSuffix = $portVersion
	app:Guitar
	"
REQUIRES="
	haiku$secondaryArchSuffix
	cmd:file
	cmd:git
	lib:libcrypto$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5Svg$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcrypto$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5Svg$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:git #required
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	cmd:ruby
	"

defineDebugInfoPackage guitar$secondaryArchSuffix \
	$appsDir/Guitar

BUILD()
{
	qmake Guitar.pro
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir
	cp _bin/Guitar $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/guitar.rdef.in > guitar.rdef

	addResourcesToBinaries guitar.rdef $appsDir/Guitar
	addAppDeskbarSymlink $appsDir/Guitar
}
