summaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorJulien Boibessot <julien.boibessot@armadeus.com>2012-01-11 12:06:49 +0100
committerPeter Korsgaard <jacmet@sunsite.dk>2012-01-11 13:58:51 +0100
commitdda08e492d724e0bbe5896b1c97b5a8ea1b40b59 (patch)
tree3973862587f1c78bf3d3c1059f2dc594f8440f42 /package
parentb0ff93adfbb44ada2c685713cb95b32c2ce801e4 (diff)
downloadbuildroot-novena-dda08e492d724e0bbe5896b1c97b5a8ea1b40b59.tar.gz
buildroot-novena-dda08e492d724e0bbe5896b1c97b5a8ea1b40b59.zip
Add pygame package
[Peter: drop menu for suboptions] Signed-off-by: Julien Boibessot <julien.boibessot@armadeus.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'package')
-rw-r--r--package/Config.in1
-rw-r--r--package/python-pygame/Config.in49
-rw-r--r--package/python-pygame/python-pygame.mk111
3 files changed, 161 insertions, 0 deletions
diff --git a/package/Config.in b/package/Config.in
index 276806b8f..ac14d2c65 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -243,6 +243,7 @@ menu "external python modules"
source "package/python-dpkt/Config.in"
source "package/python-mad/Config.in"
source "package/python-netifaces/Config.in"
+source "package/python-pygame/Config.in"
source "package/python-serial/Config.in"
source "package/python-setuptools/Config.in"
endmenu
diff --git a/package/python-pygame/Config.in b/package/python-pygame/Config.in
new file mode 100644
index 000000000..1b0a8b96b
--- /dev/null
+++ b/package/python-pygame/Config.in
@@ -0,0 +1,49 @@
+config BR2_PACKAGE_PYTHON_PYGAME
+ bool "pygame"
+ depends on BR2_PACKAGE_PYTHON
+ select BR2_PACKAGE_SDL
+ help
+ Pygame is a cross-platfrom library designed to make it easy to write
+ multimedia software, such as games, in Python. Pygame requires the
+ Python language and SDL multimedia library.
+ It can also make use of several other popular libraries.
+
+ http://www.pygame.org/
+
+if BR2_PACKAGE_PYTHON_PYGAME
+config BR2_PACKAGE_PYTHON_PYGAME_IMAGE
+ bool "pygame.image"
+ select BR2_PACKAGE_SDL_IMAGE
+ select BR2_PACKAGE_SDL_IMAGE_PNG
+ select BR2_PACKAGE_SDL_IMAGE_JPEG
+ help
+ pygame module for loading, saving and transfering images.
+ Will autoselect sdl_image with png and jpeg support.
+
+config BR2_PACKAGE_PYTHON_PYGAME_FONT
+ bool "pygame.font"
+ select BR2_PACKAGE_SDL_TTF
+ help
+ pygame module for loading and rendering fonts.
+ Will autoselect sdl_ttf.
+
+config BR2_PACKAGE_PYTHON_PYGAME_MIXER
+ bool "pygame.mixer"
+ select BR2_PACKAGE_SDL_MIXER
+ help
+ pygame module for loading and playing sounds.
+ Will autoselect sdl_mixer.
+
+config BR2_PACKAGE_PYTHON_PYGAME_MIXER_MUSIC
+ bool "pygame.mixer.music"
+ depends on BR2_PACKAGE_PYTHON_PYGAME_MIXER
+ help
+ pygame module for controlling streamed audio
+
+config BR2_PACKAGE_PYTHON_PYGAME_SCRAP
+ bool "pygame.scrap"
+ depends on BR2_PACKAGE_SDL_X11
+ help
+ pygame module for clipboard support (X11 needed)
+
+endif
diff --git a/package/python-pygame/python-pygame.mk b/package/python-pygame/python-pygame.mk
new file mode 100644
index 000000000..f5603b668
--- /dev/null
+++ b/package/python-pygame/python-pygame.mk
@@ -0,0 +1,111 @@
+#############################################################
+#
+# Pygame
+#
+#############################################################
+# stable 1.9.1 release requires V4L which has been wiped out of recent Linux
+# kernels, so use latest mercurial revision until next stable release is out.
+PYTHON_PYGAME_VERSION = f0bb4a4b365d
+PYTHON_PYGAME_SOURCE = pygame-$(PYTHON_PYGAME_VERSION).tar.gz
+PYTHON_PYGAME_SITE = https://bitbucket.org/pygame/pygame
+PYTHON_PYGAME_SITE_METHOD = hg
+
+ifeq ($(BR2_PACKAGE_PYTHON_PYGAME_IMAGE),y)
+PYTHON_PYGAME_OPT_DEPENDS += sdl_image
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON_PYGAME_FONT),y)
+PYTHON_PYGAME_OPT_DEPENDS += sdl_ttf
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON_PYGAME_MIXER),y)
+PYTHON_PYGAME_OPT_DEPENDS += sdl_mixer
+endif
+
+PYTHON_PYGAME_DEPENDENCIES = python sdl $(PYTHON_PYGAME_OPT_DEPENDS)
+
+ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_IMAGE),y)
+define PYTHON_PYGAME_UNCONFIGURE_IMAGE
+ $(SED) 's/^imageext/#imageext/' $(@D)/Setup
+endef
+endif
+
+ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_FONT),y)
+define PYTHON_PYGAME_UNCONFIGURE_FONT
+ $(SED) 's/^font/#font/' $(@D)/Setup
+endef
+endif
+
+ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_MIXER),y)
+define PYTHON_PYGAME_UNCONFIGURE_MIXER
+ $(SED) 's/^mixer/#mixer/g' $(@D)/Setup
+endef
+endif
+
+# Both require numpy or numeric python module
+define PYTHON_PYGAME_UNCONFIGURE_SNDARRAY
+ $(SED) 's/^_numericsndarray/#_numericsndarray/' $(@D)/Setup
+endef
+
+define PYTHON_PYGAME_UNCONFIGURE_SURFARRAY
+ $(SED) 's/^_numericsurfarray/#_numericsurfarray/' $(@D)/Setup
+endef
+
+# Requires smpeg
+define PYTHON_PYGAME_UNCONFIGURE_MOVIE
+ $(SED) 's/^movie/#movie/' $(@D)/Setup
+endef
+
+ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_SCRAP),y)
+define PYTHON_PYGAME_UNCONFIGURE_SCRAP
+ $(SED) 's/^scrap/#scrap/' $(@D)/Setup
+endef
+endif
+
+PYTHON_PYGAME_SDL_FLAGS = $(shell $(STAGING_DIR)/usr/bin/sdl-config --cflags)
+PYTHON_PYGAME_SDL_FLAGS += $(shell $(STAGING_DIR)/usr/bin/sdl-config --libs)
+
+# Pygame needs a Setup file where options should be commented out if
+# dependencies are not available
+define PYTHON_PYGAME_CONFIGURE_CMDS
+ cp -f $(@D)/Setup.in $(@D)/Setup
+ $(SED) 's~^SDL = ~SDL = $(PYTHON_PYGAME_SDL_FLAGS) \n#~' $(@D)/Setup
+ $(SED) 's/^pypm/#pypm/' $(@D)/Setup
+ $(PYTHON_PYGAME_UNCONFIGURE_IMAGE)
+ $(PYTHON_PYGAME_UNCONFIGURE_FONT)
+ $(PYTHON_PYGAME_UNCONFIGURE_MIXER)
+ $(PYTHON_PYGAME_UNCONFIGURE_SNDARRAY)
+ $(PYTHON_PYGAME_UNCONFIGURE_SURFARRAY)
+ $(PYTHON_PYGAME_UNCONFIGURE_MOVIE)
+ $(PYTHON_PYGAME_UNCONFIGURE_SCRAP)
+endef
+
+define PYTHON_PYGAME_BUILD_CMDS
+ (cd $(@D); CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)" \
+ LDSHARED="$(TARGET_CROSS)gcc -shared" \
+ CROSS_COMPILING=yes \
+ _python_sysroot=$(STAGING_DIR) \
+ _python_srcdir=$(BUILD_DIR)/python$(PYTHON_VERSION) \
+ _python_prefix=/usr \
+ _python_exec_prefix=/usr \
+ $(HOST_DIR)/usr/bin/python setup.py build)
+endef
+
+ifneq ($(BR2_HAVE_DOCUMENTATION),y)
+define PYTHON_PYGAME_REMOVE_DOC
+ rm -rf $(TARGET_DIR)/usr/lib/python*/site-packages/pygame/docs
+endef
+endif
+
+define PYTHON_PYGAME_INSTALL_TARGET_CMDS
+ (cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install \
+ --prefix=$(TARGET_DIR)/usr)
+ rm -rf $(TARGET_DIR)/usr/lib/python*/site-packages/pygame/tests
+ $(PYTHON_PYGAME_REMOVE_DOC)
+endef
+
+define PYTHON_PYGAME_UNINSTALL_TARGET_CMDS
+ rm -rf $(TARGET_DIR)/usr/lib/python*/site-packages/pygame*
+endef
+
+$(eval $(call GENTARGETS))