SUMMARY="Simple Direct Media Layer sound library"
DESCRIPTION="sdl_sound handles the decoding of several popular file \
formats, such as .WAV and .MP3.  It aims to make the programmer's sound \
playback tasks simpler."
HOMEPAGE="http://www.icculus.org/SDL_sound"
COPYRIGHT="2001-2009 Ryan C. Gordon"
LICENSE="GNU LGPL v2.1"
REVISION="8"
SOURCE_URI="http://icculus.org/SDL_sound/downloads/SDL_sound-$portVersion.tar.gz"
CHECKSUM_SHA256="3999fd0bbb485289a52be14b2f68b571cb84e380cc43387eadf778f64c79e6df"
SOURCE_DIR="SDL_sound-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	sdl_sound$secondaryArchSuffix = $portVersion
	cmd:playsound$secondaryArchSuffix = $portVersion compat >= 1
	cmd:playsound_simple$secondaryArchSuffix = $portVersion compat >= 1
	lib:libSDL_sound$secondaryArchSuffix = 1.0.2 compat >= 1
	lib:libSDL_sound_1.0$secondaryArchSuffix = 1.0.2 compat >= 1
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libflac$secondaryArchSuffix
#	lib:libGL$secondaryArchSuffix
	lib:libmikmod$secondaryArchSuffix
	lib:libmodplug$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libsdl_1.2$secondaryArchSuffix
	lib:libsmpeg_0.4$secondaryArchSuffix
	lib:libspeex$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libvorbisfile$secondaryArchSuffix
#	lib:physfs$secondaryArchSuffix
	"

PROVIDES_devel="
	sdl_sound${secondaryArchSuffix}_devel = $portVersion compat >= 1
	devel:libsdl_sound$secondaryArchSuffix = 1.0.2 compat >= 1
	devel:libsdl_sound_1.0$secondaryArchSuffix = 1.0.2 compat >= 1
	"
REQUIRES_devel="
	sdl_sound$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libflac$secondaryArchSuffix
	devel:libmikmod$secondaryArchSuffix
	devel:libmodplug$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libsdl_1.2$secondaryArchSuffix
	devel:libsmpeg_0.4$secondaryArchSuffix
	devel:libspeex$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
#	devel:physfs$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:sdl_config$secondaryArchSuffix
	cmd:smpeg_config$secondaryArchSuffix
	"

BUILD()
{
	sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' configure.in
	touch NEWS AUTHORS ChangeLog
	autoreconf -fi
	CPPFLAGS="$CPPFLAGS `smpeg-config${secondaryArchSuffix/_/-} --cflags`" \
		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
}
