1 |
|
|
2 |
|
import os |
3 |
|
import sys |
4 |
– |
import string |
4 |
|
import ConfigParser |
5 |
|
|
6 |
|
|
7 |
|
_platdir = 'platform' |
8 |
|
|
9 |
|
|
11 |
– |
def POSIX_setup(env): |
12 |
– |
# common stuff for all posix systems |
13 |
– |
env['RAD_PROCESS'] = string.split('unix_process.c') |
14 |
– |
|
15 |
– |
|
10 |
|
def read_plat(env, args, fn): |
11 |
|
cfig = ConfigParser.ConfigParser(env.Dictionary()) |
12 |
|
cfig.read(fn) |
18 |
|
['RAD_BASEDIR', 'RAD_BINDIR', 'RAD_RLIBDIR', 'RAD_MANDIR'], |
19 |
|
[]], |
20 |
|
['code', |
21 |
< |
['RAD_SPEED'], |
22 |
< |
['RAD_COMPAT', 'RAD_MEMCOMPAT', 'RAD_MATHCOMPAT', 'RAD_ARGSCOMPAT', |
23 |
< |
'RAD_MLIB', 'RAD_SOCKETLIB', 'RAD_PROCESS']], |
21 |
> |
[], # replace |
22 |
> |
[ # append |
23 |
> |
'RAD_COMPAT', # currently obsolete |
24 |
> |
'RAD_MATHCOMPAT', # erf.c floating point error function |
25 |
> |
'RAD_ARGSCOMPAT', # fixargv0.c for Windows |
26 |
> |
'RAD_NETCOMPAT', # [win_]netproc.c for ranimate |
27 |
> |
'RAD_MLIB', # usually 'm', or any fastlib available |
28 |
> |
'RAD_SOCKETLIB', # ws_2_32 on Windows (VC links it automatically) |
29 |
> |
'RAD_PROCESS', # our process abstraction and win_popen() |
30 |
> |
'RAD_PCALLS', # more custom process abstraction |
31 |
> |
]], |
32 |
|
] |
33 |
|
if args.get('RAD_DEBUG',0): |
34 |
|
vars.insert(0, ['debug'] + buildvars) |
35 |
|
else: vars.insert(0, ['build'] + buildvars) |
36 |
|
for section in vars: |
37 |
|
if cfig.has_section(section[0]): |
38 |
< |
for p in section[1]: |
38 |
> |
for p in section[1]: # single items to replace |
39 |
|
try: v = cfig.get(section[0], p) |
40 |
|
except ConfigParser.NoOptionError: continue |
41 |
|
env[p] = v |
42 |
|
#print '%s: %s' % (p, env[p]) |
43 |
< |
for p in section[2]: |
43 |
> |
for p in section[2]: # multiple items to append |
44 |
|
try: v = cfig.get(section[0], p) |
45 |
|
except ConfigParser.NoOptionError: continue |
46 |
< |
apply(env.Append,[],{p:string.split(v)}) |
45 |
< |
#print '%s: %s' % (p, env[p]) |
46 |
> |
apply(env.Append,[],{p:env.Split(v)}) |
47 |
|
# XXX Check that basedir exists. |
48 |
|
for k in ['RAD_BINDIR', 'RAD_RLIBDIR', 'RAD_MANDIR']: |
49 |
|
if (env.has_key('RAD_BASEDIR') and env.has_key(k) |
52 |
|
|
53 |
|
|
54 |
|
def load_plat(env, args, platform=None): |
54 |
– |
if os.name == 'posix': |
55 |
– |
POSIX_setup(env) |
55 |
|
if platform == None: # override |
56 |
|
p = sys.platform |
57 |
|
else: p = platform |
58 |
|
if p == 'win32' and 'gcc' in env['TOOLS']: |
59 |
+ |
# we don't really want to know this here... |
60 |
|
p = 'mingw' |
61 |
|
pl = [] |
62 |
|
print 'Detected platform "%s" (%s).' % (sys.platform, os.name) |