SUMMARY="A platform game in which you're a bear whose son has been kidnapped"
DESCRIPTION="Plee the Bear is a platform game in which you play an angry bear \
whose son has been kidnapped by god. Here is a guy hard to brave! Jump in \
this amazing journey to find and rescue your son. Because you want to rescue \
him, don't you? Or to slap him? Maybe both…

With three levels of the storyline and four mini-games, Plee the Bear \
received very positive criticisms. The players loved the fun, the graphics and \
the music; the community around the free software movement appreciated the \
overall process and the quality of the resources, remarkable for a free game; \
and the indie gaming community was pleasantly surprised by the technical \
skills and the details of the game."
HOMEPAGE="http://www.stuff-o-matic.com/plee-the-bear/"
COPYRIGHT="2012 Stuff O Matic"
LICENSE="GNU GPL v3"
REVISION="2"
srcGitRev="8b08a7a49fa74d59dbfcbf0f2d77dcfee1642f7c"
SOURCE_URI="https://github.com/j-jorge/plee-the-bear/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="1353f37d392966e58cb976ad031af4e4aecfd032d6994d22fb08af0a219417bc"
SOURCE_FILENAME="plee-the-bear-$portVersion.tar.gz"
SOURCE_DIR="plee-the-bear-$portVersion"
SOURCE_URI_2="https://github.com/j-jorge/bear/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256_2="06c430b7a990014de51d22bd44edda8b631074209d646bab9adbb021581907a7"
SOURCE_FILENAME_2="bear-$srcGitRev.tar.gz"
SOURCE_DIR_2="bear-$srcGitRev"
PATCHES="plee_the_bear-$portVersion.patchset"
PATCHES_2="bear-$portVersion.patchset"

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

PROVIDES="
	plee_the_bear$secondaryArchSuffix = $portVersion
	cmd:plee_the_bear$secondaryArchSuffix = $portVersion
	lib:libbear_audio$secondaryArchSuffix
	lib:libbear_communication$secondaryArchSuffix
	lib:libbear_debug$secondaryArchSuffix
	lib:libbear_engine$secondaryArchSuffix
	lib:libbear_expr$secondaryArchSuffix
	lib:libbear_generic_items$secondaryArchSuffix
	lib:libbear_gui$secondaryArchSuffix
	lib:libbear_input$secondaryArchSuffix
	lib:libbear_net$secondaryArchSuffix
	lib:libbear_text_interface$secondaryArchSuffix
	lib:libbear_time$secondaryArchSuffix
	lib:libbear_universe$secondaryArchSuffix
	lib:libbear_visual$secondaryArchSuffix
	lib:libplee_the_bear$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libboost_filesystem$secondaryArchSuffix
	lib:libboost_regex$secondaryArchSuffix
	lib:libboost_system$secondaryArchSuffix
	lib:libboost_thread$secondaryArchSuffix
	lib:libclaw_application$secondaryArchSuffix
	lib:libclaw_dynamic_library$secondaryArchSuffix
	lib:libclaw_graphic$secondaryArchSuffix
	lib:libclaw_logger$secondaryArchSuffix
	lib:libclaw_net$secondaryArchSuffix
	lib:libclaw_tween$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libsdl2_2.0$secondaryArchSuffix
	lib:libsdl2_mixer_2.0$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_filesystem$secondaryArchSuffix
	devel:libboost_regex$secondaryArchSuffix
	devel:libboost_system$secondaryArchSuffix
	devel:libboost_thread$secondaryArchSuffix
	devel:libclaw_application$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libsdl2_2.0$secondaryArchSuffix
	devel:libsdl2_mixer_2.0$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	rm -rf ../bear
	cp -R $sourceDir2 ../bear
	cat << EOF > ../CMakeLists.txt
cmake_minimum_required(VERSION 2.6)

if( NOT DEFINED BEAR_ROOT_DIRECTORY )
  set( BEAR_ROOT_DIRECTORY "\${CMAKE_CURRENT_SOURCE_DIR}/bear" )
endif()

set( CMAKE_MODULE_PATH "\${BEAR_ROOT_DIRECTORY}/cmake-helper" )

include( uninstall )

subdirs( bear plee-the-bear-$portVersion )
EOF

	cmake .. -DBEAR_EDITORS_ENABLED=FALSE -DCMAKE_INSTALL_PREFIX=$prefix \
		-DCMAKE_CXX_FLAGS="-DNDEBUG"
	make $jobArgs
}

INSTALL()
{
	make install
	rm -r $prefix/share

	addAppDeskbarSymlink $binDir/plee-the-bear "Plee the Bear"
}
