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/"
COPYRIGHT="1999-2012 A. Schiffler"
LICENSE="Zlib"
REVISION="2"
SOURCE_URI="http://www.ferzkopp.net/Software/SDL_gfx-2.0/SDL_gfx-$portVersion.tar.gz"
CHECKSUM_SHA256="7ceb4ffb6fc63ffba5f1290572db43d74386cd0781c123bc912da50d34945446"
SOURCE_DIR="SDL_gfx-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	sdl_gfx$secondaryArchSuffix = $portVersion compat >= 2
	lib:libSDL_gfx$secondaryArchSuffix = 16.9.1 compat >= 15
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libsdl_1.2$secondaryArchSuffix
	"

PROVIDES_devel="
	sdl_gfx${secondaryArchSuffix}_devel = $portVersion compat >= 2
	devel:libSDL_gfx$secondaryArchSuffix = 16.9.1 compat >= 15
	devel:sdl_gfx$secondaryArchSuffix = 16.9.1 compat >= 15
	"
REQUIRES_devel="
	sdl_gfx$secondaryArchSuffix == $portVersion base
	"

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

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.16 $libDir/libSDL_gfx.so.15

	packageEntries devel \
			$developDir
}

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