Add PYGAME in MINI2440

bullt1980
HI,

I have installed the PTXDist in my MINI2440 64MB N35 with PYTHON but I need
install the PYGAME.

Does somebody know how I can do it?

Thanks

davef
You can cross-compile PYGAME using the toolchain you installed with PTXdist
and then manually add the resultant file(s) into your root filesystem

OR

you could learn how to write the rule files required to do it like PTXdist
used to cross-compile Python.

On the Pengutronix site there is another document called:

OSELAS.BSP-Pengutronix-Generic-arm-Quickstart.pdf 

The key word you want to read about is <ptxdist newpackage --help>

You probably want <ptxdist newpackage src-make-prog>

Wingston wrote a good tutorial, but his site is down . . . maybe someone
has saved that article. There is or was one bug, something to do with a
missing version number near the beginning of one of the rule files
produced.

Have a go and see where you get to.

davef

BullT
Thanks Davef

I will try to cross-compile PYGAME using the toolchain.

I will go and I will see where I get to.

BullT

BullT
Dear all,

I'm trying to do a ruler to install pygame in MINI2440 but I have some
troubles to do it.
Could somebody take one hand to do the ruler?
These are my pygame.in and pygame.make

****************** pygame.in ***********************

## SECTION=python

menuconfig PYGAME
  tristate
  select PYTHON 
  prompt "pygame                        "
  help
    This module encapsulates the pygame

if PYGAME

config PYTHON_PYGAME_IMAGE
  bool  
  prompt "pygame.image"
  select SDL_IMAGE
  select SDL_IMAGE_PNG
  select SDL_IMAGE_JPEG
  help
    pygame module for loading, saving and transfering images.
    Will autoselect sdl_image with png and jpeg support.

config PYTHON_PYGAME_FONT
  bool
  prompt "pygame.font"
  select SDL_TTF
  help
    pygame module for loading and rendering fonts.
    Will autoselect sdl_ttf.

config PYTHON_PYGAME_MIXER
  bool
  prompt "pygame.mixer"
  select SDL_MIXER
  help
    pygame module for loading and playing sounds.
    Will autoselect sdl_mixer.

config PYTHON_PYGAME_MIXER_MUSIC
  bool
  prompt "pygame.mixer.music"
  depends on PYTHON_PYGAME_MIXER
  help
    pygame module for controlling streamed audio

config PYTHON_PYGAME_SCRAP
  bool
  prompt "pygame.scrap"
  depends on SDL_XORG
  help
    pygame module for clipboard support (X11 needed)

endif


****************** pygame.make ***********************

# -*-makefile-*-
#
# Copyright (C) 2012 by <>
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
PACKAGES-$(PTXCONF_PYGAME) += pygame

#
# Paths and names
#
PYGAME_VERSION  := 1.9.1release
PYGAME_MD5  := 1c4cdc708d17c8250a2d78ef997222fc
PYGAME    := pygame-$(PYGAME_VERSION)
PYGAME_SUFFIX  := tar.gz
PYGAME_URL  := http://www.pygame.org/ftp/$(PYGAME).$(PYGAME_SUFFIX)
PYGAME_SOURCE  := $(SRCDIR)/$(PYGAME).$(PYGAME_SUFFIX)
PYGAME_DIR  := $(BUILDDIR)/$(PYGAME)
PYGAME_LICENSE  := unknown


#
----------------------------------------------------------------------------
# Prepare
#
----------------------------------------------------------------------------

PYGAME_PATH  := PATH=$(CROSS_PATH)
PYGAME_CONF_TOOL  := NO
PYGAME_MAKE_ENV  := $(CROSS_ENV)


#
----------------------------------------------------------------------------
# Compile
#
----------------------------------------------------------------------------

$(STATEDIR)/pygame.compile:
  @$(call targetinfo)
  @$(call touch)

#
----------------------------------------------------------------------------
# Install
#
----------------------------------------------------------------------------

$(STATEDIR)/pygame.install:
  @$(call targetinfo)
  @cd $(PYGAME_DIR) && \
    $(PYGAME_PATH) $(PYGAME_MAKE_ENV) \
    python setup.py install --root=$(PYGAME_PKGDIR) --prefix=/usr
  @$(call touch)

#
----------------------------------------------------------------------------
# Target-Install
#
----------------------------------------------------------------------------

$(STATEDIR)/pygame.targetinstall:
  @$(call targetinfo)

  @$(call install_init, pygame)
  @$(call install_fixup, pygame,PRIORITY,optional)
  @$(call install_fixup, pygame,SECTION,base)
  @$(call install_fixup, pygame,AUTHOR,"BullT1980")
  @$(call install_fixup, pygame,DESCRIPTION, "PYGame for Python")

  @$(call install_copy, pygame, 0, 0, 0755, $(PYTHON_SITEPACKAGES))
  @$(call install_copy, pygame, 0, 0, 0755, $(PYTHON_SITEPACKAGES)/serial)
  @$(call install_copy, pygame, 0, 0, 0755,
$(PYTHON_SITEPACKAGES)/serial/tools)
  @$(call install_copy, pygame, 0, 0, 0755,
$(PYTHON_SITEPACKAGES)/serial/urlhandler)

  @for file in $(shell cd $(PYGAME_PKGDIR) && find . -name "*.pyc"); \
  do \
    $(call install_copy, pygame, 0, 0, 0644, -, /$$file); \
  done

  @$(call install_finish, pygame)

  @$(call touch)

# vim: syntax=make

*******************************************************************

Thanks a lot

davef
One issue that will really upset PTXdist is if the line endings are not
Linux line endings.  

sed 's/.$//' daves_new.in > daves_rootfs.in

Of course change all files names to something more appropriate to you!

Maybe, tell us what the error msg is.

BullT
Dear DaveF,

Please see below text output after I run ptxdist go:

[bullt@z800 OSELAS.BSP-Pengutronix-Mini2440-2012.06.0]$ ptxdist go
/usr/local/lib/ptxdist-2012.09.1/rules/host-libusb.in:3:warning: type of
'HOST_LIBUSB' redefined from 'boolean' to 'tristate'
/home/bullt/Downloads/OSELAS.BSP-Pengutronix-Mini2440-2012.06.0/rules/pygame.in:
16:warning:
'select' used by config symbol 'PYTHON_PYGAME_IMAGE' refers to undefined
symbol 'SDL_IMAGE_PNG'
/home/bullt/Downloads/OSELAS.BSP-Pengutronix-Mini2440-2012.06.0/rules/pygame.in:
17:warning:
'select' used by config symbol 'PYTHON_PYGAME_IMAGE' refers to undefined
symbol 'SDL_IMAGE_JPEG'
/usr/local/lib/ptxdist-2012.09.1/rules/host-libusb.in:3:warning: type of
'HOST_LIBUSB' redefined from 'boolean' to 'tristate'
/home/bullt/Downloads/OSELAS.BSP-Pengutronix-Mini2440-2012.06.0/rules/pygame.in:
16:warning:
'select' used by config symbol 'PYTHON_PYGAME_IMAGE' refers to undefined
symbol 'SDL_IMAGE_PNG'
/home/bullt/Downloads/OSELAS.BSP-Pengutronix-Mini2440-2012.06.0/rules/pygame.in:
17:warning:
'select' used by config symbol 'PYTHON_PYGAME_IMAGE' refers to undefined
symbol 'SDL_IMAGE_JPEG'

----------------------
target: pygame.install
----------------------

running install
running build
running build_py
running build_ext
building 'pygame.scrap' extension
arm-v4t-linux-gnueabi-gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv
-O3 -Wall -Wstrict-prototypes -isystem
/home/bullt/Downloads/OSELAS.BSP-Pengutronix-Mini2440-2012.06.0/platform-mini244
0/sysroot-target/include
-isystem
/home/bullt/Downloads/OSELAS.BSP-Pengutronix-Mini2440-2012.06.0/platform-mini244
0/sysroot-target/usr/include
-fPIC -D_REENTRANT -I/usr/X11R6/include
-I/home/bullt/Downloads/OSELAS.BSP-Pengutronix-Mini2440-2012.06.0/platform-mini2
440/sysroot-target/usr/include/SDL
-I/home/bullt/Downloads/OSELAS.BSP-Pengutronix-Mini2440-2012.06.0/platform-mini2
440/sysroot-target/usr/include/python2.6
-c src/scrap.c -o build/temp.linux-x86_64-2.6/src/scrap.o
In file included from
/home/bullt/Downloads/OSELAS.BSP-Pengutronix-Mini2440-2012.06.0/platform-mini244
0/sysroot-target/usr/include/python2.6/Python.h:8:0,
                 from src/scrap.h:22,
                 from src/scrap.c:30:
/home/bullt/Downloads/OSELAS.BSP-Pengutronix-Mini2440-2012.06.0/platform-mini244
0/sysroot-target/usr/include/python2.6/pyconfig.h:1079:0:
warning: "_POSIX_C_SOURCE" redefined [enabled by default]
/opt/OSELAS.Toolchain-2011.11.3/arm-v4t-linux-gnueabi/gcc-4.6.2-glibc-2.14.1-bin
utils-2.21.1a-kernel-2.6.39-sanitized/sysroot-arm-v4t-linux-gnueabi/usr/include/
features.h:215:0:
note: this is the location of the previous definition
src/scrap.c:73:6: error: #error Unknown window manager for clipboard
handling
src/scrap.c: In function 'initscrap':
src/scrap.c:329:15: warning: variable 'mod' set but not used
[-Wunused-but-set-variable]
src/scrap.c: At top level:
src/scrap.c:116:1: warning: '_scrap_get_types' defined but not used
[-Wunused-function]
src/scrap.c:157:1: warning: '_scrap_contains' defined but not used
[-Wunused-function]
src/scrap.c:175:1: warning: '_scrap_get_scrap' defined but not used
[-Wunused-function]
src/scrap.c:221:1: warning: '_scrap_put_scrap' defined but not used
[-Wunused-function]
src/scrap.c:268:1: warning: '_scrap_lost_scrap' defined but not used
[-Wunused-function]
src/scrap.c:285:1: warning: '_scrap_set_mode' defined but not used
[-Wunused-function]
src/scrap.c:92:1: warning: '_scrap_init' defined but not used
[-Wunused-function]
error: command 'arm-v4t-linux-gnueabi-gcc' failed with exit status 1
make: ***
[/home/bullt/Downloads/OSELAS.BSP-Pengutronix-Mini2440-2012.06.0/platform-mini24
40/state/pygame.install]
Error 1
[bullt@z800 OSELAS.BSP-Pengutronix-Mini2440-2012.06.0]$ 

What can I do to solve this error?

BullT
Hi DaveF,

I solved the last issue and now I have pygame in Mini2440 but when I import
pygame inside python appear this:

root@mini2440:/usr/lib/python2.6/site-packages/pygame python               
    
Python 2.6.6 (r266:84292, Oct 18 2012, 19:33:04)                           
    
[GCC 4.6.2] on linux2                                                      
    
Type "help", "copyright", "credits" or "license" for more information.     
    
>>> import pygame                                                          
    
Traceback (most recent call last):                                         
    
  File "<stdin>", line 1, in <module>                                      
    
  File "/usr/lib/python2.6/site-packages/pygame/__init__.py", line 95, in
<modu>
ImportError: No module named base                                          
    
>>>   

Do you know why?

Thanks

davef
Sorry, I have no idea.