SUMMARY="The 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.
"
HOMEPAGE="http://www.musicpd.org/"
SOURCE_URI="git://git.musicpd.org/master/mpd.git#e0ca4347beb2e2e7235e16c4555d426c7d923468"
#CHECKSUM_SHA256=""
LICENSE="GNU GPL v2"
COPYRIGHT="2003-2014 The Music Player Daemon Project"
REVISION="1"
ARCHITECTURES="x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
	ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	mpd$secondaryArchSuffix = $portVersion
	cmd:mpd$secondaryArchSuffix = $portVersion
	"
#FIXME: expat not detected (missing .pc ?)
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	boost$secondaryArchSuffix
	lib:libmpdclient$secondaryArchSuffix
	glib2_x86 >= 2
	icu$secondaryArchSuffix
	lib:libao$secondaryArchSuffix >= 1.1.0
	lib:libavcodec$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libexpat$secondaryArchSuffix
	lib:libfaad$secondaryArchSuffix
	lib:libFLAC$secondaryArchSuffix
	lib:libfluidsynth$secondaryArchSuffix
	lib:libid3tag$secondaryArchSuffix >= 0.3.0
	lib:libintl$secondaryArchSuffix
	lib:libmad$secondaryArchSuffix
	lib:libmodplug$secondaryArchSuffix
	lib:libmp3lame$secondaryArchSuffix
	lib:libmpg123$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	lib:libsndfile$secondaryArchSuffix
	lib:libsqlite3$secondaryArchSuffix
	lib:libtag$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	boost${secondaryArchSuffix}_devel
	devel:libmpdclient$secondaryArchSuffix
	icu${secondaryArchSuffix}_devel
	glib2${secondaryArchSuffix}_devel
	devel:libao$secondaryArchSuffix >= 1.1.0
	devel:libavcodec$secondaryArchSuffix
	devel:libbz2$secondaryArchSuffix
	devel:libcurl$secondaryArchSuffix
	devel:libexpat$secondaryArchSuffix
	devel:libfaad$secondaryArchSuffix
	devel:libFLAC$secondaryArchSuffix
	devel:libfluidsynth$secondaryArchSuffix
	devel:libid3tag$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libmad$secondaryArchSuffix
	devel:libmodplug$secondaryArchSuffix
	devel:libmp3lame$secondaryArchSuffix
	devel:libmpg123$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libsndfile$secondaryArchSuffix
	devel:libsqlite3$secondaryArchSuffix
	devel:libtag$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:awk
	cmd:gcc${secondaryArchSuffix}
	cmd:ld${secondaryArchSuffix}
	cmd:libtoolize
	cmd:make
	cmd:m4
	cmd:pkg_config${secondaryArchSuffix}
	cmd:ranlib
	cmd:sed
	cmd:find
	"
	
PATCHES="mpd-0.18.12_git.patchset"

BUILD()
{
	export PKG_CONFIG_LIBDIR="`finddir B_SYSTEM_DIRECTORY`/$relativeDevelopLibDir/pkgconfig"

	./autogen.sh -V

	runConfigure ./configure

	make $jobArgs
}

INSTALL()
{
	export PKG_CONFIG_LIBDIR="`finddir B_SYSTEM_DIRECTORY`/$relativeDevelopLibDir/pkgconfig"

	make install

	# prepare devel/lib
	#prepareInstalledDevelLibs libmp3lame
	#fixPkgconfig
}
