Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3] Add pygame package
@ 2012-01-11  7:24 julien.boibessot at free.fr
  2012-01-11  8:33 ` Peter Korsgaard
  0 siblings, 1 reply; 5+ messages in thread
From: julien.boibessot at free.fr @ 2012-01-11  7:24 UTC (permalink / raw)
  To: buildroot

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


Signed-off-by: Julien Boibessot <julien.boibessot@armadeus.com>
---
 Changes since v2:
 As requested by Peter Korsgaard:
 - autoselect sdl_* libs instead of depending of them
 - removed movie/sndarray/surfarray config check (will be re-added when
   smpeg/numpy are integrated in BR)
 - remove doc only if !BR2_HAVE_DOCUMENTATION
 Other:
 - renamed PYTHON_PYGAME_CONFIGURE_* in PYTHON_PYGAME_UNCONFIGURE_* to better
   understand that we remove modules from default build config if dependancies
   are not available

 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        |   51 +++++++++++++++
 package/python-pygame/python-pygame.mk |  106 ++++++++++++++++++++++++++++++++
 3 files changed, 158 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..8320ab5
--- /dev/null
+++ b/package/python-pygame/Config.in
@@ -0,0 +1,51 @@
+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"
+	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)
+
+endmenu
diff --git a/package/python-pygame/python-pygame.mk b/package/python-pygame/python-pygame.mk
new file mode 100644
index 0000000..6bebe3c
--- /dev/null
+++ b/package/python-pygame/python-pygame.mk
@@ -0,0 +1,106 @@
+#############################################################
+#
+# 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" \
+		$(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))
-- 
1.7.5.4

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

* [Buildroot] [PATCH v3] Add pygame package
  2012-01-11  7:24 [Buildroot] [PATCH v3] Add pygame package julien.boibessot at free.fr
@ 2012-01-11  8:33 ` Peter Korsgaard
  2012-01-11  9:32   ` Julien Boibessot
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Korsgaard @ 2012-01-11  8:33 UTC (permalink / raw)
  To: buildroot

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

 julien> From: Julien Boibessot <julien.boibessot@armadeus.com>
 julien> Signed-off-by: Julien Boibessot <julien.boibessot@armadeus.com>
 julien> ---
 julien>  Changes since v2:
 julien>  As requested by Peter Korsgaard:
 julien>  - autoselect sdl_* libs instead of depending of them
 julien>  - removed movie/sndarray/surfarray config check (will be re-added when
 julien>    smpeg/numpy are integrated in BR)
 julien>  - remove doc only if !BR2_HAVE_DOCUMENTATION
 julien>  Other:
 julien>  - renamed PYTHON_PYGAME_CONFIGURE_* in PYTHON_PYGAME_UNCONFIGURE_* to better
 julien>    understand that we remove modules from default build config if dependancies
 julien>    are not available

Thanks, looks good. Unfortunately it doesn't work:

building 'pygame.gfxdraw' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
creating build/temp.linux-x86_64-2.7/src/SDL_gfx
/home/peko/source/buildroot/output/host/usr/bin/arm-linux-gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -pipe -Os -fPIC -D_GNU_SOURCE= -D_REENTRANT -I/home/peko/source/buildroot/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include/SDL -I/home/peko/source/buildroot/output/host/usr/include/python2.7 -c src/gfxdraw.c -o build/temp.linux-x86_64-2.7/src/gfxdraw.o
In file included from /home/peko/source/buildroot/output/host/usr/include/python2.7/Python.h:8,
                 from src/pygame.h:80,
                 from src/gfxdraw.c:33:
/home/peko/source/buildroot/output/host/usr/include/python2.7/pyconfig.h:1136:1: warning: "_GNU_SOURCE" redefined
<command-line>: warning: this is the location of the previous definition
In file included from /home/peko/source/buildroot/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include/limits.h:27,
                 from /opt/br/arm926t-wchar/usr/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.6/include-fixed/limits.h:122,
                 from /opt/br/arm926t-wchar/usr/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.6/include-fixed/syslimits.h:7,
                 from /opt/br/arm926t-wchar/usr/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.6/include-fixed/limits.h:11,
                 from /home/peko/source/buildroot/output/host/usr/include/python2.7/Python.h:19,
                 from src/pygame.h:80,
                 from src/gfxdraw.c:33:
/home/peko/source/buildroot/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include/features.h:219:5:
error: #error It appears you have defined
_FILE_OFFSET_BITS=64. Unfortunately, uClibc was built without large file
support enabled.

Notice how it is looking at my host-python rather than target-python
(where I don't have largefile support) includes.

Any idea?

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH v3] Add pygame package
  2012-01-11  8:33 ` Peter Korsgaard
@ 2012-01-11  9:32   ` Julien Boibessot
  2012-01-11  9:54     ` Peter Korsgaard
  0 siblings, 1 reply; 5+ messages in thread
From: Julien Boibessot @ 2012-01-11  9:32 UTC (permalink / raw)
  To: buildroot

On 01/11/2012 09:33 AM, Peter Korsgaard wrote:
> Thanks, looks good. Unfortunately it doesn't work:
>
> building 'pygame.gfxdraw' extension
> creating build/temp.linux-x86_64-2.7
> creating build/temp.linux-x86_64-2.7/src
> creating build/temp.linux-x86_64-2.7/src/SDL_gfx
> /home/peko/source/buildroot/output/host/usr/bin/arm-linux-gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -pipe -Os -fPIC -D_GNU_SOURCE= -D_REENTRANT -I/home/peko/source/buildroot/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include/SDL -I/home/peko/source/buildroot/output/host/usr/include/python2.7 -c src/gfxdraw.c -o build/temp.linux-x86_64-2.7/src/gfxdraw.o
> In file included from /home/peko/source/buildroot/output/host/usr/include/python2.7/Python.h:8,
>                   from src/pygame.h:80,
>                   from src/gfxdraw.c:33:
> /home/peko/source/buildroot/output/host/usr/include/python2.7/pyconfig.h:1136:1: warning: "_GNU_SOURCE" redefined
> <command-line>: warning: this is the location of the previous definition
> In file included from /home/peko/source/buildroot/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include/limits.h:27,
>                   from /opt/br/arm926t-wchar/usr/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.6/include-fixed/limits.h:122,
>                   from /opt/br/arm926t-wchar/usr/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.6/include-fixed/syslimits.h:7,
>                   from /opt/br/arm926t-wchar/usr/lib/gcc/arm-unknown-linux-uclibcgnueabi/4.3.6/include-fixed/limits.h:11,
>                   from /home/peko/source/buildroot/output/host/usr/include/python2.7/Python.h:19,
>                   from src/pygame.h:80,
>                   from src/gfxdraw.c:33:
> /home/peko/source/buildroot/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include/features.h:219:5:
> error: #error It appears you have defined
> _FILE_OFFSET_BITS=64. Unfortunately, uClibc was built without large file
> support enabled.
>
> Notice how it is looking at my host-python rather than target-python
> (where I don't have largefile support) includes.
>
> Any idea?

Oups. I missed that one because error seems to occur only when the Host 
is a 64bits architecture (I have a 32 bits Host).
Seems like a problem in distutils that adds 
"-I/home/peko/source/buildroot/output/host/usr/include/python2.7" when 
compiling, which isn't a problem when Host and Target python 
installations match.

You have the same problem (include added) in python-mad package. Does it 
compile on your Host ?

Trying to find a solution...

Regards,
Julien

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

* [Buildroot] [PATCH v3] Add pygame package
  2012-01-11  9:32   ` Julien Boibessot
@ 2012-01-11  9:54     ` Peter Korsgaard
  2012-01-11 11:09       ` Julien Boibessot
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Korsgaard @ 2012-01-11  9:54 UTC (permalink / raw)
  To: buildroot

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

Hi,

 >> Any idea?

 Julien> Oups. I missed that one because error seems to occur only when the
 Julien> Host is a 64bits architecture (I have a 32 bits Host).
 Julien> Seems like a problem in distutils that adds
 Julien> "-I/home/peko/source/buildroot/output/host/usr/include/python2.7" when
 Julien> compiling, which isn't a problem when Host and Target python
 Julien> installations match.

 Julien> You have the same problem (include added) in python-mad package. Does
 Julien> it compile on your Host ?

It does compile here. Presumably because of the --include-dirs, even
though it ends up adding both an -I for host-python and target-python
(but target is first, so used) which isn't really nice:

building 'madmodule' extension
creating build
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
/home/peko/source/buildroot/output/host/usr/bin/arm-linux-gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -pipe -Os -fPIC -DVERSION_MAJOR=0 -DVERSION_MINOR=6 -DVERSION="0.6" -I/home/peko/source/buildroot/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include -I/home/peko/source/buildroot/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include/python2.7 -I/home/peko/source/buildroot/output/host/usr/include/python2.7 -c src/madmodule.c -o build/temp.linux-x86_64-2.7/src/madmodule.o

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH v3] Add pygame package
  2012-01-11  9:54     ` Peter Korsgaard
@ 2012-01-11 11:09       ` Julien Boibessot
  0 siblings, 0 replies; 5+ messages in thread
From: Julien Boibessot @ 2012-01-11 11:09 UTC (permalink / raw)
  To: buildroot

On 01/11/2012 10:54 AM, Peter Korsgaard wrote:
>   Julien>  You have the same problem (include added) in python-mad package. Does
>   Julien>  it compile on your Host ?
>
> It does compile here. Presumably because of the --include-dirs, even
> though it ends up adding both an -I for host-python and target-python
> (but target is first, so used) which isn't really nice:
>
> building 'madmodule' extension
> creating build
> creating build/temp.linux-x86_64-2.7
> creating build/temp.linux-x86_64-2.7/src
> /home/peko/source/buildroot/output/host/usr/bin/arm-linux-gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -pipe -Os -fPIC -DVERSION_MAJOR=0 -DVERSION_MINOR=6 -DVERSION="0.6" -I/home/peko/source/buildroot/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include -I/home/peko/source/buildroot/output/host/usr/arm-unknown-linux-uclibcgnueabi/sysroot/usr/include/python2.7 -I/home/peko/source/buildroot/output/host/usr/include/python2.7 -c src/madmodule.c -o build/temp.linux-x86_64-2.7/src/madmodule.o
>

can you try my v4 patch version please ? I used Thomas distutils 
cross-compilation modifications to prevent Host include usage.

Regards,
Julien

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

end of thread, other threads:[~2012-01-11 11:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-11  7:24 [Buildroot] [PATCH v3] Add pygame package julien.boibessot at free.fr
2012-01-11  8:33 ` Peter Korsgaard
2012-01-11  9:32   ` Julien Boibessot
2012-01-11  9:54     ` Peter Korsgaard
2012-01-11 11:09       ` Julien Boibessot

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