SUMMARY="A popular game development module for python"
DESCRIPTION="PyGame - python bindings to sdl and other libs that facilitate \
game production."
HOMEPAGE="https://www.pygame.org/"
COPYRIGHT="2000-2004, 2007 Pete Shinners
	2004 Takafumi Mizuno
	2006-2007 Rene Dudfield
	2007 Richard Goedeken
	2007-2008 Marcus von Appen"
LICENSE="GNU LGPL v2.1"
REVISION="5"
SOURCE_URI="https://files.pythonhosted.org/packages/source/p/pygame/pygame-$portVersion.tar.gz"
CHECKSUM_SHA256="700d1781c999af25d11bfd1f3e158ebb660f72ebccb2040ecafe5069d0b2c0b6"
SOURCE_DIR="pygame-$portVersion"
PATCHES="pygame-$portVersion.patchset"

ARCHITECTURES="x86_gcc2"

PROVIDES="
	pygame = $portVersion
	"
REQUIRES="
	cmd:python2
	lib:libfreetype
	lib:libjpeg
	lib:libpng16
	lib:libSDL_1.2
	lib:libSDL_gfx
	lib:libSDL_image_1.2
	lib:libSDL_mixer_1.2
	lib:libSDL_ttf_2.0
	lib:libsmpeg_0.4
	"
#	portmidi
#	portmap

BUILD_REQUIRES="
	haiku_devel
	setuptools_python
	devel:libfreetype
	devel:libjpeg
	devel:libpng16
	devel:libSDL_1.2
	devel:libSDL_gfx
	devel:libSDL_image_1.2
	devel:libSDL_mixer_1.2
	devel:libSDL_ttf_2.0
	devel:libsmpeg_0.4
	"
BUILD_PREREQUIRES="
	cmd:freetype_config
	cmd:gcc
	cmd:python2
	"

BUILD()
{
#   don't build without features
	echo "y" | $portPackageLinksDir/cmd~python2/bin/python2 setup.py build || exit 1
}

INSTALL()
{
	# GENERIC: all python_setuptools-based installs need this
	python=$portPackageLinksDir/cmd~python2/bin/python2
	pythonVersion=$($python --version 2>&1 | sed 's/Python //' | head -c3)
	installLocation=$prefix/lib/python$pythonVersion/vendor-packages/
	export PYTHONPATH=$installLocation:$PYTHONPATH
	mkdir -p $installLocation

	echo "y" | $portPackageLinksDir/cmd~python2/bin/python2 setup.py \
		build install --prefix $prefix || exit 1
}
