SUMMARY="Tux4Kids' typing tutor for kids"
DESCRIPTION="TuxType2 is an educational typing tutor for kids starring Tux, \
the Linux penguin. This educational game comes with two different games for \
practicing typing, and having a great time doing it."
HOMEPAGE="https://sourceforge.net/projects/tuxtype/"
COPYRIGHT="2000-2009 Sam Hart"
LICENSE="GNU GPL v2"
REVISION="6"
SOURCE_URI="https://sf.net/projects/tuxtype/files/OldFiles/tuxtype2-1.5.2.tar.gz"
CHECKSUM_SHA256="d9552a3fe8367f14358e01d47aeb2603c6891fe0ec2e73414c541d91f0466d5d"
PATCHES="tuxtype2-$portVersion.patchset"
ADDITIONAL_FILES="tuxtype2.rdef"

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

PROVIDES="
	tuxtype2$secondaryArchSuffix
	app:TuxType2$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libSDL_image_1.2$secondaryArchSuffix
	lib:libSDL_mixer_1.2$secondaryArchSuffix
	lib:libSDL_ttf_2.0$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcrypto$secondaryArchSuffix
	devel:libSDL_1.2$secondaryArchSuffix
	devel:libSDL_image_1.2$secondaryArchSuffix
	devel:libSDL_mixer_1.2$secondaryArchSuffix
	devel:libSDL_ttf_2.0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	autoreconf -vfi
	./configure --prefix=$appsDir/TuxTyping
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir/TuxTyping
	make install

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

	addResourcesToBinaries tuxtype2.rdef \
		$appsDir/TuxTyping/bin/tuxtype2

	mv $appsDir/TuxTyping/bin/tuxtype2 $appsDir/TuxTyping/TuxType2
	rm -r $appsDir/TuxTyping/bin
	addAppDeskbarSymlink $appsDir/TuxTyping/TuxType2
}
