SUMMARY="Arcade style game in the style of Boulder Dash"
DESCRIPTION="
- network multiplayer games (upto 4 players)
- local multiplayer games (upto 4 players)
- soft scrolling with 50 frames per second
- freely customizable keyboard and joystick support
- stereo sound effects and music
- music modules and fullscreen in SDL version
- contains levels to play Boulder Dash, Emerald Mine and Sokoban
- lots of additional levels available (over 10.000)"
HOMEPAGE="https://www.artsoft.org/rocksndiamonds/"
COPYRIGHT="2001-2020 Artsoft Entertainment"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://www.artsoft.org/RELEASES/unix/rocksndiamonds/rocksndiamonds-$portVersion.tar.gz"
CHECKSUM_SHA256="e0be33b3ff6c9b28728d6eea7cd94d9bf20fe54a0438006c85d3a7102bc595ef"
ADDITIONAL_FILES="rocksndiamonds.rdef.in"
PATCHES="rocksndiamonds-$portVersion.patchset"

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

PROVIDES="
	rocksndiamonds$secondaryArchSuffix = $portVersion
	app:"Rocks'n'Diamonds" = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libSDL2_image_2.0$secondaryArchSuffix
	lib:libSDL2_mixer_2.0$secondaryArchSuffix
	lib:libSDL2_net_2.0$secondaryArchSuffix
	lib:libsmpeg$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libSDL2_2.0$secondaryArchSuffix
	devel:libSDL2_image_2.0$secondaryArchSuffix
	devel:libSDL2_mixer_2.0$secondaryArchSuffix
	devel:libSDL2_net_2.0$secondaryArchSuffix
	devel:libsmpeg$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	make #RW_GAME_DIR=$settingsDir
}

INSTALL()
{
	installDir=$appsDir/"Rocks'n'Diamonds"
	mkdir -p $installDir
	cp -r rocksndiamonds docs sounds graphics levels music $installDir
	cp ChangeLog CREDITS $installDir

	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`echo "$portVersion" | cut -d. -f3`"
	local INTERNAL="`echo "$portVersion" | cut -d. -f4`"
	sed \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@MINOR@|$MINOR|" \
		-e "s|@INTERNAL@|$INTERNAL|" \
		$portDir/additional-files/rocksndiamonds.rdef.in > rocksndiamonds.rdef

	addResourcesToBinaries rocksndiamonds.rdef \
		$installDir/rocksndiamonds

	mv $installDir/rocksndiamonds $installDir/"Rocks'n'Diamonds"

	addAppDeskbarSymlink $installDir/"Rocks'n'Diamonds"
}
