Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] Add pygame package
@ 2012-01-10 17:57 julien.boibessot at free.fr
  2012-01-10 19:20 ` Peter Korsgaard
  0 siblings, 1 reply; 2+ messages in thread
From: julien.boibessot at free.fr @ 2012-01-10 17:57 UTC (permalink / raw)
  To: buildroot

From: Julien Boibessot <julien.boibessot@armadeus.com>


Signed-off-by: Julien Boibessot <julien.boibessot@armadeus.com>
---
 Changes since v1:
 - moved pygame to package/python-pygame and to "external python modules" menu
   as requested by Yegor Yefremov

 package/Config.in                      |    1 +
 package/python-pygame/Config.in        |   55 ++++++++++++++++
 package/python-pygame/python-pygame.mk |  107 ++++++++++++++++++++++++++++++++
 3 files changed, 163 insertions(+), 0 deletions(-)
 create mode 100644 package/python-pygame/Config.in
 create mode 100644 package/python-pygame/python-pygame.mk

diff --git a/package/Config.in b/package/Config.in
index a82c658..c45cf56 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -242,6 +242,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 0000000..47a1792
--- /dev/null
+++ b/package/python-pygame/Config.in
@@ -0,0 +1,55 @@
+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/
+
+menu "pygame optional modules selection"
+	depends on BR2_PACKAGE_PYTHON_PYGAME
+
+config BR2_PACKAGE_PYTHON_PYGAME_IMAGE
+	bool "pygame.image"
+	depends on BR2_PACKAGE_SDL_IMAGE_PNG && BR2_PACKAGE_SDL_IMAGE_JPEG
+	help
+	  pygame module for loading, saving and transfering images
+
+comment "pygame.image requires sdl_image with png and jpeg support"
+	depends on !BR2_PACKAGE_SDL_IMAGE_PNG || !BR2_PACKAGE_SDL_IMAGE_JPEG
+
+config BR2_PACKAGE_PYTHON_PYGAME_FONT
+	bool "pygame.font"
+	depends on BR2_PACKAGE_SDL_TTF
+	help
+	  pygame module for loading and rendering fonts
+
+comment "pygame.font requires sdl_ttf"
+	depends on !BR2_PACKAGE_SDL_TTF
+
+config BR2_PACKAGE_PYTHON_PYGAME_MIXER
+	bool "pygame.mixer"
+	depends on BR2_PACKAGE_SDL_MIXER
+	help
+	  pygame module for loading and playing sounds
+
+comment "pygame.mixer requires sdl_mixer"
+	depends on !BR2_PACKAGE_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)
+
+endmenu
diff --git a/package/python-pygame/python-pygame.mk b/package/python-pygame/python-pygame.mk
new file mode 100644
index 0000000..8fb52ff
--- /dev/null
+++ b/package/python-pygame/python-pygame.mk
@@ -0,0 +1,107 @@
+#############################################################
+#
+# 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
+
+ifeq ($(BR2_PACKAGE_PYTHON_PYGAME_MOVIE),y)
+PYTHON_PYGAME_OPT_DEPENDS += smpeg
+endif
+
+PYTHON_PYGAME_DEPENDENCIES = python sdl $(PYTHON_PYGAME_OPT_DEPENDS)
+
+ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_IMAGE),y)
+define PYTHON_PYGAME_CONFIGURE_IMAGE
+	$(SED) 's/^imageext/#imageext/' $(@D)/Setup
+endef
+endif
+
+ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_FONT),y)
+define PYTHON_PYGAME_CONFIGURE_FONT
+	$(SED) 's/^font/#font/' $(@D)/Setup
+endef
+endif
+
+ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_MIXER),y)
+define PYTHON_PYGAME_CONFIGURE_MIXER
+	$(SED) 's/^mixer/#mixer/g' $(@D)/Setup
+endef
+endif
+
+ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_SNDARRAY),y)
+define PYTHON_PYGAME_CONFIGURE_SNDARRAY
+	$(SED) 's/^_numericsndarray/#_numericsndarray/' $(@D)/Setup
+endef
+endif
+
+ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_SURFARRAY),y)
+define PYTHON_PYGAME_CONFIGURE_SURFARRAY
+	$(SED) 's/^_numericsurfarray/#_numericsurfarray/' $(@D)/Setup
+endef
+endif
+
+ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_MOVIE),y)
+define PYTHON_PYGAME_CONFIGURE_MOVIE
+	$(SED) 's/^movie/#movie/' $(@D)/Setup
+endef
+endif
+
+ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_SCRAP),y)
+define PYTHON_PYGAME_CONFIGURE_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_CONFIGURE_IMAGE)
+	$(PYTHON_PYGAME_CONFIGURE_FONT)
+	$(PYTHON_PYGAME_CONFIGURE_MIXER)
+	$(PYTHON_PYGAME_CONFIGURE_SNDARRAY)
+	$(PYTHON_PYGAME_CONFIGURE_SURFARRAY)
+	$(PYTHON_PYGAME_CONFIGURE_MOVIE)
+	$(PYTHON_PYGAME_CONFIGURE_SCRAP)
+endef
+
+define PYTHON_PYGAME_BUILD_CMDS
+	(cd $(@D); CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)" \
+		LDSHARED="$(TARGET_CROSS)gcc -shared" \
+		$(HOST_DIR)/usr/bin/python setup.py build)
+endef
+
+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/docs && \
+	rm -rf $(TARGET_DIR)/usr/lib/python*/site-packages/pygame/tests)
+endef
+
+define PYTHON_PYGAME_UNINSTALL_TARGET_CMDS
+	rm -rf $(TARGET_DIR)/usr/lib/python*/site-packages/pygame*
+endef
+
+$(eval $(call GENTARGETS))
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Buildroot] [PATCH v2] Add pygame package
  2012-01-10 17:57 [Buildroot] [PATCH v2] Add pygame package julien.boibessot at free.fr
@ 2012-01-10 19:20 ` Peter Korsgaard
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Korsgaard @ 2012-01-10 19:20 UTC (permalink / raw)
  To: buildroot

>>>>> "julien" == julien boibessot <julien.boibessot@free.fr> writes:

Hi,

 julien> From: Julien Boibessot <julien.boibessot@armadeus.com>
 julien> Signed-off-by: Julien Boibessot <julien.boibessot@armadeus.com>
 julien> ---
 julien>  Changes since v1:
 julien>  - moved pygame to package/python-pygame and to "external python modules" menu
 julien>    as requested by Yegor Yefremov

 julien>  package/Config.in                      |    1 +
 julien>  package/python-pygame/Config.in        |   55 ++++++++++++++++
 julien>  package/python-pygame/python-pygame.mk |  107 ++++++++++++++++++++++++++++++++
 julien>  3 files changed, 163 insertions(+), 0 deletions(-)
 julien>  create mode 100644 package/python-pygame/Config.in
 julien>  create mode 100644 package/python-pygame/python-pygame.mk

 julien> diff --git a/package/Config.in b/package/Config.in
 julien> index a82c658..c45cf56 100644
 julien> --- a/package/Config.in
 julien> +++ b/package/Config.in
 julien> @@ -242,6 +242,7 @@ menu "external python modules"
 julien>  source "package/python-dpkt/Config.in"
 julien>  source "package/python-mad/Config.in"
 julien>  source "package/python-netifaces/Config.in"
 julien> +source "package/python-pygame/Config.in"
 julien>  source "package/python-serial/Config.in"
 julien>  source "package/python-setuptools/Config.in"
 julien>  endmenu
 julien> diff --git a/package/python-pygame/Config.in b/package/python-pygame/Config.in
 julien> new file mode 100644
 julien> index 0000000..47a1792
 julien> --- /dev/null
 julien> +++ b/package/python-pygame/Config.in
 julien> @@ -0,0 +1,55 @@
 julien> +config BR2_PACKAGE_PYTHON_PYGAME
 julien> +	bool "pygame"
 julien> +	depends on BR2_PACKAGE_PYTHON
 julien> +	select BR2_PACKAGE_SDL
 julien> +	help
 julien> +	  Pygame is a cross-platfrom library designed to make it easy to write
 julien> +	  multimedia software, such as games, in Python. Pygame requires the
 julien> +	  Python language and SDL multimedia library.
 julien> +	  It can also make use of several other popular libraries.
 julien> +
 julien> +	  http://www.pygame.org/
 julien> +
 julien> +menu "pygame optional modules selection"
 julien> +	depends on BR2_PACKAGE_PYTHON_PYGAME
 julien> +
 julien> +config BR2_PACKAGE_PYTHON_PYGAME_IMAGE
 julien> +	bool "pygame.image"
 julien> +	depends on BR2_PACKAGE_SDL_IMAGE_PNG && BR2_PACKAGE_SDL_IMAGE_JPEG

SDL_IMAGE is a library, so just select it instead of depends on.

 julien> +	help
 julien> +	  pygame module for loading, saving and transfering images
 julien> +
 julien> +comment "pygame.image requires sdl_image with png and jpeg support"
 julien> +	depends on !BR2_PACKAGE_SDL_IMAGE_PNG || !BR2_PACKAGE_SDL_IMAGE_JPEG

And then drop this comment.

 julien> +
 julien> +config BR2_PACKAGE_PYTHON_PYGAME_FONT
 julien> +	bool "pygame.font"
 julien> +	depends on BR2_PACKAGE_SDL_TTF
 julien> +	help
 julien> +	  pygame module for loading and rendering fonts
 julien> +
 julien> +comment "pygame.font requires sdl_ttf"
 julien> +	depends on !BR2_PACKAGE_SDL_TTF

Same here.

 julien> +
 julien> +config BR2_PACKAGE_PYTHON_PYGAME_MIXER
 julien> +	bool "pygame.mixer"
 julien> +	depends on BR2_PACKAGE_SDL_MIXER
 julien> +	help
 julien> +	  pygame module for loading and playing sounds
 julien> +
 julien> +comment "pygame.mixer requires sdl_mixer"
 julien> +	depends on !BR2_PACKAGE_SDL_MIXER

And here.

 julien> +
 julien> +config BR2_PACKAGE_PYTHON_PYGAME_MIXER_MUSIC
 julien> +	bool "pygame.mixer.music"
 julien> +	depends on BR2_PACKAGE_PYTHON_PYGAME_MIXER
 julien> +	help
 julien> +	  pygame module for controlling streamed audio
 julien> +
 julien> +config BR2_PACKAGE_PYTHON_PYGAME_SCRAP
 julien> +	bool "pygame.scrap"
 julien> +	depends on BR2_PACKAGE_SDL_X11
 julien> +	help
 julien> +	  pygame module for clipboard support (X11 needed)
 julien> +
 julien> +endmenu
 julien> diff --git a/package/python-pygame/python-pygame.mk b/package/python-pygame/python-pygame.mk
 julien> new file mode 100644
 julien> index 0000000..8fb52ff
 julien> --- /dev/null
 julien> +++ b/package/python-pygame/python-pygame.mk
 julien> @@ -0,0 +1,107 @@
 julien> +#############################################################
 julien> +#
 julien> +# Pygame
 julien> +#
 julien> +#############################################################
 julien> +# stable 1.9.1 release requires V4L which has been wiped out of recent Linux
 julien> +# kernels, so use latest mercurial revision until next stable release is out.
 julien> +PYTHON_PYGAME_VERSION = f0bb4a4b365d
 julien> +PYTHON_PYGAME_SOURCE  = pygame-$(PYTHON_PYGAME_VERSION).tar.gz
 julien> +PYTHON_PYGAME_SITE = https://bitbucket.org/pygame/pygame
 julien> +PYTHON_PYGAME_SITE_METHOD = hg
 julien> +
 julien> +ifeq ($(BR2_PACKAGE_PYTHON_PYGAME_IMAGE),y)
 julien> +PYTHON_PYGAME_OPT_DEPENDS += sdl_image
 julien> +endif
 julien> +
 julien> +ifeq ($(BR2_PACKAGE_PYTHON_PYGAME_FONT),y)
 julien> +PYTHON_PYGAME_OPT_DEPENDS += sdl_ttf
 julien> +endif
 julien> +
 julien> +ifeq ($(BR2_PACKAGE_PYTHON_PYGAME_MIXER),y)
 julien> +PYTHON_PYGAME_OPT_DEPENDS += sdl_mixer
 julien> +endif
 julien> +
 julien> +ifeq ($(BR2_PACKAGE_PYTHON_PYGAME_MOVIE),y)
 julien> +PYTHON_PYGAME_OPT_DEPENDS += smpeg
 julien> +endif

Hmm, I didn't see any PYGAME_MOVIE in Config.in?

 julien> +
 julien> +PYTHON_PYGAME_DEPENDENCIES = python sdl $(PYTHON_PYGAME_OPT_DEPENDS)
 julien> +
 julien> +ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_IMAGE),y)
 julien> +define PYTHON_PYGAME_CONFIGURE_IMAGE
 julien> +	$(SED) 's/^imageext/#imageext/' $(@D)/Setup
 julien> +endef
 julien> +endif
 julien> +
 julien> +ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_FONT),y)
 julien> +define PYTHON_PYGAME_CONFIGURE_FONT
 julien> +	$(SED) 's/^font/#font/' $(@D)/Setup
 julien> +endef
 julien> +endif
 julien> +
 julien> +ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_MIXER),y)
 julien> +define PYTHON_PYGAME_CONFIGURE_MIXER
 julien> +	$(SED) 's/^mixer/#mixer/g' $(@D)/Setup
 julien> +endef
 julien> +endif
 julien> +
 julien> +ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_SNDARRAY),y)
 julien> +define PYTHON_PYGAME_CONFIGURE_SNDARRAY
 julien> +	$(SED) 's/^_numericsndarray/#_numericsndarray/' $(@D)/Setup
 julien> +endef
 julien> +endif

This one neither.

 julien> +
 julien> +ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_SURFARRAY),y)
 julien> +define PYTHON_PYGAME_CONFIGURE_SURFARRAY
 julien> +	$(SED) 's/^_numericsurfarray/#_numericsurfarray/' $(@D)/Setup
 julien> +endef
 julien> +endif

Or this one.

 julien> +
 julien> +ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_MOVIE),y)
 julien> +define PYTHON_PYGAME_CONFIGURE_MOVIE
 julien> +	$(SED) 's/^movie/#movie/' $(@D)/Setup
 julien> +endef
 julien> +endif
 julien> +
 julien> +ifneq ($(BR2_PACKAGE_PYTHON_PYGAME_SCRAP),y)
 julien> +define PYTHON_PYGAME_CONFIGURE_SCRAP
 julien> +	$(SED) 's/^scrap/#scrap/' $(@D)/Setup
 julien> +endef
 julien> +endif
 julien> +
 julien> +PYTHON_PYGAME_SDL_FLAGS = $(shell $(STAGING_DIR)/usr/bin/sdl-config --cflags)
 julien> +PYTHON_PYGAME_SDL_FLAGS += $(shell $(STAGING_DIR)/usr/bin/sdl-config --libs)
 julien> +
 julien> +# Pygame needs a Setup file where options should be commented out if
 julien> +# dependencies are not available
 julien> +define PYTHON_PYGAME_CONFIGURE_CMDS
 julien> +	cp -f $(@D)/Setup.in $(@D)/Setup
 julien> +	$(SED) 's<^SDL = <SDL = $(PYTHON_PYGAME_SDL_FLAGS) \n#<' $(@D)/Setup

Minor: We normally use '/' as seperator, and '~' if slashes are possible
in value (like here).

 julien> +	$(SED) 's/^pypm/#pypm/' $(@D)/Setup
 julien> +	$(PYTHON_PYGAME_CONFIGURE_IMAGE)
 julien> +	$(PYTHON_PYGAME_CONFIGURE_FONT)
 julien> +	$(PYTHON_PYGAME_CONFIGURE_MIXER)
 julien> +	$(PYTHON_PYGAME_CONFIGURE_SNDARRAY)
 julien> +	$(PYTHON_PYGAME_CONFIGURE_SURFARRAY)
 julien> +	$(PYTHON_PYGAME_CONFIGURE_MOVIE)
 julien> +	$(PYTHON_PYGAME_CONFIGURE_SCRAP)
 julien> +endef
 julien> +
 julien> +define PYTHON_PYGAME_BUILD_CMDS
 julien> +	(cd $(@D); CC="$(TARGET_CC)" CFLAGS="$(TARGET_CFLAGS)" \
 julien> +		LDSHARED="$(TARGET_CROSS)gcc -shared" \
 julien> +		$(HOST_DIR)/usr/bin/python setup.py build)
 julien> +endef
 julien> +
 julien> +define PYTHON_PYGAME_INSTALL_TARGET_CMDS
 julien> +	(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr && \
 julien> +	rm -rf $(TARGET_DIR)/usr/lib/python*/site-packages/pygame/docs && \
 julien> +	rm -rf $(TARGET_DIR)/usr/lib/python*/site-packages/pygame/tests)
 julien> +endef

docs should only get removed if !BR2_HAVE_DOCUMENTATION.

Otherwise it looks good. Care to fix and resubmit?

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-10 19:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-10 17:57 [Buildroot] [PATCH v2] Add pygame package julien.boibessot at free.fr
2012-01-10 19:20 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox