SUMMARY="Simple Direct Media Layer 2.0"
DESCRIPTION="
Simple DirectMedia Layer is a cross-platform development library designed to \
provide low level access to audio, keyboard, mouse, joystick, and graphics \
hardware via OpenGL and Direct3D. It is used by video playback software, \
emulators, and popular games.
"
HOMEPAGE="http://www.libsdl.org/"
SRC_URI="http://www.libsdl.org/release/SDL2-2.0.0.tar.gz"
CHECKSUM_SHA256="6f6ac8153d90e06a118474d5400624ae82b3d3e080915505db27cebc52b27178"
REVISION="1"
LICENSE="Zlib"
COPYRIGHT="1997-2013 Sam Lantinga"

ARCHITECTURES="x86 x86_gcc2"

PROVIDES="
	libsdl2 = $portVersion compat >= 2.0
	lib:libSDL2 = 0.12.0 compat >= 0.12
	lib:libSDL2_2.0 = 0.12.0 compat >= 0.12
	"

REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
#	lib:libGL
	lib:libglu
	lib:libpng
	lib:libjpeg
	lib:libtiff
	"

BUILD_REQUIRES="
#	devel:mesa
	devel:libglu
	devel:libpng
	devel:libjpeg
#	devel:libtiff
	"

BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	cmd:autoconf
	cmd:libtool
	cmd:aclocal
	cmd:make
	cmd:gcc${secondaryArchSuffix}
	cmd:ld${secondaryArchSuffix}
	"

SOURCE_DIR="SDL2-$portVersion"

PATCHES="libsdl2-2.0.0.patch"

BUILD()
{
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	# devel package
	prepareInstalledDevelLibs \
		libSDL2 \
		libSDL2main \
		libSDL2_test

	fixPkgconfig
	fixDevelopLibDirReferences $binDir/sdl2-config
	
	packageEntries devel \
			$developDir $binDir/sdl2-config $dataDir
}

# ----- devel package -------------------------------------
PROVIDES_devel="
	cmd:sdl2_config = $portVersion compat >= 2.0
	devel:libSDL2 = 0.12.0 compat >= 2.0
	devel:libSDL2main = 0.12.0 compat >= 0.12
	devel:libSDL2_test = 0.12.0 compat >= 0.12
	devel:libSDL2_2.0 = 0.12.0 compat >= 0.12
	"

REQUIRES_devel="
	libsdl2 == $portVersion base
	"
