Commits

Anonymous committed 3ffbdf0

- Support for bmp, gif, jpg, tga images
- Added building of pygame_jpeg.dll
- Enabled "-O2 -fno-unit-at-a-time" for all

Comments (0)

Files changed (9)

  *  the extended load and save functions, which are autmatically used
  *  by the normal pygame.image module if it is available.
  */
+// This is temporal until PNG support is done for Symbian
+#ifdef __SYMBIAN32__
+#include <stdio.h>
+#else
 #include <png.h>
+#endif
 #include <jpeglib.h>
+
+
 /* Remove GCC macro redefine warnings. */
 #if defined(HAVE_STDDEF_H)  /* also defined in pygame.h (python.h) */
 #undef HAVE_STDDEF_H
 
 #ifdef __SYMBIAN32__
 #undef MODPREFIX
+#undef IMPPREFIX
 // On Symbian there is no pygame package. The extensions are built-in or in sys\bin.
 #define MODPREFIX "pygame_"
 #define IMPPREFIX "pygame_"

symbian/BuildPygameRelease.py

 BASE_CMD = "scons dosis=true"
 
 UID_PACKAGE   = 0xE0006020
-UID_PYGAMEAPP = UID_PACKAGE + 1
-UID_SDL       = UID_PYGAMEAPP + 1
+__uid = UID_PACKAGE 
+def getuid(): 
+    global __uid
+    __uid += 1
+    return __uid  
+
+UID_PYGAMEAPP = getuid()
+UID_SDL       = getuid()
+UID_JPEG      = getuid()
 
 #: Base uid for PyS60 CE scripts
-UID_BASE = UID_SDL + 1
+UID_BASE = getuid()
 
 #: Capability configuration
 CAPABILITIES = CAPS_SELF_SIGNED[:]
              'libpath'      : "data/pygame/libs",
              }
     
-    # Build PyS60 
-    curdir = os.getcwd()
-    os.chdir(config.pys60_ce_src)
+    # Build PyS60 CE
+    sisname   = ""  
+    if config.build_python:
+        curdir = os.getcwd()
+        os.chdir(config.pys60_ce_src)                
+        dobuild(args)    
+        os.chdir(curdir)
     
-    if config.build_python:
-        dobuild(args)
+        sisname = "python_for_pygame_%s_signed.sisx" % version
+        pys60_sis = os.path.join( config.pys60_ce_src, sisname )
+                
+        # Copy the sis to current directory
+        import shutil
+        shutil.copyfile(pys60_sis, sisname)
     
-    os.chdir(curdir)
+    else:
+        sisname = config.pys60_sis
     
-    sisname = "python_for_pygame_%s_signed.sisx" % version
-    sissource = os.path.join( config.pys60_ce_src, sisname )
-    
-    # Copy the sis to current directory
-    import shutil
-    shutil.copyfile(sissource, sisname)
      
     # Build pygame
     args["pythonsis"]  = sisname
     args['sisuid'] = hex(UID_PACKAGE).replace("L","")
     args['appuid'] = hex(UID_PYGAMEAPP).replace("L","")
     args['sdluid'] = hex(UID_SDL).replace("L","")
-    
+    args['jpeguid']= hex(UID_JPEG).replace("L","")
     dobuild(args)
     
     

symbian/SConscript.SDL.py

 
 target     = TARGET_NAME
 targettype = "dll"
+
+
+includes    = [ 'deps/SDL/src', 'deps/SDL/src/video', 
+                'deps/SDL/src/events', 'deps/SDL/src/audio', 
+                'deps/SDL/src/audio/symbian', 'deps/SDL/src/main/symbian', 
+                'deps/SDL/src/video/symbian', 'deps/SDL/src/thread', 
+                'deps/SDL/src/thread/generic', 'deps/SDL/src/thread/symbian', 
+                'deps/SDL/src/timer', 'deps/SDL/src/joystick', 
+                'deps/SDL/symbian/inc', 'deps/SDL/inc/internal']
+
+sysincludes = ['deps/SDL/include', '/epoc32/include', 
+               'inc', '/epoc32/include/SDL', 
+               '/epoc32/include/gles', 
+               '/epoc32/include/EGL', 
+               '/epoc32/include/libc', 
+               ]
+
 libraries  = ['euser',
  'fbscli',
  'ws32',
 # 'libm',
  'estlib']
 
-# Static libs
-libraries = [ 'vorbis.lib', 'ogg.lib', 'SDL_ttf.lib', 'libsft2.lib'] + libraries
-
+# Static libraries
+staticlibs = [ 'vorbis.lib', 'ogg.lib', 
+             'SDL_ttf.lib', 
+             'libsft2.lib',
+             'pygame_libjpeg'
+             ]
+defines = []
 sources = ['deps/SDL/symbian/src/vectorbuffer.cpp',
  'deps/SDL/symbian/src/sdlappsrv.cpp',
  'deps/SDL/symbian/src/sdlenv.cpp',
 sources += [
  'deps/SDL_mixer/mixer.c',
  'deps/SDL_mixer/music.c',
- 'deps/SDL_mixer/playwave.c',
+ #'deps/SDL_mixer/playwave.c',
  'deps/SDL_mixer/wavestream.c',
  'deps/SDL_mixer/effects_internal.c',
  'deps/SDL_mixer/effect_position.c',
  'deps/SDL_mixer/dynamic_ogg.c',
  'deps/SDL_mixer/music_ogg.c',
 ]
+sysincludes += ['deps/vorbis/include', 
+               'deps/vorbis/include/vorbis', 
+               'deps/ogg/include', 
+               'deps/ogg/include/ogg']
+
+defines += [ 'WAV_MUSIC', 'OGG_MUSIC', ]
 
 # Configure SDL_ttf
 sources += [
  'deps/SDL_ttf/SDL_ttf.c',
 ]
 
+# Configure SDL_image
+sources += Glob('deps/SDL_image/IMG*.c',)
+defines += [
+            'LOAD_JPG',
+            'LOAD_BMP',
+            'LOAD_GIF',
+            'LOAD_TGA'
+            #'LOAD_PNG' # requires glib. We need OpenC
+            ]
+sysincludes += [
+    'deps/jpeg/', 
+]
 
-includes    = [ 'deps/SDL/src', 'deps/SDL/src/video', 
-                'deps/SDL/src/events', 'deps/SDL/src/audio', 
-                'deps/SDL/src/audio/symbian', 'deps/SDL/src/main/symbian', 
-                'deps/SDL/src/video/symbian', 'deps/SDL/src/thread', 
-                'deps/SDL/src/thread/generic', 'deps/SDL/src/thread/symbian', 
-                'deps/SDL/src/timer', 'deps/SDL/src/joystick', 
-                'deps/SDL/symbian/inc', 'deps/SDL/inc/internal']
-sysincludes = ['deps/SDL/include', '/epoc32/include', 'inc', '/epoc32/include/SDL', '/epoc32/include/gles', '/epoc32/include/EGL', '/epoc32/include/libc', 'deps/vorbis/include', 'deps/vorbis/include/vorbis', 'deps/ogg/include', 'deps/ogg/include/ogg']
-defines     = ['SYMBIANC', 'SYMBIAN_SERIES60', 'NO_SIGNAL_H', 'ENABLE_EPOC', 'DISABLE_JOYSTICK', 'DISABLE_CDROM', 'WAV_MUSIC', 'OGG_MUSIC']
+
+
+defines     +=['SYMBIANC', 'SYMBIAN_SERIES60', 
+               'NO_SIGNAL_H', 'ENABLE_EPOC', 
+               'DISABLE_JOYSTICK', 'DISABLE_CDROM',                
+               ]
 
 includes += ["deps/SDL_ttf/", "deps/sft2/inc/sys"]
 
     sources = sources,
     includes    = includes,
     sysincludes = sysincludes,
-    libraries   = libraries,
+    libraries   = staticlibs + libraries,
     defines     = defines,
     capabilities = CAPABILITIES,
     uid3 = UID3,

symbian/SConscript.Vorbis.py

     sysincludes = sysincludes,
     libraries   = libraries,
     defines     = defines,
-    epocstacksize = 8192,
-    epocheapsize  = (0x400,0x100000),
     uid3 = uid3,
 )
 

symbian/SConscript.app.py

                              PYTHON_LIB_NAME,
                              SDL_DLL_NAME,
                              "pygame.lib",
+                             'pygame_libjpeg',
                              #"LogMan"
                              ],
                 uid3=UID_PYGAMEAPP,

symbian/SConscript.pygame.py

 #music.c
 #mixer.c
 #font.c
+#imageext.c
 ignored = r"""
 camera.c
 ffmovie.c
-imageext.c
 movie.c
 movieext.c
 pixelarray_methods.c
                 defines = [                    
                 ],
                 includes = python_includes + [
-                             "common",
+                             "common",                             
+                             join( "deps", "jpeg"),
+                             join( "deps", "SDL_image"),
                              join( EPOC32_INCLUDE, "SDL"),
                              join( EPOC32_INCLUDE, "libc"),                             
                              #join( "..", "..", "tools", "debug" )

symbian/SConstruct

 from scons_symbian import *
 
+gcce.GCCE_OPTIMIZATION_FLAGS = "-O2 -fno-unit-at-a-time"
+
 # Pygame's installer package
 PACKAGE_NAME = ARGUMENTS.get( "package",    "pygame.sis" )
 PACKAGE_TITLE = ARGUMENTS.get( "sisappname", "pygame for S60" )
 PATH_PY_LIBS = ARGUMENTS.get( "pylibs", "data/pygame/libs" )
 #: Name of the used sdl.dll ( pygame_sdl.dll )
 SDL_DLL_NAME = ARGUMENTS.get( "sdldll", "pygame_sdl" )
+#: Name of the used jpeg.dll
+JPEG_DLL_NAME = ARGUMENTS.get( "jpegdll", "pygame_libjpeg" )
 
-UID_PACKAGE   = ARGUMENTS.get( "sisuid" )
-UID_PYGAMEAPP = ARGUMENTS.get( "appuid" )
-UID_SDL       = ARGUMENTS.get( "sdluid" )
+UID_PACKAGE    = ARGUMENTS.get( "sisuid" )
+UID_PYGAMEAPP  = ARGUMENTS.get( "appuid" )
+UID_SDL        = ARGUMENTS.get( "sdluid" )
+UID_JPEG       = ARGUMENTS.get( "jpeguid" )
 
-CAPABILITIES  = ARGUMENTS.get( "capabilities", CAPS_SELF_SIGNED).split("+")
+CAPABILITIES  = ARGUMENTS.get( "capabilities", "").split("+")
+if len(CAPABILITIES) == 0: CAPABILITIES = CAPS_SELF_SIGNED
+
 SISVERSION    = ARGUMENTS.get( "sisversion", "1,0,0").split(",")
 PYTHON_INCLUDE = ARGUMENTS.get( "pythoninclude", EPOC32_INCLUDE + "/python")
 
 if ARGUMENTS.get( "buildlibs", True ):
     SConscript( "SConscript.sft2.py" )
     SConscript( "SConscript.Ogg.py" )    
-    SConscript( "SConscript.Vorbis.py" )    
+    SConscript( "SConscript.Vorbis.py" )
+    
+    UID3 = UID_JPEG
+    TARGET_NAME = JPEG_DLL_NAME  
+    Export("TARGET_NAME UID3")
+    SConscript( "SConscript.jpeg.py" )  
     
     TARGET_NAME = SDL_DLL_NAME  
     UID3        = UID_SDL     

symbian/how_to_build.txt

 
 === Getting necessary libraries ===
 
+Run 'makeref.py --no-code-docs'
+- This regenerates pygame module documentation without documentation in code.
+
 Create symbian/deps directory
 
-Get ogg to symbian/deps/ogg
+Checkout ogg to symbian/deps/ogg
 - IMPORTANT: Revision 7524
 - SVN: http://svn.xiph.org/trunk/ogg 
 
-Get vorbis to symbian/deps/vorbis
+Checkout vorbis to symbian/deps/vorbis
 - IMPORTANT: Revision 7543
 - SVN: http://svn.xiph.org/trunk/vorbis
 
 - SVN: https://sft2.svn.sourceforge.net/svnroot/sft2/trunk/sft2
 
 
-=== Building ===
+Get SDL_image to symbian/deps/SDL_image
+- http://www.libsdl.org/projects/SDL_image/
+
+
+Checkout jpeg library to symbian/deps/jpeg
+- https://movino.svn.sourceforge.net/svnroot/movino/libjpeg/trunk
+
+
 
 - The build scripts use SCons for Symbian. 
 -- http://code.google.com/p/scons-for-symbian/
 -- Follow the installation instructions
 
-- Go to pygame/symbian directory and invoke 'scons'
+
+=== Building ===
+
+==== Using the release building script ====
+- Go to pygame/symbian directory
+
+The pygame can be built against the official(or any) pys60 version. 
+Initialize the release script by giving it information about the python dll to be linked with
+and the sis file to be embedded with it's UID.
+- TODO: Not implemented yet!!
+- configure.py --pythondll=python222 --pys60-embed=Python_1.4.5_3rdEd.sis
+- configure.py --pythondll=python25  --pys60-embed=Python_1.9.0_3rdEd.sis
+
+or
+
+- Use BuildPygameRelease.py script to build the 'pygame_python' with PyS60 Community Edition,
+  the depended libraries and the pygame itself. All in one.
+- Give the path to the PyS60 CE's 'src' directory as a parameter for the script 
+- The CE version is used to do some customizations for the Python installation. 
+- The above parameters are handled automatically in that case.
+- Of course, you can build the PyS60 CE manually and configure the build script as above.
+
+configure.py --pys60-ce=\projects\pys60ce\trunk\src
+
+==== Do the build ====
+
+Emulator:
+- Run: BuildPygameRelease.py 
+
+Device:
+- Run: BuildPygameRelease.py compiler=gcce release=urel cert=mycert.cer privkey=mycert.key passphprase=mypassword gcce_options="-O2 -fno-unit-at-a-time"
+-- NOTE: The gcce_options are optional but recommended to reduce the binary size.
+
 
 === Misc info ===
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.