| 3 |
|
import sys |
| 4 |
|
import string |
| 5 |
|
|
| 6 |
< |
OPTFILE = 'rayopts.py' |
| 7 |
< |
SourceSignatures('timestamp') |
| 6 |
> |
PATHFILE = 'scbuild/raypaths.py' |
| 7 |
> |
OPTFILE = 'scbuild/rayopts.py' |
| 8 |
> |
def set_pre_opts(): |
| 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.Add('MSVC_VERSION', 'Microsoft VC Version', '12.0') |
| 13 |
> |
vars.Add('TARGET_ARCH', 'Windows only: "x68" or "amd64"', '') |
| 14 |
> |
return vars |
| 15 |
> |
|
| 16 |
|
def set_opts(env): |
| 17 |
< |
# XXX add some caching |
| 18 |
< |
opts = Options(OPTFILE, ARGUMENTS) |
| 19 |
< |
opts.Add('SKIP', 'Skip Display of License terms', 0) |
| 20 |
< |
opts.Add('RAD_BINDIR', 'Install executables here', env['RAD_BINDIR']) |
| 21 |
< |
opts.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR']) |
| 22 |
< |
opts.Add('RAD_MANDIR', 'Install man pages here', env['RAD_MANDIR']) |
| 23 |
< |
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)) |
| 17 |
> |
vars = Variables(PATHFILE, ARGUMENTS) |
| 18 |
> |
vars.Add('RAD_BINDIR', 'Install executables here', env['RAD_BINDIR']) |
| 19 |
> |
vars.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR']) |
| 20 |
> |
vars.Add('RAD_MANDIR', 'Install man pages here', env['RAD_MANDIR']) |
| 21 |
> |
vars.Update(env) |
| 22 |
> |
vars.Save(PATHFILE, env) |
| 23 |
> |
Help(vars.GenerateHelpText(env, sort=cmp)) |
| 24 |
|
# where stuff is located in the source tree |
| 25 |
< |
env['RAD_BUILDLIB'] = '#src/lib' |
| 26 |
< |
env['RAD_BUILDBIN'] = '#bin' |
| 27 |
< |
env['RAD_BUILDRLIB'] = '#lib' |
| 23 |
< |
env['RAD_BUILDMAN'] = '#doc/man' |
| 25 |
> |
# the binary target libs are configured by platform |
| 26 |
> |
env['RAD_BUILDRLIB'] = '#lib' |
| 27 |
> |
env['RAD_BUILDMAN'] = '#doc/man' |
| 28 |
|
|
| 29 |
|
def allplats_setup(env): |
| 30 |
< |
from build_utils import find_libs |
| 31 |
< |
find_libs.find_x11(env) |
| 32 |
< |
find_libs.find_gl(env) # OpenGL |
| 33 |
< |
#find_libs.find_pixar(env) # PIXAR_LIB for src/px/ra_pixar.c |
| 30 |
> |
from build_utils import find_libs |
| 31 |
> |
find_libs.find_radlib(env) |
| 32 |
> |
find_libs.find_x11(env) |
| 33 |
> |
find_libs.find_gl(env) # OpenGL |
| 34 |
> |
find_libs.find_libtiff(env) |
| 35 |
> |
find_libs.find_pyinstaller(env) |
| 36 |
|
|
| 37 |
|
def post_common_setup(env): |
| 38 |
< |
env.Append(CPPPATH = [os.path.join('#src', 'common')]) |
| 39 |
< |
env.Append(LIBPATH=['../lib']) # our own libs |
| 40 |
< |
if not env.has_key('RAD_MLIB'): |
| 41 |
< |
env['RAD_MLIB'] = [] #['m'] # no seperate mlib on Win |
| 38 |
> |
env.Append(CPPPATH = [os.path.join('#src', 'common')]) |
| 39 |
> |
env.Append(LIBPATH=[env['RAD_BUILDLIB']]) # our own libs |
| 40 |
> |
if not env.has_key('RAD_MLIB'): |
| 41 |
> |
env['RAD_MLIB'] = [] #['m'] # no seperate mlib on Win |
| 42 |
|
|
| 43 |
|
def shareinstall_setup(env): |
| 44 |
|
from build_utils import install |
| 48 |
|
if 'install' in sys.argv or 'maninstall' in sys.argv: |
| 49 |
|
install.install_manfiles(env) |
| 50 |
|
|
| 51 |
+ |
|
| 52 |
+ |
# set stuff before loading platforms |
| 53 |
+ |
prevars = set_pre_opts() |
| 54 |
|
# Set up build environment |
| 55 |
< |
env = Environment() |
| 55 |
> |
env = Environment(variables=prevars) |
| 56 |
> |
prevars.Save(OPTFILE, env) |
| 57 |
> |
env.Decider('timestamp-match') |
| 58 |
|
|
| 59 |
+ |
from build_utils import install |
| 60 |
+ |
script_b = Builder(action = install.install_script, suffix = '') |
| 61 |
+ |
env.Append(BUILDERS={'InstallScript': script_b}) |
| 62 |
|
if os.name == 'posix': |
| 63 |
< |
from build_utils import install |
| 64 |
< |
csh_b = Builder(action = install.install_cshscript, |
| 51 |
< |
suffix = '', src_suffix = '.csh') |
| 52 |
< |
env.Append(BUILDERS={'InstallCsh': csh_b}) |
| 63 |
> |
tclscript_b = Builder(action = install.install_tclscript, suffix = '') |
| 64 |
> |
env.Append(BUILDERS={'InstallTCLScript': tclscript_b}) |
| 65 |
|
|
| 66 |
+ |
|
| 67 |
|
# configure platform-specific stuff |
| 68 |
|
from build_utils import load_plat |
| 69 |
< |
load_plat.load_plat(env, ARGUMENTS, platform=None) |
| 69 |
> |
load_plat.load_plat(env) |
| 70 |
|
|
| 71 |
|
# override options |
| 72 |
|
set_opts(env) |
| 73 |
|
|
| 74 |
|
# accept license |
| 75 |
< |
if not env['SKIP'] and not '-c' in sys.argv: |
| 76 |
< |
from build_utils import copyright |
| 77 |
< |
copyright.show_license() |
| 75 |
> |
if ((not env['SKIP'] |
| 76 |
> |
or env['SKIP'].strip().lower() in (0,'0','n','no','false',None)) |
| 77 |
> |
and not '-c' in sys.argv and not 'test' in sys.argv): |
| 78 |
> |
from build_utils import copyright |
| 79 |
> |
copyright.show_license() |
| 80 |
|
|
| 81 |
|
# fill in generic config |
| 82 |
|
allplats_setup(env) |
| 83 |
|
|
| 69 |
– |
|
| 70 |
– |
|
| 84 |
|
# Bring in all the actual things to build |
| 85 |
|
Export('env') |
| 86 |
< |
SConscript(os.path.join('src', 'common', 'SConscript')) |
| 87 |
< |
post_common_setup(env) |
| 88 |
< |
for d in Split('meta cv gen ot rt px hd util cal'): |
| 89 |
< |
print d |
| 90 |
< |
SConscript(os.path.join('src', d, 'SConscript')) |
| 86 |
> |
if 'test' in sys.argv: |
| 87 |
> |
SConscript(os.path.join('test', 'SConscript')) |
| 88 |
> |
|
| 89 |
> |
else: |
| 90 |
> |
SConscript(os.path.join('src', 'common', 'SConscript'), |
| 91 |
> |
variant_dir=os.path.join(env['RAD_BUILDOBJ'],'common'), duplicate=0) |
| 92 |
> |
post_common_setup(env) |
| 93 |
> |
dirs = Split('''meta cv gen ot rt px hd util cal''') |
| 94 |
> |
if os.path.isfile('src/winimage/SConscript'): |
| 95 |
> |
dirs.append('winimage') |
| 96 |
> |
if os.path.isfile('src/winrview/SConscript'): |
| 97 |
> |
dirs.append('winrview') |
| 98 |
> |
for d in dirs: |
| 99 |
> |
print(d) |
| 100 |
> |
SConscript(os.path.join('src', d, 'SConscript'), |
| 101 |
> |
variant_dir=os.path.join(env['RAD_BUILDOBJ'], d), duplicate=0) |
| 102 |
|
|
| 103 |
< |
if string.find(string.join(sys.argv[1:]), 'install') > -1: |
| 104 |
< |
shareinstall_setup(env) |
| 103 |
> |
if string.find(string.join(sys.argv[1:]), 'install') > -1: |
| 104 |
> |
shareinstall_setup(env) |
| 105 |
|
|
| 106 |
+ |
Default('.') |
| 107 |
+ |
|
| 108 |
|
# virtual targets |
| 109 |
|
env.Alias('bininstall', '$RAD_BINDIR') |
| 110 |
|
env.Alias('rlibinstall', '$RAD_RLIBDIR') |
| 111 |
|
env.Alias('maninstall', '$RAD_MANDIR') |
| 112 |
|
|
| 113 |
< |
env.Alias('build', ['#bin']) |
| 114 |
< |
env.Alias('test', ['#src/test']) |
| 113 |
> |
env.Alias('build', ['$RAD_BUILDBIN', '$RAD_BUILDRLIB']) |
| 114 |
> |
env.Alias('test', ['#test']) |
| 115 |
|
env.Alias('install', ['bininstall', 'rlibinstall', 'maninstall']) |
| 116 |
|
|
| 117 |
< |
# 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 |
< |
|
| 117 |
> |
# vim: set syntax=python: |