~pygame/pygame/trunk

« back to all changes in this revision

Viewing changes to symbian/BuildPygameRelease.py

  • Committer: pygame
  • Date: 2017-01-10 00:31:42 UTC
  • Revision ID: git-v1:2eea4f299a2e791f884608d7ed601558634af73c
commit 1639c41a8cb3433046882ede92c80ce69d59016b
Author: Thomas Kluyver <takowl@gmail.com>
Date:   Sun Jan 8 18:46:46 2017 +0000

    Build newer versions of libogg and libvorbis into Linux base images

    Closes #317
    Closes #323

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
""" Full build configuration for pygame.
 
2
Reads configuration and creates appropriate parameters for SCons build scripts.
 
3
For SVN support, install pysvn.
 
4
"""
 
5
 
 
6
import sys
 
7
import time
 
8
import os
 
9
import shutil
 
10
 
 
11
import build_config as config
 
12
 
 
13
from glob import glob
 
14
from scons_symbian.config.constants import CAPS_SELF_SIGNED
 
15
from scons_symbian.arguments import COMPILER, RELEASE
 
16
 
 
17
 
 
18
BASE_CMD = "scons dosis=true"
 
19
 
 
20
UID_PACKAGE   = 0xE0006020
 
21
__uid = UID_PACKAGE 
 
22
def getuid(): 
 
23
    global __uid
 
24
    __uid += 1
 
25
    return __uid  
 
26
 
 
27
UID_PYGAMEAPP = getuid()
 
28
UID_SDL       = getuid()
 
29
UID_JPEG      = getuid()
 
30
UID_BASE      = getuid()
 
31
 
 
32
#: Capability configuration
 
33
CAPABILITIES = CAPS_SELF_SIGNED[:]
 
34
CAPABILITIES.remove("UserEnvironment") # Missing from sdl.dll
 
35
CAPABILITIES = "+".join(CAPABILITIES)
 
36
 
 
37
def dobuild(args):    
 
38
    cmd = ""
 
39
    for x in args:
 
40
        cmd += "%s=%s " % ( x, str(args[x]) )
 
41
    
 
42
    cmd = " ".join( [BASE_CMD, cmd] )
 
43
    cmd = " ".join( [cmd] + sys.argv[1:] )
 
44
 
 
45
    print cmd
 
46
    if os.system( cmd ): 
 
47
        raise SystemExit( "Error: Build failed" )
 
48
    
 
49
 
 
50
def build():
 
51
 
 
52
    version = list(time.gmtime()[:3])    
 
53
    version = [ str(x).zfill(2) for x in version ]
 
54
    version = "".join( version )
 
55
        
 
56
    sisname = "python_for_pygame_%s.sis" % version
 
57
    
 
58
    args = { "applications" : "",
 
59
             "capabilities" : CAPABILITIES,
 
60
             "builtin"      : "sysinfo,socket",
 
61
             #"pyds"         : "gles",
 
62
             "basename"     : "pygame_python",            
 
63
             "uidbase"      : hex(UID_BASE).replace("L",""),             
 
64
             "sisappname"   : '"Python for Pygame"',
 
65
             # Convert to int or may be converted to octal due to zero at beginning
 
66
             'sisversion'   : '"(1,%d,%d%s)"' % ( int(version[2:4]), int( version[4:6]),version[6:]),
 
67
             'pythonsis'    : sisname,
 
68
             'libpath'      : "data/pygame/libs",
 
69
             'pycompiler'   : config.pycompiler
 
70
             }
 
71
    
 
72
    # Add certificate stuff
 
73
    if config.cert is not None:
 
74
        args['cert'] = config.cert        
 
75
        args['privkey'] = config.privkey
 
76
        args['passphrase'] = config.passphrase
 
77
        
 
78
    # Build PyS60 CE
 
79
    sisname   = ""  
 
80
    if config.build_python:
 
81
        curdir = os.getcwd()
 
82
        os.chdir(config.pys60_ce_src)   
 
83
        a = args.copy()
 
84
        a["gcce_options"] = '"-O2 -fno-unit-at-a-time"'             
 
85
        dobuild(a)    
 
86
        os.chdir(curdir)
 
87
    
 
88
        sisname = "python_for_pygame_%s_signed.sisx" % version
 
89
        pys60_sis = os.path.join( config.pys60_ce_src, sisname )
 
90
                
 
91
        # Copy the sis to current directory
 
92
        if os.path.exists(pys60_sis):
 
93
            import shutil
 
94
            shutil.copyfile(pys60_sis, sisname)
 
95
        
 
96
        args['pythondll'] =  args['basename']
 
97
         
 
98
    else:
 
99
        sisname = config.pys60_sis
 
100
        if config.pythondll is not None:
 
101
            args['pythondll'] = config.pythondll
 
102
     
 
103
    # Build pygame
 
104
    args["pythonsis"]  = sisname
 
105
    args["pythonsis"]  = sisname
 
106
    args["sisappname"] = '"pygame"' 
 
107
    args['sisversion'] = '1,%d,%d%s' % ( int(version[2:4]), int( version[4:6]),version[6:])
 
108
    args['sisuid'] = hex(UID_PACKAGE).replace("L","")
 
109
    args['appuid'] = hex(UID_PYGAMEAPP).replace("L","")
 
110
    args['sdluid'] = hex(UID_SDL).replace("L","")
 
111
    args['jpeguid']= hex(UID_JPEG).replace("L","")
 
112
    args['pythoninclude'] = config.pythoninclude
 
113
    args["staticmods"]    = config.staticmods
 
114
    args["modbaseuid"]    = hex(UID_BASE).replace("L","")
 
115
    args["build_libs"]    = config.build_libs
 
116
    #args['defines'] = "STDERR_TO_STDOUT"
 
117
    args['winscw_options'] = "-nostderr" # Don't show the stdioserver output
 
118
    dobuild(args)
 
119
    
 
120
    
 
121
if __name__ == "__main__":
 
122
    build()