SUMMARY="The fast, smart log explorer"
DESCRIPTION="glogg is a multi-platform GUI application to browse and search \
through long or complex log files. It is designed with programmers and system \
administrators in mind. glogg can be seen as a graphical, interactive \
combination of grep and less."
HOMEPAGE="http://glogg.bonnefon.org"
COPYRIGHT="2009-2017 Nicolas Bonnefon and other contributors"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/nickbnf/glogg/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="1226b726317f42a52caa708852d40f59665dbc7d96e2520aff7640c373c67ce8"
SOURCE_FILENAME="glogg.$portVersion.tar.gz"
SOURCE_DIR="glogg-$portVersion"
ADDITIONAL_FILES="glogg.rdef.in"

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

PROVIDES="
	glogg$secondaryArchSuffix = $portVersion
	app:glogg
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libboost_program_options$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_program_options$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	"

BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	cmd:make
	cmd:qmake$secondaryArchSuffix >= 5
	"

BUILD()
{
	qmake .
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir
	cp release/glogg $appsDir/glogg

	local APP_SIGNATURE="application/x-vnd.glogg"
	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/glogg.rdef.in > glogg.rdef

	addResourcesToBinaries glogg.rdef $appsDir/glogg
	addAppDeskbarSymlink $appsDir/glogg
}
