Commits

Anonymous committed 81b2dde

Initial Symbian build scripts
Native module wrappers for Symbian

Comments (0)

Files changed (25)

symbian/SConscript.Ogg.py

+
+# This file is generated with mmp2sconscript
+from scons_symbian import *
+
+target     = "ogg"
+targettype = "lib"
+libraries  = []
+# Static libs
+libraries += []
+
+uid3 = 0
+sources = ['deps/ogg/src/bitwise.c', 'deps/ogg/src/framing.c']
+
+includes    = ['/SDLS60/symbian']
+sysincludes = [ EPOC32_INCLUDE, EPOC32_INCLUDE + '/libc', 'deps/ogg/include']
+defines     = []
+
+SymbianProgram( target, targettype,
+    sources = sources,
+    includes    = includes,
+    sysincludes = sysincludes,
+    libraries   = libraries,
+    defines     = defines,
+    epocstacksize = 8192,
+    epocheapsize  = (0x400,0x100000),
+    uid3 = uid3,
+)
+

symbian/SConscript.SDL.py

+# This file is generated with mmp2sconscript
+from scons_symbian import *
+
+Import("*")
+
+target     = TARGET_NAME
+targettype = "dll"
+libraries  = ['euser',
+ 'fbscli',
+ 'ws32',
+ 'gdi',
+ 'mediaclientaudiostream',
+ 'avkon',
+ 'efsrv',
+ 'bafl',
+ 'apparc',
+ 'eikcore',
+ 'cone',
+ 'bitgdi',
+ 'scdv',
+ 'hal',
+# 'libc',
+# 'libm',
+ 'estlib']
+
+# Static libs
+libraries = [ 'vorbis.lib', 'ogg.lib', 'SDL_ttf.lib', 'libsft2.lib'] + libraries
+
+sources = ['deps/SDL/symbian/src/vectorbuffer.cpp',
+ 'deps/SDL/symbian/src/sdlappsrv.cpp',
+ 'deps/SDL/symbian/src/sdlenv.cpp',
+ 'deps/SDL/symbian/src/dsa.cpp',
+ 'deps/SDL/symbian/src/streamplayer.cpp',
+ 'deps/SDL/symbian/src/sdlenvutils.cpp',
+ 'deps/SDL/src/SDL.c',
+ 'deps/SDL/src/SDL_error.c',
+ 'deps/SDL/src/SDL_fatal.c',
+ 'deps/SDL/src/main/symbian/SDL_libutils.cpp',
+ 'deps/SDL/src/main/symbian/SDL_main.cpp',
+ 'deps/SDL/src/cpuinfo/SDL_cpuinfo.c',
+ 'deps/SDL/src/video/SDL_blit.c',
+ 'deps/SDL/src/video/SDL_blit_0.c',
+ 'deps/SDL/src/video/SDL_blit_1.c',
+ 'deps/SDL/src/video/SDL_blit_A.c',
+ 'deps/SDL/src/video/SDL_blit_N.c',
+ 'deps/SDL/src/video/SDL_bmp.c',
+ 'deps/SDL/src/video/SDL_cursor.c',
+ 'deps/SDL/src/video/SDL_gamma.c',
+ 'deps/SDL/src/video/SDL_pixels.c',
+ 'deps/SDL/src/video/SDL_RLEaccel.c',
+ 'deps/SDL/src/video/SDL_stretch.c',
+ 'deps/SDL/src/video/SDL_surface.c',
+ 'deps/SDL/src/video/SDL_video.c',
+ 'deps/SDL/src/video/SDL_yuv.c',
+ 'deps/SDL/src/video/SDL_yuv_mmx.c',
+ 'deps/SDL/src/video/SDL_yuv_sw.c',
+ 'deps/SDL/src/video/symbian/SDL_epocvideo.cpp',
+ 'deps/SDL/src/video/symbian/SDL_epocevents.cpp',
+ 'deps/SDL/src/audio/SDL_audio.c',
+ 'deps/SDL/src/audio/SDL_audiocvt.c',
+ 'deps/SDL/src/audio/SDL_audiodev.c',
+ 'deps/SDL/src/audio/SDL_mixer.c',
+ 'deps/SDL/src/audio/SDL_wave.c',
+ 'deps/SDL/src/audio/symbian/SDL_epocaudio.cpp',
+ 'deps/SDL/src/thread/SDL_thread.c',
+ 'deps/SDL/src/thread/generic/SDL_syscond.c',
+ 'deps/SDL/src/thread/symbian/SDL_sysmutex.cpp',
+ 'deps/SDL/src/thread/symbian/SDL_syssem.cpp',
+ 'deps/SDL/src/thread/symbian/SDL_systhread.cpp',
+ 'deps/SDL/src/events/SDL_active.c',
+ 'deps/SDL/src/events/SDL_events.c',
+ 'deps/SDL/src/events/SDL_keyboard.c',
+ 'deps/SDL/src/events/SDL_mouse.c',
+ 'deps/SDL/src/events/SDL_quit.c',
+ 'deps/SDL/src/events/SDL_resize.c',
+ 'deps/SDL/src/timer/SDL_timer.c',
+ 'deps/SDL/src/timer/symbian/SDL_systimer.cpp',
+ 'deps/SDL/src/file/SDL_rwops.c',
+ 'deps/SDL/src/stdlib/SDL_string.c',
+ 'deps/SDL/src/stdlib/SDL_getenv.c']
+
+ # Configure SDL_Mixer
+sources += [
+ 'deps/SDL_mixer/mixer.c',
+ 'deps/SDL_mixer/music.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/effect_stereoreverse.c',
+ 'deps/SDL_mixer/load_aiff.c',
+ 'deps/SDL_mixer/load_voc.c',
+ 'deps/SDL_mixer/load_ogg.c',
+ 'deps/SDL_mixer/dynamic_ogg.c',
+ 'deps/SDL_mixer/music_ogg.c',
+]
+
+# Configure SDL_ttf
+sources += [
+ 'deps/SDL_ttf/SDL_ttf.c',
+]
+
+
+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']
+
+includes += ["deps/SDL_ttf/", "deps/sft2/inc/sys"]
+
+SymbianProgram( target, targettype,
+    sources = sources,
+    includes    = includes,
+    sysincludes = sysincludes,
+    libraries   = libraries,
+    defines     = defines,
+    uid3 = UID3,
+)

symbian/SConscript.Vorbis.py

+# This file is generated with mmp2sconscript
+from scons_symbian import *
+
+target     = "vorbis"
+targettype = "lib"
+libraries  = []
+# Static libs
+libraries += []
+
+
+uid3 = 0
+
+
+
+sources = ['deps/vorbis/lib/analysis.c',
+ 'deps/vorbis/lib/barkmel.c',
+ 'deps/vorbis/lib/bitrate.c',
+ 'deps/vorbis/lib/block.c',
+ 'deps/vorbis/lib/codebook.c',
+ 'deps/vorbis/lib/envelope.c',
+ 'deps/vorbis/lib/floor0.c',
+ 'deps/vorbis/lib/floor1.c',
+ 'deps/vorbis/lib/info.c',
+ 'deps/vorbis/lib/lookup.c',
+ 'deps/vorbis/lib/lpc.c',
+ 'deps/vorbis/lib/lsp.c',
+ 'deps/vorbis/lib/mapping0.c',
+ 'deps/vorbis/lib/mdct.c',
+ 'deps/vorbis/lib/psy.c',
+ 'deps/vorbis/lib/registry.c',
+ 'deps/vorbis/lib/res0.c',
+ 'deps/vorbis/lib/sharedbook.c',
+ 'deps/vorbis/lib/smallft.c',
+ 'deps/vorbis/lib/synthesis.c',
+ 'deps/vorbis/lib/vorbisfile.c',
+ 'deps/vorbis/lib/window.c']
+
+
+includes    = ['deps/SDL/symbian', 'deps/vorbis/include', 'deps/vorbis/include/vorbis']
+sysincludes = [EPOC32_INCLUDE, EPOC32_INCLUDE + "/libc", 'deps/ogg/include', 'deps/ogg/symbian']
+
+defines     = []
+if COMPILER == COMPILER_GCCE: 
+    defines     = ['alloca=__builtin_alloca']
+
+SymbianProgram( target, targettype,
+    sources = sources,
+    includes    = includes,
+    sysincludes = sysincludes,
+    libraries   = libraries,
+    defines     = defines,
+    epocstacksize = 8192,
+    epocheapsize  = (0x400,0x100000),
+    uid3 = uid3,
+)
+

symbian/SConscript.app.py

+from scons_symbian import *
+
+# Import all from main SConstruct
+Import("*")
+
+python_includes = [ join( PYTHON_CORE, x ) for x in r"Symbian Objects Parser Python include Modules".split() ]
+
+pygame_rss = File("app/pygame.rss")
+pygame_reg_rss = File( "app/pygame_reg.rss")
+
+SymbianProgram( "pygame", TARGETTYPE_EXE,
+                resources = [pygame_rss, pygame_reg_rss],
+                sources = ["app/pygame_app.cpp", 
+                           "app/pygame_main.cpp"                           
+                           ],
+                includes = ["app", "common",
+                join( EPOC32_INCLUDE, "SDL"), 
+                join( EPOC32_INCLUDE, "libc"),] + python_includes
+                ,
+                defines = [
+                    #"__LOGMAN_ENABLED__", 
+                ],
+                libraries = ["euser", "estlib", "avkon", "apparc", 
+                             "cone","eikcore", "libGLES_CM",                             
+                             PYTHON_LIB_NAME,
+                             SDL_DLL_NAME,
+                             "pygame.lib",
+                             #"LogMan"
+                             ],
+                uid3=UID_PYGAMEAPP,
+                icons = [ ("../lib/pygame_icon.svg", "pygame") ],
+                package=PACKAGE_NAME,
+                capabilities = CAPABILITIES,
+                epocheapsize = ( 0x5000, 0x200000 ),
+                epocstacksize = 0x14000,
+)
+
+# Install pygame app resources
+from glob import glob
+
+def to_package(**kwargs):
+    kwargs["source"] = abspath( kwargs["source"] )
+    #kwargs["target"] = abspath( kwargs["target"] )
+    ToPackage( package = PACKAGE_NAME, **kwargs )
+
+#for x in glob("*.bmp"):
+#    to_package( source = x, target = "data/pygame")
+
+to_package( source = "app/pygame_main.py", target = "data/pygame" )
+#to_package( source = "app/ambient.ogg", target = "data/pygame" )
+

symbian/SConscript.pygame.py

+
+from scons_symbian import *
+import glob
+
+Import("*")
+
+python_includes = [ join( PYTHON_CORE, x ) for x in r"Symbian Objects Parser Python include Modules".split() ]
+
+#music.c
+#mixer.c
+#font.c
+ignored = r"""
+camera.c
+ffmovie.c
+imageext.c
+movie.c
+movieext.c
+pixelarray_methods.c
+scale_mmx32.c
+scale_mmx64.c
+scrap.c
+scrap_mac.c
+scrap_qnx.c
+scrap_win.c
+scrap_x11.c
+_numericsndarray.c
+joystick.c
+cdrom.c""".split()
+
+pygame_sources = glob.glob( "../src/*.c" )
+removed = []
+for x in pygame_sources:
+    for y in ignored:        
+        if x.endswith(y):
+            removed.append(x)
+            break
+
+for x in removed:    
+    pygame_sources.remove(x)
+
+pygame_sources.append("common/builtins.c")
+
+# Build pygame library
+SymbianProgram( "pygame", TARGETTYPE_LIB,
+                sources = pygame_sources,
+                defines = [                    
+                ],
+                includes = python_includes + [
+                             "common",
+                             join( EPOC32_INCLUDE, "SDL"),
+                             join( EPOC32_INCLUDE, "libc"),                             
+                             #join( "..", "..", "tools", "debug" )
+                           ],
+                package = PACKAGE_NAME,
+                libraries = [
+                     PYTHON_LIB_NAME,
+                     "euser", "estlib", "avkon", "apparc", 
+                     "cone","eikcore", "libGLES_CM",                     
+                     SDL_DLL_NAME,
+                     ],
+                )
+
+# Install pygame python libraries
+from glob import glob
+
+def to_package(**kwargs):
+    kwargs["source"] = abspath( kwargs["source"] )
+    ToPackage( package = PACKAGE_NAME, **kwargs )
+
+pygame_lib = join( PATH_PY_LIBS, "pygame" )
+
+# Copy main pygame libs
+for x in glob( "../lib/*.py"):
+    to_package( source = x, target = pygame_lib )
+
+# Copy Symbian specific libs
+for x in glob( "lib/*.py"): 
+    to_package( source = x, target = pygame_lib )
+    
+#sdl_path = "/epoc32/release/%s/%s/sdl.dll" % ( COMPILER, RELEASE ) 
+#to_package( source = sdl_path, target = "sys/bin/") 
+
+# Install default font
+to_package( source = "../lib/freesansbold.ttf", target = pygame_lib )

symbian/SConscript.sft2.py

+
+
+# This file is generated with mmp2sconscript
+from scons_symbian import *
+
+target     = "libsft2"
+targettype = "lib"
+libraries  = ['euser', 'estlib', 'gdi', 'fbscli']
+
+# Static libs
+libraries += []
+
+sources = ['deps/sft2/src/libsft2.cpp',
+ 'deps/sft2/src/libsft2DllMain.cpp',
+ 'deps/sft2/src/base/ftapi.c',
+ 'deps/sft2/src/base/ftbase.c',
+ 'deps/sft2/src/base/ftbbox.c',
+ 'deps/sft2/src/base/ftbdf.c',
+ 'deps/sft2/src/base/ftbitmap.c',
+ 'deps/sft2/src/base/ftdebug.c',
+ 'deps/sft2/src/base/ftgasp.c',
+ 'deps/sft2/src/base/ftglyph.c',
+ 'deps/sft2/src/base/ftgxval.c',
+ 'deps/sft2/src/base/ftinit.c',
+ 'deps/sft2/src/base/ftlcdfil.c',
+ 'deps/sft2/src/base/ftmm.c',
+ 'deps/sft2/src/base/ftotval.c',
+ 'deps/sft2/src/base/ftpfr.c',
+ 'deps/sft2/src/base/ftstroke.c',
+ 'deps/sft2/src/base/ftsynth.c',
+ 'deps/sft2/src/base/ftsystem.c',
+ 'deps/sft2/src/base/fttype1.c',
+ 'deps/sft2/src/base/ftwinfnt.c',
+ 'deps/sft2/src/base/ftxf86.c',
+ 'deps/sft2/src/winfonts/winfnt.c',
+ 'deps/sft2/src/bdf/bdf.c',
+ 'deps/sft2/src/type42/type42.c',
+ 'deps/sft2/src/type1/type1.c',
+ 'deps/sft2/src/truetype/truetype.c',
+ 'deps/sft2/src/cid/type1cid.c',
+ 'deps/sft2/src/pcf/pcf.c',
+ 'deps/sft2/src/psaux/psaux.c',
+ 'deps/sft2/src/pfr/pfr.c',
+ 'deps/sft2/src/cff/cff.c',
+ 'deps/sft2/src/psnames/psnames.c',
+ 'deps/sft2/src/pshinter/pshinter.c',
+ 'deps/sft2/src/autofit/autofit.c',
+ 'deps/sft2/src/autofit/afwarp.c',
+ 'deps/sft2/src/gzip/ftgzip.c',
+ 'deps/sft2/src/smooth/smooth.c',
+ 'deps/sft2/src/raster/raster.c',
+ 'deps/sft2/src/sfnt/sfnt.c',
+ 'deps/sft2/src/lzw/ftlzw.c']
+
+
+includes    = ['deps/sft2/inc']
+sysincludes = [ EPOC32_INCLUDE +'/libc', EPOC32_INCLUDE, 'deps/sft2/inc/sys']
+defines     = ['FT2_BUILD_LIBRARY', 
+    #'LOGN_ENABLE', 
+    #'LOGP_ENABLE', 
+    'cplusplus']
+
+SymbianProgram( target, targettype,
+    sources = sources,
+    includes    = includes,
+    sysincludes = sysincludes,
+    libraries   = libraries,
+    defines     = defines,        
+)
+
+
+
+

symbian/SConstruct

+from scons_symbian import *
+
+# Pygame's installer package
+PACKAGE_NAME = ARGUMENTS.get( "package", "pygame" )
+#: Name of the python dll to use
+PYTHON_LIB_NAME = ARGUMENTS.get( "pythondll", "pygame_python" )
+#: Path to the libraries of pygame
+PATH_PY_LIBS = ARGUMENTS.get( "pylibs", "data/pygame/libs" )
+#: Path to python core sources
+PYTHON_CORE = ARGUMENTS.get( "pythoncore", "../../PyS60Community/pygame/src/core" )
+#: Name of the used sdl.dll ( pygame_sdl.dll )
+SDL_DLL_NAME = ARGUMENTS.get( "sdldll", "pygame_sdl" )
+Export("PACKAGE_NAME PYTHON_LIB_NAME PATH_PY_LIBS PYTHON_CORE SDL_DLL_NAME")
+
+# Build external libraries. Conditional because needed only once and takes extra time after that.
+if ARGUMENTS.get( "buildlibs", True ):
+    SConscript( "SConscript.sft2.py" )
+    SConscript( "SConscript.Ogg.py" )    
+    SConscript( "SConscript.Vorbis.py" )    
+    
+    TARGET_NAME = SDL_DLL_NAME   
+    UID3 = ARGUMENTS.get( "sdluid", "0xE0006021" )
+    Export( "TARGET_NAME UID3" )
+    SConscript( "SConscript.SDL.py" )
+    
+# Build pygame.lib
+SConscript( "SConscript.pygame.py")
+
+#TODO: Build pygame python
+
+# Build pygame application
+UID_PYGAMEAPP = ARGUMENTS.get( "appuid", "0xE0006020" )
+CAPABILITIES  = ARGUMENTS.get( "capabilities", CAPS_SELF_SIGNED)
+Export("UID_PYGAMEAPP CAPABILITIES")
+
+SConscript( "SConscript.app.py")
+

symbian/changes_for_symbian.txt

+
+=Changes required to port pygame for Series 60=
+
+This file is an attempt to keep some kind of track of what has been changed
+and why to make pygame reality on PyS60.
+
+
+== Changes for extension modules ==
+
+The extension module names have been renamed. On PC the native extensions 
+can be put under pygame directory, but on Symbian this is not possible. 
+All native extensions must be placed under sys\bin directory. This is why 
+the names were changed to pygame_<extension>. A python wrapper was created 
+to simply import all attributes of the native extension to keep the pygame 
+API the same.
+
+The extensions are also built-in to the Python.dll to avoid polluting the 
+sys\bin directory with over 10 new dlls.
+
+Author Jussi Toivola <jtoivola@gmail.com>

symbian/how_to_build.txt

+== Instructions to build pygame for PyS60. ==
+
+Basic requirements:
+- S60 3rd or 5th ed. SDK 
+- SVN client
+
+
+=== Getting necessary libraries ===
+
+Get ogg to symbian/deps/ogg
+- IMPORTANT: Revision 7524
+- SVN: http://svn.xiph.org/trunk/ogg 
+
+Get vorbis to symbian/deps/vorbis
+- IMPORTANT: Revision 7543
+- SVN: http://svn.xiph.org/trunk/vorbis
+
+
+Get SDL for Series60
+- Available at: http://koti.mbnet.fi/mertama/sdl.html
+- Follow the instructions and copy the pathced SDL S60 folder to symbian/deps/SDL
+
+Get SDL_mixer to symbian/deps/SDL_mixer
+- http://www.libsdl.org/projects/SDL_mixer/
+
+Get SDL_ttf to symbian/deps/SDL_ttf
+- http://www.libsdl.org/projects/SDL_ttf/
+
+Get Symbian FreeType2 port to symbian/deps/sft2
+- SVN: https://sft2.svn.sourceforge.net/svnroot/sft2/trunk/sft2
+
+
+=== Building ===
+
+- 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'
+
+=== Misc info ===
+
+pygame library
+- The pygame is implemented as static library to be statically linked to pygame application.
+
+
+About selecting Python:
+- You can select the python.dll to link against by giving scons parameter 'pythondll' 
+- ex. scons pythondll=Python222
+
+

symbian/lib/base.py

+from pygame_base import *

symbian/lib/color.py

+from pygame_color import * 

symbian/lib/constants.py

+from pygame_constants import * 

symbian/lib/display.py

+from pygame_display import *

symbian/lib/draw.py

+from pygame_draw import *

symbian/lib/event.py

+from pygame_event import * 

symbian/lib/font.py

+from pygame_font import * 

symbian/lib/image.py

+from pygame_image import * 

symbian/lib/key.py

+from pygame_key import * 

symbian/lib/mixer.py

+from pygame_mixer import * 
+import pygame_mixer_music as music

symbian/lib/rect.py

+from pygame_rect import *

symbian/lib/rwobject.py

+from pygame_rwobject import * 

symbian/lib/surface.py

+from pygame_surface import *

symbian/lib/surflock.py

+from pygame_surflock import *

symbian/lib/time.py

+from pygame_time import *

symbian/lib/transform.py

+from pygame_transform import *