SUMMARY="Library that handles decoding of several popular sound file formats"
DESCRIPTION="
sdl-sound is a library that handles the decoding of several popular file \
formats, such as .WAV and .MP3.  It is meant to make the programmer's sound \
playback tasks simpler.
"
HOMEPAGE="http://www.icculus.org/SDL_sound" 
SOURCE_URI="hg+http://hg.icculus.org/icculus/SDL_sound#release-1.0.3"
LICENSE="GNU LGPL v2.1"
COPYRIGHT="2001-2009 Ryan C. Gordon"
REVISION="4"

ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	sdl_sound$secondaryArchSuffix = $portVersion
	cmd:playsound$secondaryArchSuffix = $portVersion compat >= 2
	cmd:playsound_simple$secondaryArchSuffix = $portVersion compat >= 2
	lib:libSDL_sound$secondaryArchSuffix = 1.0_0.8.0 compat >= 1.0_0
	lib:libSDL_sound_1.0$secondaryArchSuffix = 0.8.0 compat >= 1.0
	"

REQUIRES="
	haiku$secondaryArchSuffix
	lib:libsdl$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libspeex$secondaryArchSuffix

#	lib:libFlac$secondaryArchSuffix
#	lib:libmikmod$secondaryArchSuffix
	lib:libmodplug$secondaryArchSuffix
#	lib:smpeg$secondaryArchSuffix
#	lib:physfs$secondaryArchSuffix

	lib:libGL$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libsdl$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libspeex$secondaryArchSuffix
#	devel:libFlac$secondaryArchSuffix
#	devel:libmikmod$secondaryArchSuffix
	devel:libmodplug$secondaryArchSuffix
#	devel:smpeg$secondaryArchSuffix
#	devel:physfs$secondaryArchSuffix
	"
	
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:sdl_config$secondaryArchSuffix
	"

SOURCE_DIR="SDL_sound-$portVersion"

BUILD()
{
	sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' configure.in
	libtoolize --force --copy --install
	./bootstrap
	aclocal --force --install -I acinclude
	autoconf
	runConfigure ./configure
	make
}

INSTALL()
{
	make install

	# remove libtool library file
	rm $libDir/libSDL_sound.la

	prepareInstalledDevelLibs libSDL_sound \
					libSDL_sound-1.0
	fixPkgconfig

	packageEntries devel \
			$developDir
}

PROVIDES_devel="
	sdl_sound${secondaryArchSuffix}_devel = $portVersion compat >= 1.0
	devel:SDL_sound$secondaryArchSuffix = 0.8.0 compat >= 0
	devel:libSDL_sound$secondaryArchSuffix = 1.0_0.8.0 compat >= 1.0_0
	devel:libSDL_sound_1.0$secondaryArchSuffix = 0.8.0 compat >= 0	
	"

REQUIRES_devel="
	sdl_sound$secondaryArchSuffix == $portVersion base
	"
