| 3 |  | import sys | 
| 4 |  | import string | 
| 5 |  |  | 
| 6 | + | PATHFILE = 'raypaths.py' | 
| 7 |  | OPTFILE = 'rayopts.py' | 
| 8 | < | SourceSignatures('timestamp') | 
| 8 | > | def set_pre_opts(env): | 
| 9 | > | vars = Variables(OPTFILE, ARGUMENTS) | 
| 10 | > | vars.Add('SKIP', 'Skip Display of License terms', 0) | 
| 11 | > | vars.Add('RAD_DEBUG',   'Build a debug version',  0) | 
| 12 | > | vars.Update(env) | 
| 13 | > | vars.Save(OPTFILE, env) | 
| 14 | > |  | 
| 15 |  | def set_opts(env): | 
| 16 | < | # XXX add some caching | 
| 17 | < | opts = Options(OPTFILE, ARGUMENTS) | 
| 18 | < | opts.Add('SKIP', 'Skip Display of License terms', 0) | 
| 19 | < | opts.Add('RAD_BINDIR',  'Install executables here',   env['RAD_BINDIR']) | 
| 20 | < | opts.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR']) | 
| 21 | < | opts.Add('RAD_MANDIR',  'Install man pages here',     env['RAD_MANDIR']) | 
| 22 | < | opts.Add('RAD_DEBUG',   'Build a debug version',  0) | 
| 16 | < | opts.Update(env) | 
| 17 | < | opts.Save(OPTFILE, env) | 
| 18 | < | Help(opts.GenerateHelpText(env, sort=cmp)) | 
| 16 | > | vars = Variables(PATHFILE, ARGUMENTS) | 
| 17 | > | vars.Add('RAD_BINDIR',  'Install executables here',   env['RAD_BINDIR']) | 
| 18 | > | vars.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR']) | 
| 19 | > | vars.Add('RAD_MANDIR',  'Install man pages here',     env['RAD_MANDIR']) | 
| 20 | > | vars.Update(env) | 
| 21 | > | vars.Save(PATHFILE, env) | 
| 22 | > | Help(vars.GenerateHelpText(env, sort=cmp)) | 
| 23 |  | # where stuff is located in the source tree | 
| 24 | < | env['RAD_BUILDLIB']  = '#src/lib' | 
| 25 | < | env['RAD_BUILDBIN']  = '#bin' | 
| 26 | < | env['RAD_BUILDRLIB'] = '#lib' | 
| 23 | < | env['RAD_BUILDMAN']  = '#doc/man' | 
| 24 | > | # the binary target libs are configured by platform | 
| 25 | > | env['RAD_BUILDRLIB'] = '#lib' | 
| 26 | > | env['RAD_BUILDMAN']  = '#doc/man' | 
| 27 |  |  | 
| 28 |  | def allplats_setup(env): | 
| 29 | < | from build_utils import find_libs | 
| 30 | < | find_libs.find_x11(env) | 
| 31 | < | find_libs.find_gl(env) # OpenGL | 
| 32 | < | #find_libs.find_pixar(env) # PIXAR_LIB for src/px/ra_pixar.c | 
| 29 | > | from build_utils import find_libs | 
| 30 | > | find_libs.find_radlib(env) | 
| 31 | > | find_libs.find_x11(env) | 
| 32 | > | find_libs.find_gl(env) # OpenGL | 
| 33 | > | find_libs.find_libtiff(env) | 
| 34 |  |  | 
| 35 |  | def post_common_setup(env): | 
| 36 | < | env.Append(CPPPATH = [os.path.join('#src', 'common')]) | 
| 37 | < | env.Append(LIBPATH=['../lib']) # our own libs | 
| 38 | < | if not env.has_key('RAD_MLIB'): | 
| 39 | < | env['RAD_MLIB'] = [] #['m'] # no seperate mlib on Win | 
| 36 | > | env.Append(CPPPATH = [os.path.join('#src', 'common')]) | 
| 37 | > | env.Append(LIBPATH=[env['RAD_BUILDLIB']]) # our own libs | 
| 38 | > | if not env.has_key('RAD_MLIB'): | 
| 39 | > | env['RAD_MLIB'] = [] #['m'] # no seperate mlib on Win | 
| 40 |  |  | 
| 41 |  | def shareinstall_setup(env): | 
| 42 |  | from build_utils import install | 
| 46 |  | if 'install' in sys.argv or 'maninstall' in sys.argv: | 
| 47 |  | install.install_manfiles(env) | 
| 48 |  |  | 
| 49 | + | _arch = None | 
| 50 | + | for item in sys.argv[1:]: | 
| 51 | + | if item.startswith('TARGET_ARCH'): | 
| 52 | + | res = item.split('=') | 
| 53 | + | if len(res) == 2: | 
| 54 | + | _arch = res[1].strip() | 
| 55 | + |  | 
| 56 |  | # Set up build environment | 
| 57 | < | env = Environment() | 
| 57 | > | env = Environment(TARGET_ARCH=_arch) | 
| 58 | > | env.Decider('timestamp-match') | 
| 59 |  |  | 
| 60 |  | if os.name == 'posix': | 
| 61 |  | from build_utils import install | 
| 62 | < | csh_b = Builder(action = install.install_cshscript, | 
| 63 | < | suffix = '', src_suffix = '.csh') | 
| 64 | < | env.Append(BUILDERS={'InstallCsh': csh_b}) | 
| 62 | > | script_b = Builder(action = install.install_script, suffix = '') | 
| 63 | > | env.Append(BUILDERS={'InstallScript': script_b}) | 
| 64 | > | tclscript_b = Builder(action = install.install_tclscript, suffix = '') | 
| 65 | > | env.Append(BUILDERS={'InstallTCLScript': tclscript_b}) | 
| 66 |  |  | 
| 67 | + | # set debug before loading platforms | 
| 68 | + | set_pre_opts(env) | 
| 69 | + |  | 
| 70 |  | # configure platform-specific stuff | 
| 71 |  | from build_utils import load_plat | 
| 72 | < | load_plat.load_plat(env, ARGUMENTS, platform=None) | 
| 72 | > | load_plat.load_plat(env, vars, arch=_arch) | 
| 73 |  |  | 
| 74 |  | # override options | 
| 75 |  | set_opts(env) | 
| 76 |  |  | 
| 77 |  | # accept license | 
| 78 | < | if not env['SKIP'] and not '-c' in sys.argv: | 
| 79 | < | from build_utils import copyright | 
| 80 | < | copyright.show_license() | 
| 78 | > | if ((not env['SKIP'] | 
| 79 | > | or env['SKIP'].strip().lower() in (0,'0','n','no','false',None)) | 
| 80 | > | and not '-c' in sys.argv and not 'test' in sys.argv): | 
| 81 | > | from build_utils import copyright | 
| 82 | > | copyright.show_license() | 
| 83 |  |  | 
| 84 |  | # fill in generic config | 
| 85 |  | allplats_setup(env) | 
| 86 |  |  | 
| 69 | – |  | 
| 70 | – |  | 
| 87 |  | # Bring in all the actual things to build | 
| 88 |  | Export('env') | 
| 89 | < | SConscript(os.path.join('src', 'common', 'SConscript')) | 
| 90 | < | post_common_setup(env) | 
| 91 | < | for d in Split('meta cv gen ot rt px hd util cal'): | 
| 92 | < | print d | 
| 93 | < | SConscript(os.path.join('src', d, 'SConscript')) | 
| 89 | > | if 'test' in sys.argv: | 
| 90 | > | SConscript(os.path.join('test', 'SConscript')) | 
| 91 | > |  | 
| 92 | > | else: | 
| 93 | > | SConscript(os.path.join('src', 'common', 'SConscript'), | 
| 94 | > | variant_dir=os.path.join(env['RAD_BUILDOBJ'],'common'), duplicate=0) | 
| 95 | > | post_common_setup(env) | 
| 96 | > | for d in Split('meta cv gen ot rt px hd util cal'): | 
| 97 | > | print d | 
| 98 | > | SConscript(os.path.join('src', d, 'SConscript'), | 
| 99 | > | variant_dir=os.path.join(env['RAD_BUILDOBJ'], d), duplicate=0) | 
| 100 |  |  | 
| 101 | < | if string.find(string.join(sys.argv[1:]), 'install') > -1: | 
| 102 | < | shareinstall_setup(env) | 
| 101 | > | if string.find(string.join(sys.argv[1:]), 'install') > -1: | 
| 102 | > | shareinstall_setup(env) | 
| 103 |  |  | 
| 104 | + | Default('.') | 
| 105 | + |  | 
| 106 |  | # virtual targets | 
| 107 |  | env.Alias('bininstall',  '$RAD_BINDIR') | 
| 108 |  | env.Alias('rlibinstall', '$RAD_RLIBDIR') | 
| 109 |  | env.Alias('maninstall',  '$RAD_MANDIR') | 
| 110 |  |  | 
| 111 | < | env.Alias('build',   ['#bin']) | 
| 112 | < | env.Alias('test',    ['#src/test']) | 
| 111 | > | env.Alias('build',   ['$RAD_BUILDBIN']) | 
| 112 | > | env.Alias('test',    ['#test']) | 
| 113 |  | env.Alias('install', ['bininstall', 'rlibinstall', 'maninstall']) | 
| 114 |  |  | 
| 115 | < | # Further virtual targets are defined locally: | 
| 92 | < | # meta_special: mt1601 okimate imagew mt160 mx80 impress aed5 | 
| 93 | < | #               tcurve tscat tbar mtext libt4014.a plotout t4014 | 
| 94 | < | # px_special:   ra_im, t4027, paintjet, mt160t, greyscale, colorscale, d48c | 
| 95 | < | # util_special: scanner, makedist (not for Windows yet) | 
| 96 | < | env.Alias('special', ['meta_special', 'px_special', 'util_special']) | 
| 97 | < | env.Alias('special_install', ['meta_special_install', | 
| 98 | < | 'px_special_install', 'util_special_install']) | 
| 99 | < |  | 
| 115 | > | # vim: set syntax=python: |