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) |
13 |
|
buildvars = [['CC'], # replace |
14 |
< |
['CPPPATH','CPPFLAGS','CCFLAGS','LIBPATH','LINKFLAGS']] # append |
14 |
> |
['CPPPATH', 'CPPDEFINES', 'CPPFLAGS', 'CCFLAGS', |
15 |
> |
'LIBPATH', 'LINKFLAGS']] # append |
16 |
|
vars = [ |
17 |
|
['install', |
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_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 |
|
] |
31 |
|
if args.get('RAD_DEBUG',0): |
32 |
|
vars.insert(0, ['debug'] + buildvars) |
33 |
|
else: vars.insert(0, ['build'] + buildvars) |
34 |
|
for section in vars: |
35 |
|
if cfig.has_section(section[0]): |
36 |
< |
for p in section[1]: |
36 |
> |
for p in section[1]: # single items to replace |
37 |
|
try: v = cfig.get(section[0], p) |
38 |
|
except ConfigParser.NoOptionError: continue |
39 |
|
env[p] = v |
40 |
|
#print '%s: %s' % (p, env[p]) |
41 |
< |
for p in section[2]: |
41 |
> |
for p in section[2]: # multiple items to append |
42 |
|
try: v = cfig.get(section[0], p) |
43 |
|
except ConfigParser.NoOptionError: continue |
44 |
< |
apply(env.Append,[],{p:string.split(v)}) |
44 |
> |
apply(env.Append,[],{p:`v`.split()}) |
45 |
|
#print '%s: %s' % (p, env[p]) |
46 |
|
# XXX Check that basedir exists. |
47 |
|
for k in ['RAD_BINDIR', 'RAD_RLIBDIR', 'RAD_MANDIR']: |
51 |
|
|
52 |
|
|
53 |
|
def load_plat(env, args, platform=None): |
53 |
– |
if os.name == 'posix': |
54 |
– |
POSIX_setup(env) |
54 |
|
if platform == None: # override |
55 |
|
p = sys.platform |
56 |
|
else: p = platform |
57 |
+ |
if p == 'win32' and 'gcc' in env['TOOLS']: |
58 |
+ |
# we don't really want to know this here... |
59 |
+ |
p = 'mingw' |
60 |
|
pl = [] |
61 |
|
print 'Detected platform "%s" (%s).' % (sys.platform, os.name) |
62 |
|
for i in [len(p), -1, -2]: |