Files
haikuports/dev-python/pygame/pygame-2.0.0.recipe
OscarL 2a1dade5a2 pygame: drop spurious cmd:cython dependency. (#11813)
AFAICS, cython is only used by upstream devs to turn some cython code into .c
files (that are already included in the tarball we use).

(Tested with the 3 on-tree games that require pygame. All work without cython).

Side note: numpy dep is documented as "optional", so we may want to remove that
REQUIRES from this package, and just add it on packages that use that "extra"
functionality.

PyGame's README.rst says:

"The surfarray module requires the Python NumPy package for its
multidimensional numeric arrays.".
2025-02-21 06:49:16 +00:00

111 lines
2.9 KiB
Bash

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="7"
SOURCE_URI="https://files.pythonhosted.org/packages/source/p/pygame/pygame-$portVersion.tar.gz"
CHECKSUM_SHA256="63b038da116a643046181b02173fd894d87d2f85ecfd6aa7d5ece73c6ef501e9"
SOURCE_DIR="pygame-$portVersion"
PATCHES="pygame-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
$portName = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
"
PYTHON_VERSIONS=(3.10)
defaultVersion=3.10
for i in "${!PYTHON_VERSIONS[@]}"; do
pythonVersion=${PYTHON_VERSIONS[$i]}
pythonPackage=python${pythonVersion//.}
eval "PROVIDES_${pythonPackage}=\"
${portName}_$pythonPackage = $portVersion
\""
if [ "$targetArchitecture" = x86_gcc2 ]; then
eval "PROVIDES_${pythonPackage}+=\"
pygame_$pythonPackage = $portVersion
\""
fi
# This is because there was only one pygame package before.
if [ $pythonVersion = $defaultVersion ]; then
eval "REPLACES_$pythonPackage=\"
pygame
\""
fi
eval "REQUIRES_$pythonPackage=\"
haiku$secondaryArchSuffix
numpy_$pythonPackage
cmd:python$pythonVersion
lib:libfreetype$secondaryArchSuffix
lib:libjpeg$secondaryArchSuffix
lib:libpng16$secondaryArchSuffix
lib:libSDL_1.2$secondaryArchSuffix
lib:libSDL_gfx$secondaryArchSuffix
lib:libSDL_image_1.2$secondaryArchSuffix
lib:libSDL_mixer_1.2$secondaryArchSuffix
lib:libSDL_ttf_2.0$secondaryArchSuffix
lib:libsmpeg_0.4
\""
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
setuptools_$pythonPackage
devel:libfreetype$secondaryArchSuffix
devel:libjpeg$secondaryArchSuffix
devel:libpng16$secondaryArchSuffix
devel:libSDL_1.2$secondaryArchSuffix
devel:libSDL_gfx$secondaryArchSuffix
devel:libSDL_image_1.2$secondaryArchSuffix
devel:libSDL_mixer_1.2$secondaryArchSuffix
devel:libSDL_ttf_2.0$secondaryArchSuffix
devel:libsmpeg_0.4
"
BUILD_PREREQUIRES="
# cython is only really needed if the .pyx files need to be recompiled
# (the tarball already includes the generated .c files).
# cmd:cython$pythonVersion
cmd:gcc$secondaryArchSuffix
cmd:python$pythonVersion
cmd:pkg_config$secondaryArchSuffix
"
done
INSTALL()
{
for i in "${!PYTHON_VERSIONS[@]}"; do
pythonVersion=${PYTHON_VERSIONS[$i]}
pythonPackage=python${pythonVersion//.}
python=python$pythonVersion
installLocation=$prefix/lib/$python/vendor-packages/
export PYTHONPATH=$installLocation:$PYTHONPATH
mkdir -p $installLocation
# to build against SDL2 remove -sdl1 from the next line
echo "y" | $python setup.py build -auto -sdl1 || exit 1
$python setup.py build install \
--root=/ --prefix=$prefix
packageEntries $pythonPackage \
$prefix/lib/python*
done
}