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.

NCMPCPP is an ncurses based commandline client for Music Player Daemon."
HOMEPAGE="https://rybczak.net/ncmpcpp/"
COPYRIGHT="2008-2018 The NCMPCPP Project"
LICENSE="GNU GPL v2"
REVISION="5"
SOURCE_URI="https://github.com/arybczak/ncmpcpp/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="682fa230029a917f8c8b54131e6c8fb4915aefed2cc5726ca7c3ab4f4fb97bda"
SOURCE_DIR="ncmpcpp-$portVersion"

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

commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

PROVIDES="
	ncmpcpp$secondaryArchSuffix = $portVersion
	cmd:ncmpcpp$commandSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libboost_filesystem$secondaryArchSuffix >= 1.69.0
	lib:libboost_system$secondaryArchSuffix >= 1.69.0
	lib:libboost_locale$secondaryArchSuffix >= 1.69.0
	lib:libboost_program_options$secondaryArchSuffix >= 1.69.0
	lib:libboost_regex$secondaryArchSuffix >= 1.69.0
	lib:libboost_thread$secondaryArchSuffix >= 1.69.0
	lib:libcrypto$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libfftw3$secondaryArchSuffix
	lib:libicui18n$secondaryArchSuffix >= 66
	lib:libmpdclient$secondaryArchSuffix
	lib:libncursesw$secondaryArchSuffix >= 6
	lib:libreadline$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libtag$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_filesystem$secondaryArchSuffix >= 1.69.0
	devel:libboost_system$secondaryArchSuffix >= 1.69.0
	devel:libboost_locale$secondaryArchSuffix >= 1.69.0
	devel:libboost_program_options$secondaryArchSuffix >= 1.69.0
	devel:libboost_regex$secondaryArchSuffix >= 1.69.0
	devel:libboost_thread$secondaryArchSuffix >= 1.69.0
	devel:libcurl$secondaryArchSuffix
	devel:libfftw3$secondaryArchSuffix
	devel:libicui18n$secondaryArchSuffix >= 66
	devel:libmpdclient$secondaryArchSuffix
	devel:libncursesw$secondaryArchSuffix >= 6
	devel:libreadline$secondaryArchSuffix
	devel:libtag$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:autoreconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:grep
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:ranlib$secondaryArchSuffix
	cmd:sed
	"

USER_SETTINGS_FILES="
	settings/ncmpcpp directory
	settings/ncmpcpp/lyrics directory
	settings/ncmpcpp/config
	"

defineDebugInfoPackage ncmpcpp$secondaryArchSuffix \
	"$commandBinDir"/ncmpcpp

BUILD()
{
	export CFLAGS="-D_BSD_SOURCE"
	export LDFLAGS="-lnetwork -lbsd"

	autoreconf -vfi

	runConfigure --omit-dirs binDir ./configure --bindir="$commandBinDir" \
		--enable-outputs \
		--enable-visualizer \
		--enable-clock

	make $jobArgs
}

INSTALL()
{
	sed -i -e "s,\$(prefix)/share/doc/\$(PACKAGE),$docDir,g" Makefile doc/Makefile
	sed -i -e "s,\${prefix}/share,$dataDir,g" Makefile doc/Makefile

	make install
}

TEST()
{
	make check
}
