SUMMARY="A QT client for Music Player Daemon"
DESCRIPTION="Music Player Daemon (MPD) is a flexible, powerful, server-side \
application for playing music. Through plugins and libraries it can play a \
variety of sound files while being controlled by its network protocol.

SkyMPC a simple MPD client, powered by Qt."
HOMEPAGE="http://www.soramimi.jp/skympc/"
COPYRIGHT="2015-2018 S.Fuchita"
LICENSE="GNU GPL v3"
REVISION="1"
srcGitRev="9661bd1e4ecc536ec570177214b1848cb675dded"
SOURCE_URI="https://github.com/soramimi/SkyMPC/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="d0652ea9cc39f249a333468dc46e6fa58caa6d4b788a868ab8015942fabc0984"
SOURCE_FILENAME="$portVersionedName.tar.gz"
SOURCE_DIR="SkyMPC-$srcGitRev"
ADDITIONAL_FILES="
	Haiku_Style_Icons.zip
	skympc.rdef.in
	"

ARCHITECTURES="all !x86_gcc2 ?arm ?ppc"
if [ "$targetArchitecture" = x86_gcc2 ]; then
SECONDARY_ARCHITECTURES="x86"
fi

PROVIDES="
	skympc$secondaryArchSuffix = $portVersion
	app:skympc
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libmpdclient$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5Svg$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libmpdclient$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5Svg$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libQt5Xml$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:git
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	cmd:ruby
	cmd:unzip
	"

BUILD()
{
	unzip -o $portDir/additional-files/Haiku_Style_Icons.zip -d image
	qmake .
	make $jobArgs
}

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

	addResourcesToBinaries skympc.rdef $appsDir/SkyMPC
	addAppDeskbarSymlink $appsDir/SkyMPC
}
