SUMMARY="A 3D OpenGL Billard Simulator"
DESCRIPTION="BillardGL is a very nice looking OpenGL pool billiard simulation,\
 which was developed within the scope of the course \"Computergraphics\" at the \
 University of Freiburg (Germany)"
HOMEPAGE="https://sourceforge.net/projects/billardgl/"
COPYRIGHT="2001-2008 Tobias Nopper"
LICENSE="GNU GPL v2"
REVISION="4"
SOURCE_URI="http://prdownloads.sourceforge.net/billardgl/BillardGL-$portVersion.tar.gz"
CHECKSUM_SHA256="9b865b1254aa30125480ec7ea2ce00d91524db066a524b78492545782856df96"
SOURCE_DIR="BillardGL-$portVersion/src"
PATCHES="billardgl-$portVersion.patchset"
ADDITIONAL_FILES="billardgl.rdef.in"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	billardgl$secondaryArchSuffix = $portVersion
	app:BillardGL$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libGLU$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libglu$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir/BillardGL
	cp BillardGL $appsDir/BillardGL
	cp -r lang $appsDir/BillardGL
	cp -r Texturen $appsDir/BillardGL

	local APP_SIGNATURE="application/x-vnd.BillardGL"
	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local LONG_INFO="$SUMMARY"
	sed \
		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		$portDir/additional-files/billardgl.rdef.in > $sourceDir/billardgl.rdef

	addResourcesToBinaries  $sourceDir/billardgl.rdef \
		$appsDir/BillardGL/BillardGL
	addAppDeskbarSymlink $appsDir/BillardGL/BillardGL
}
