SUMMARY="A simple Qt5 frontend to MPD"
DESCRIPTION="A Qt5 client for the music player daemon (MPD) written in C++."
HOMEPAGE="https://sourceforge.net/projects/quimup/"
COPYRIGHT="quimup"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://downloads.sourceforge.net/quimup/quimup_${portVersion}_source.tar.gz"
CHECKSUM_SHA256="dac47b4c0f458e1a020f2c70d4291ad6bcf85041e6a26f1d011d6542aa3fdc33"
SOURCE_DIR="Quimup_$portVersion"
ADDITIONAL_FILES="quimup.rdef.in"

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

PROVIDES="
	quimup$secondaryArchSuffix = $portVersion
	app:quimup$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libmpdclient$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libtag$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libmpdclient$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libtag$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	"

BUILD()
{
	qmake quimup.pro PREFIX="$appsDir"
	make $jobArgs
}

INSTALL()
{
	mkdir -p "$appsDir"
	cp quimup "$appsDir"

	# Add Haiku resources
	local APP_SIGNATURE="application/x-vnd.qt5-quimup"
	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/quimup.rdef.in > quimup.rdef

	addResourcesToBinaries quimup.rdef "$appsDir"/quimup
	addAppDeskbarSymlink "$appsDir"/quimup
}
