SUMMARY="SDL graphics drawing primitives and other support functions"
DESCRIPTION="
The SDL_gfx library evolved out of the SDL_gfxPrimitives code which provided \
basic drawing routines such as lines, circles or polygons and SDL_rotozoom \
which implemented a interpolating rotozoomer for SDL_surfaces.
"
HOMEPAGE="http://www.ferzkopp.net/joomla/content/view/19/14/" 
SOURCE_URI="http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-$portVersion.tar.gz"
CHECKSUM_SHA256="556eedc06b6cf29eb495b6d27f2dcc51bf909ad82389ba2fa7bdc4dec89059c0"
LICENSE="Zlib"
COPYRIGHT="1999-2012 A. Schiffler"

REVISION="2"

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

PROVIDES="
	sdl_gfx$secondaryArchSuffix = $portVersion compat >= 2
	lib:libSDL_gfx$secondaryArchSuffix = 15.9.1 compat >= 15
	"

REQUIRES="
	haiku$secondaryArchSuffix
	libsdl$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	"

BUILD_REQUIRES="
	devel:libsdl$secondaryArchSuffix
	"
	
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:aclocal
	cmd:autoconf
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtool
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:sdl_config$secondaryArchSuffix
	"

SOURCE_DIR="SDL_gfx-$portVersion"

#BUILD_PACKAGE_ACTIVATION_PHASE = "TEST"

BUILD()
{
	if [ $effectiveTargetArchitecture = x86_gcc2 ]; then
		disableMMX="--disable-mmx"
	fi
	autoreconf -fi
	runConfigure ./configure $disableMMX
	make
}

INSTALL()
{
	make install

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

	prepareInstalledDevelLib libSDL_gfx
	fixPkgconfig
	
	ln -s libSDL_gfx.so.15 $libDir/libSDL_gfx.so.14

	packageEntries devel \
			$developDir
}

PROVIDES_devel="
	sdl_gfx${secondaryArchSuffix}_devel = $portVersion compat >= 2
	devel:sdl_gfx$secondaryArchSuffix = 15.9.1 compat >= 14
	devel:libSDL_gfx$secondaryArchSuffix = 15.9.1 compat >= 14
	"

REQUIRES_devel="
	sdl_gfx$secondaryArchSuffix == $portVersion base
	"

TEST()
{
	cd Test
	./autogen.sh
	runConfigure ./configure
	make
	TestABGR
	TestFonts
	TestFramerate  	
	TestImageFilter
	TestGfxBlit
	TestGfxPrimitives
	TestGfxTexture	
	TestRotozoom
	TestShrink
}
