1 |
schorsch |
1.1 |
|
2 |
|
|
import os |
3 |
|
|
import sys |
4 |
|
|
import string |
5 |
|
|
|
6 |
schorsch |
1.17 |
PATHFILE = 'raypaths.py' |
7 |
schorsch |
1.1 |
OPTFILE = 'rayopts.py' |
8 |
schorsch |
1.17 |
def set_pre_opts(env): |
9 |
schorsch |
1.14 |
vars = Variables(OPTFILE, ARGUMENTS) |
10 |
|
|
vars.Add('SKIP', 'Skip Display of License terms', 0) |
11 |
schorsch |
1.17 |
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 |
|
|
vars = Variables(PATHFILE, ARGUMENTS) |
17 |
schorsch |
1.14 |
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 |
schorsch |
1.17 |
vars.Save(PATHFILE, env) |
22 |
schorsch |
1.14 |
Help(vars.GenerateHelpText(env, sort=cmp)) |
23 |
schorsch |
1.1 |
# where stuff is located in the source tree |
24 |
schorsch |
1.16 |
# the binary target libs are configured by platform |
25 |
schorsch |
1.8 |
env['RAD_BUILDRLIB'] = '#lib' |
26 |
|
|
env['RAD_BUILDMAN'] = '#doc/man' |
27 |
schorsch |
1.1 |
|
28 |
|
|
def allplats_setup(env): |
29 |
schorsch |
1.8 |
from build_utils import find_libs |
30 |
schorsch |
1.9 |
find_libs.find_radlib(env) |
31 |
schorsch |
1.8 |
find_libs.find_x11(env) |
32 |
|
|
find_libs.find_gl(env) # OpenGL |
33 |
|
|
find_libs.find_libtiff(env) |
34 |
schorsch |
1.1 |
|
35 |
|
|
def post_common_setup(env): |
36 |
schorsch |
1.8 |
env.Append(CPPPATH = [os.path.join('#src', 'common')]) |
37 |
schorsch |
1.16 |
env.Append(LIBPATH=[env['RAD_BUILDLIB']]) # our own libs |
38 |
schorsch |
1.8 |
if not env.has_key('RAD_MLIB'): |
39 |
|
|
env['RAD_MLIB'] = [] #['m'] # no seperate mlib on Win |
40 |
schorsch |
1.1 |
|
41 |
|
|
def shareinstall_setup(env): |
42 |
|
|
from build_utils import install |
43 |
|
|
# only scan for those files when we actually need them |
44 |
|
|
if 'install' in sys.argv or 'rlibinstall' in sys.argv: |
45 |
|
|
install.install_rlibfiles(env) |
46 |
|
|
if 'install' in sys.argv or 'maninstall' in sys.argv: |
47 |
|
|
install.install_manfiles(env) |
48 |
|
|
|
49 |
schorsch |
1.16 |
_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 |
schorsch |
1.1 |
# Set up build environment |
57 |
schorsch |
1.16 |
env = Environment(TARGET_ARCH=_arch) |
58 |
schorsch |
1.7 |
env.Decider('timestamp-match') |
59 |
schorsch |
1.1 |
|
60 |
schorsch |
1.4 |
if os.name == 'posix': |
61 |
|
|
from build_utils import install |
62 |
schorsch |
1.13 |
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 |
schorsch |
1.4 |
|
67 |
schorsch |
1.17 |
# set debug before loading platforms |
68 |
|
|
set_pre_opts(env) |
69 |
|
|
|
70 |
schorsch |
1.1 |
# configure platform-specific stuff |
71 |
|
|
from build_utils import load_plat |
72 |
schorsch |
1.17 |
load_plat.load_plat(env, vars, arch=_arch) |
73 |
schorsch |
1.1 |
|
74 |
|
|
# override options |
75 |
|
|
set_opts(env) |
76 |
|
|
|
77 |
|
|
# accept license |
78 |
schorsch |
1.8 |
if ((not env['SKIP'] |
79 |
schorsch |
1.17 |
or env['SKIP'].strip().lower() in (0,'0','n','no','false',None)) |
80 |
schorsch |
1.8 |
and not '-c' in sys.argv and not 'test' in sys.argv): |
81 |
|
|
from build_utils import copyright |
82 |
|
|
copyright.show_license() |
83 |
schorsch |
1.1 |
|
84 |
|
|
# fill in generic config |
85 |
|
|
allplats_setup(env) |
86 |
|
|
|
87 |
|
|
# Bring in all the actual things to build |
88 |
|
|
Export('env') |
89 |
schorsch |
1.8 |
if 'test' in sys.argv: |
90 |
|
|
SConscript(os.path.join('test', 'SConscript')) |
91 |
|
|
|
92 |
|
|
else: |
93 |
schorsch |
1.16 |
SConscript(os.path.join('src', 'common', 'SConscript'), |
94 |
|
|
variant_dir=os.path.join(env['RAD_BUILDOBJ'],'common'), duplicate=0) |
95 |
schorsch |
1.8 |
post_common_setup(env) |
96 |
|
|
for d in Split('meta cv gen ot rt px hd util cal'): |
97 |
|
|
print d |
98 |
schorsch |
1.16 |
SConscript(os.path.join('src', d, 'SConscript'), |
99 |
|
|
variant_dir=os.path.join(env['RAD_BUILDOBJ'], d), duplicate=0) |
100 |
schorsch |
1.1 |
|
101 |
schorsch |
1.8 |
if string.find(string.join(sys.argv[1:]), 'install') > -1: |
102 |
|
|
shareinstall_setup(env) |
103 |
schorsch |
1.1 |
|
104 |
schorsch |
1.6 |
Default('.') |
105 |
|
|
|
106 |
schorsch |
1.1 |
# virtual targets |
107 |
schorsch |
1.4 |
env.Alias('bininstall', '$RAD_BINDIR') |
108 |
|
|
env.Alias('rlibinstall', '$RAD_RLIBDIR') |
109 |
|
|
env.Alias('maninstall', '$RAD_MANDIR') |
110 |
schorsch |
1.1 |
|
111 |
schorsch |
1.16 |
env.Alias('build', ['$RAD_BUILDBIN']) |
112 |
schorsch |
1.8 |
env.Alias('test', ['#test']) |
113 |
schorsch |
1.1 |
env.Alias('install', ['bininstall', 'rlibinstall', 'maninstall']) |
114 |
|
|
|
115 |
schorsch |
1.13 |
# vim: set syntax=python: |