SUMMARY="A role playing game battling roboters"
DESCRIPTION="
The game tells the story of a world destroyed by a conflict between robots and \
their human masters. Play as Tux in a quest to save the world from the \
murderous rebel bots who know no mercy. You get to choose which path you wish \
to follow, and freedom of choice is everywhere in the game.

FreedroidRPG features a real time combat system with melee and ranged weapons, \
fairly similar to the proprietary game Diablo. There is an innovative system of \
programs that can be run in order to take control of enemy robots, alter their \
behavior, or improve one's characteristics. You can use over 50 different kinds \
of items and fight countless enemies on your way to your destiny. An advanced \
dialog system provides story background and immersive role playing situations.

The game is complete, fully playable, and can provide about 10 hours of fun.
It is still being actively developed, and help is welcome in many areas. People \
having - or trying to acquire - programming, map editing, or writing skills \
will find FreedroidRPG to be an exciting, fast-moving project in which they can \
fully express their creativity."
HOMEPAGE="http://freedroid.org"
SOURCE_URI="http://sourceforge.net/projects/freedroid/files/freedroidRPG/freedroidRPG-0.15/freedroidRPG-0.15.1.tar.gz/download"
CHECKSUM_SHA256="3e0e0e901f05386f49b8dfa1a8b3582ea82347deb7fb8e94fc15bf8ad058ba08"
LICENSE="GNU GPL v2"
COPYRIGHT="2002-2010 The Freedroid team"
REVISION="1"

ARCHITECTURES="x86 x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	freedroidrpg$secondaryArchSuffix = $portVersion
	app:freedroidrpg$secondaryArchSuffix = $portVersion
	cmd:pngtoico$secondaryArchSuffix = $portVersion
	cmd:croppy$secondaryArchSuffix = $portVersion
	cmd:explode_atlas$secondaryArchSuffix = $portVersion
	cmd:explodefont$secondaryArchSuffix = $portVersion
	cmd:gluefont$secondaryArchSuffix = $portVersion
	cmd:make_atlas$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	freedroidrpg_data == $portVersion
	lib:libsdl$secondaryArchSuffix
	#lib:libsdl_mixer$secondaryArchSuffix
	lib:libsdl_image$secondaryArchSuffix
	lib:libsdl_gfx$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libpng$secondaryArchSuffix
	lib:libglu$secondaryArchSuffix
	lib:libgl$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libsdl$secondaryArchSuffix
	#devel:libsdl_mixer$secondaryArchSuffix
	devel:libsdl_image$secondaryArchSuffix
	devel:libsdl_gfx$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libglu$secondaryArchSuffix
	devel:libgl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:libtoolize
	cmd:autoconf
	cmd:automake
	cmd:pkg_config$secondaryArchSuffix
	cmd:python
	"
SOURCE_DIR="freedroidrpg-0.15.1"

PATCHES="
	configure.ac.patch
	configure.2.ac.patch
	"
PATCH()
{
	sed -i 's/lua.h/..\/lua\/lua.h/g' src/*.c
	sed -i 's/lua.h/..\/lua\/lua.h/g' src/*.h
	sed -i 's/lauxlib.h/..\/lua\/lauxlib.h/g' src/*.c
	sed -i 's/lauxlib.h/..\/lua\/lauxlib.h/g' src/*.h
	sed -i 's/lualib.h/..\/lua\/lualib.h/g' src/*.c
	sed -i 's/lualib.h/..\/lua\/lualib.h/g' src/*.h
}
BUILD()
{
	libtoolize --force --copy --install
	aclocal
	autoconf
	automake
	./configure --disable-sdltest --with-embedded-lua --libdir=$libDir --includedir=$includeDir \
		--bindir=$binDir --datadir=$dataDir --mandir=$manDir
	make
}
INSTALL()
{
	make install
	
	mkdir -p $appsDir
	
	mv $binDir/freedroidRPG $appsDir
	
	packageEntries data $dataDir
	addAppDeskbarSymlink $appsDir/freedroidRPG "FreedroidRPG"
}

SUMMARY_data="FreedroidRPG data files"
ARCHITECTURES_data="any"

PROVIDES_data="
	freedroidrpg_data = $portVersion
	"
REQUIRES_data="
	haiku
	"

