ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/build_utils/load_plat.py
(Generate patch)

Comparing ray/build_utils/load_plat.py (file contents):
Revision 1.1 by schorsch, Tue Oct 21 19:27:28 2003 UTC vs.
Revision 1.11 by schorsch, Thu Apr 24 10:28:24 2008 UTC

# Line 1 | Line 1
1  
2   import os
3   import sys
4 import string
4   import ConfigParser
5  
6  
7   _platdir = 'platform'
8  
9  
10 < def POSIX_setup(env):
12 <    # common stuff for all posix systems
13 <    env['RAD_PROCESS'] = string.split('unix_process.c')
14 <
15 <
16 < def read_plat(env, fn):
10 > def read_plat(env, args, fn):
11          cfig = ConfigParser.ConfigParser(env.Dictionary())
12          cfig.read(fn)
13 +        buildvars = [['CC'], # replace
14 +                        ['CPPPATH', 'CPPDEFINES', 'CPPFLAGS', 'CCFLAGS',
15 +                        'LIBPATH', 'LINKFLAGS',
16 +                        'EZXML_CPPDEFINES', # build flags specific to ezxml.c
17 +                        ]] # append
18          vars = [
20                ['build',
21                        ['CC'], # replace
22                        ['CPPFLAGS', 'CCFLAGS', 'CPPPATH', 'LIBPATH']], # append
19                  ['install',
20                          ['RAD_BASEDIR', 'RAD_BINDIR', 'RAD_RLIBDIR', 'RAD_MANDIR'],
21                          []],
22                  ['code',
23 <                        ['RAD_SPEED'],
24 <                        ['RAD_COMPAT', 'RAD_MLIB', 'RAD_PROCESS']],
23 >                        [], # replace
24 >                        [   # append
25 >                        'RAD_COMPAT',     # theoretically obsolete (src/common/strcmp.c)
26 >                        'RAD_MATHCOMPAT', # erf.c floating point error function
27 >                        'RAD_ARGSCOMPAT', # fixargv0.c for Windows
28 >                        'RAD_NETCOMPAT',  # [win_]netproc.c for ranimate
29 >                        'RAD_MLIB',       # usually 'm', or any fastlib available
30 >                        'RAD_SOCKETLIB',  # ws_2_32 on Windows (VC links it automatically)
31 >                        'RAD_PROCESS',    # our process abstraction and win_popen()
32 >                        'RAD_PCALLS',     # more custom process abstraction
33 >                        ]],
34          ]
35 +        if args.get('RAD_DEBUG',0):
36 +                vars.insert(0, ['debug'] + buildvars)
37 +        else: vars.insert(0, ['build'] + buildvars)
38          for section in vars:
39                  if cfig.has_section(section[0]):
40 <                        for p in section[1]:
40 >                        for p in section[1]: # single items to replace
41                                  try: v = cfig.get(section[0], p)
42                                  except ConfigParser.NoOptionError: continue
43                                  env[p] = v
44                                  #print '%s: %s' % (p, env[p])
45 <                        for p in section[2]:
45 >                        for p in section[2]: # multiple items to append
46                                  try: v = cfig.get(section[0], p)
47                                  except ConfigParser.NoOptionError: continue
48 <                                apply(env.Append,[],{p:string.split(v)})
41 <                                #print '%s: %s' % (p, env[p])
48 >                                apply(env.Append,[],{p:env.Split(v)})
49          # XXX Check that basedir exists.
50          for k in ['RAD_BINDIR', 'RAD_RLIBDIR', 'RAD_MANDIR']:
51                  if (env.has_key('RAD_BASEDIR') and env.has_key(k)
# Line 46 | Line 53 | def read_plat(env, fn):
53                          env[k] = os.path.join(env['RAD_BASEDIR'],env[k])
54  
55  
56 < def load_plat(env, platform=None):
50 <        if os.name == 'posix':
51 <                POSIX_setup(env)
56 > def load_plat(env, args, platform=None):
57          if platform == None: # override
58                  p = sys.platform
59          else: p = platform
60 +        if p == 'win32' and 'gcc' in env['TOOLS']:
61 +                # we don't really want to know this here...
62 +                p = 'mingw'
63          pl = []
64          print 'Detected platform "%s" (%s).' % (sys.platform, os.name)
65          for i in [len(p), -1, -2]:
66                  pfn = os.path.join(_platdir, p[:i] + '_custom.cfg')
67                  if os.path.isfile(pfn):
68                          print 'Reading configuration "%s"' % pfn
69 <                        read_plat(env, pfn)
69 >                        read_plat(env, args, pfn)
70                          return 1
71                  pfn = os.path.join(_platdir, p[:i] + '.cfg')
72                  if os.path.isfile(pfn):
73                          print 'Reading configuration "%s"' % pfn
74 <                        read_plat(env, pfn)
74 >                        read_plat(env, args, pfn)
75                          return 1
76                  
77          if os.name == 'posix':
78                  pfn = os.path.join(_platdir, 'posix.cfg')
79                  if os.path.isfile(pfn):
80                          print 'Reading generic configuration "%s".' % pfn
81 <                        read_plat(env, pfn)
81 >                        read_plat(env, args, pfn)
82                          return 1
83  
84          print 'Platform "%s/%s" not supported yet' % (os.name, sys.platform)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines