SUMMARY="A commandline 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.

MPC is a commandline client for Music Player Daemon."
HOMEPAGE="https://www.musicpd.org/"
COPYRIGHT="2003-2019 The Music Player Daemon Project"
LICENSE="GNU GPL v2"
REVISION="2"
SOURCE_URI="https://www.musicpd.org/download/mpc/0/mpc-$portVersion.tar.xz"
CHECKSUM_SHA256="691e3f3654bc10d022bb0310234d0bc2d8c075a698f09924d9ebed8f506fda20"
SOURCE_DIR="mpc-$portVersion"

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

PROVIDES="
	musicpc$secondaryArchSuffix = $portVersion
	cmd:mpc = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libmpdclient$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcheck$secondaryArchSuffix
	devel:libmpdclient$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:meson
	cmd:ninja
	cmd:pkg_config$secondaryArchSuffix
	cmd:sed
	"

BUILD()
{
	rm -rf build_haiku
	mkdir -p build_haiku; cd build_haiku

	export LDFLAGS="-lnetwork"

	meson --prefix=$prefix \
		--buildtype=release \
		--libdir=$libDir \
		--includedir=$includeDir \
		--mandir=$manDir \
		--infodir=$infoDir \
		-Dtest=true

	ninja $jobArgs
}

INSTALL()
{
	cd build_haiku
	ninja install

	mkdir -p $docDir
	mv $prefix/share/doc/mpc $docDir
	rm -rf $prefix/share
}

TEST()
{
	cd build_haiku
	ninja test
}
