--- ray/build_utils/load_plat.py 2004/10/21 15:47:12 1.3 +++ ray/build_utils/load_plat.py 2016/03/06 01:13:17 1.14 @@ -1,48 +1,62 @@ import os import sys -import string +import platform import ConfigParser _platdir = 'platform' -def POSIX_setup(env): - # common stuff for all posix systems - env['RAD_PROCESS'] = string.split('unix_process.c') - - def read_plat(env, args, fn): - cfig = ConfigParser.ConfigParser(env.Dictionary()) + envdict = env.Dictionary().copy() + # can't feed ConfigParser the original dict, because it also + # contains non-string values. + for k,v in envdict.items(): + if not isinstance(v, str): + del envdict[k] + cfig = ConfigParser.ConfigParser(envdict) cfig.read(fn) - buildvars = [['CC'], # replace + buildvars = [['CC', + 'TIFFINCLUDE', # where to find preinstalled tifflib headers + 'TIFFLIB', # where to find a preinstalled tifflib library + ], # replace ['CPPPATH', 'CPPDEFINES', 'CPPFLAGS', 'CCFLAGS', - 'LIBPATH', 'LINKFLAGS']] # append + 'LIBPATH', 'LINKFLAGS', + 'EZXML_CPPDEFINES', # build flags specific to ezxml.c + ]] # append vars = [ ['install', ['RAD_BASEDIR', 'RAD_BINDIR', 'RAD_RLIBDIR', 'RAD_MANDIR'], []], ['code', - ['RAD_SPEED'], - ['RAD_COMPAT', 'RAD_MEMCOMPAT', 'RAD_MATHCOMPAT', 'RAD_ARGSCOMPAT', - 'RAD_MLIB', 'RAD_PROCESS']], + [ # replace + ], + [ # append + 'RAD_COMPAT', # theoretically obsolete (src/common/strcmp.c) + 'RAD_MATHCOMPAT', # erf.c floating point error function + 'RAD_ARGSCOMPAT', # fixargv0.c for Windows + 'RAD_NETCOMPAT', # [win_]netproc.c for ranimate + 'RAD_MLIB', # usually 'm', or any fastlib available + 'RAD_SOCKETLIB', # ws_2_32 on Windows (VC links it automatically) + 'RAD_PROCESS', # our process abstraction and win_popen() + 'RAD_PCALLS', # more custom process abstraction + ]], ] if args.get('RAD_DEBUG',0): vars.insert(0, ['debug'] + buildvars) else: vars.insert(0, ['build'] + buildvars) for section in vars: if cfig.has_section(section[0]): - for p in section[1]: + for p in section[1]: # single items to replace try: v = cfig.get(section[0], p) except ConfigParser.NoOptionError: continue env[p] = v #print '%s: %s' % (p, env[p]) - for p in section[2]: + for p in section[2]: # multiple items to append try: v = cfig.get(section[0], p) except ConfigParser.NoOptionError: continue - apply(env.Append,[],{p:string.split(v)}) - #print '%s: %s' % (p, env[p]) + apply(env.Append,[],{p:env.Split(v)}) # XXX Check that basedir exists. for k in ['RAD_BINDIR', 'RAD_RLIBDIR', 'RAD_MANDIR']: if (env.has_key('RAD_BASEDIR') and env.has_key(k) @@ -50,12 +64,15 @@ def read_plat(env, args, fn): env[k] = os.path.join(env['RAD_BASEDIR'],env[k]) -def load_plat(env, args, platform=None): - if os.name == 'posix': - POSIX_setup(env) - if platform == None: # override +def load_plat(env, args, ourplat=None): + if ourplat == None: # override p = sys.platform - else: p = platform + else: p = ourplat +# if p == 'win32' and platform.architecture()[0] == '64bit': +# p = 'win64' + if p == 'win32' and 'gcc' in env['TOOLS']: + # we don't really want to know this here... + p = 'mingw' pl = [] print 'Detected platform "%s" (%s).' % (sys.platform, os.name) for i in [len(p), -1, -2]: