1 |
schorsch |
1.1 |
|
2 |
|
|
import os |
3 |
|
|
import sys |
4 |
|
|
import string |
5 |
|
|
|
6 |
|
|
OPTFILE = 'rayopts.py' |
7 |
|
|
def set_opts(env): |
8 |
schorsch |
1.8 |
# XXX add some caching |
9 |
|
|
opts = Options(OPTFILE, ARGUMENTS) |
10 |
|
|
opts.Add('SKIP', 'Skip Display of License terms', 0) |
11 |
|
|
opts.Add('RAD_BINDIR', 'Install executables here', env['RAD_BINDIR']) |
12 |
|
|
opts.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR']) |
13 |
|
|
opts.Add('RAD_MANDIR', 'Install man pages here', env['RAD_MANDIR']) |
14 |
|
|
opts.Add('RAD_DEBUG', 'Build a debug version', 0) |
15 |
|
|
opts.Update(env) |
16 |
|
|
opts.Save(OPTFILE, env) |
17 |
|
|
Help(opts.GenerateHelpText(env, sort=cmp)) |
18 |
schorsch |
1.1 |
# where stuff is located in the source tree |
19 |
schorsch |
1.8 |
env['RAD_BUILDLIB'] = '#src/lib' |
20 |
|
|
env['RAD_BUILDBIN'] = '#bin' |
21 |
|
|
env['RAD_BUILDRLIB'] = '#lib' |
22 |
|
|
env['RAD_BUILDMAN'] = '#doc/man' |
23 |
schorsch |
1.1 |
|
24 |
|
|
def allplats_setup(env): |
25 |
schorsch |
1.8 |
from build_utils import find_libs |
26 |
|
|
find_libs.find_x11(env) |
27 |
|
|
find_libs.find_gl(env) # OpenGL |
28 |
|
|
find_libs.find_libtiff(env) |
29 |
schorsch |
1.1 |
|
30 |
|
|
def post_common_setup(env): |
31 |
schorsch |
1.8 |
env.Append(CPPPATH = [os.path.join('#src', 'common')]) |
32 |
|
|
env.Append(LIBPATH=['../lib']) # our own libs |
33 |
|
|
if not env.has_key('RAD_MLIB'): |
34 |
|
|
env['RAD_MLIB'] = [] #['m'] # no seperate mlib on Win |
35 |
schorsch |
1.1 |
|
36 |
|
|
def shareinstall_setup(env): |
37 |
|
|
from build_utils import install |
38 |
|
|
# only scan for those files when we actually need them |
39 |
|
|
if 'install' in sys.argv or 'rlibinstall' in sys.argv: |
40 |
|
|
install.install_rlibfiles(env) |
41 |
|
|
if 'install' in sys.argv or 'maninstall' in sys.argv: |
42 |
|
|
install.install_manfiles(env) |
43 |
|
|
|
44 |
|
|
# Set up build environment |
45 |
|
|
env = Environment() |
46 |
schorsch |
1.7 |
env.Decider('timestamp-match') |
47 |
schorsch |
1.1 |
|
48 |
schorsch |
1.4 |
if os.name == 'posix': |
49 |
|
|
from build_utils import install |
50 |
|
|
csh_b = Builder(action = install.install_cshscript, |
51 |
|
|
suffix = '', src_suffix = '.csh') |
52 |
|
|
env.Append(BUILDERS={'InstallCsh': csh_b}) |
53 |
|
|
|
54 |
schorsch |
1.1 |
# configure platform-specific stuff |
55 |
|
|
from build_utils import load_plat |
56 |
schorsch |
1.2 |
load_plat.load_plat(env, ARGUMENTS, platform=None) |
57 |
schorsch |
1.1 |
|
58 |
|
|
# override options |
59 |
|
|
set_opts(env) |
60 |
|
|
|
61 |
|
|
# accept license |
62 |
schorsch |
1.8 |
if ((not env['SKIP'] |
63 |
|
|
or env['SKIP'].strip().lower() in (0,'0','no','false')) |
64 |
|
|
and not '-c' in sys.argv and not 'test' in sys.argv): |
65 |
|
|
from build_utils import copyright |
66 |
|
|
copyright.show_license() |
67 |
schorsch |
1.1 |
|
68 |
|
|
# fill in generic config |
69 |
|
|
allplats_setup(env) |
70 |
|
|
|
71 |
schorsch |
1.4 |
|
72 |
schorsch |
1.1 |
# Bring in all the actual things to build |
73 |
|
|
Export('env') |
74 |
schorsch |
1.8 |
if 'test' in sys.argv: |
75 |
|
|
SConscript(os.path.join('test', 'SConscript')) |
76 |
|
|
|
77 |
|
|
else: |
78 |
|
|
SConscript(os.path.join('src', 'common', 'SConscript')) |
79 |
|
|
post_common_setup(env) |
80 |
|
|
for d in Split('meta cv gen ot rt px hd util cal'): |
81 |
|
|
print d |
82 |
|
|
SConscript(os.path.join('src', d, 'SConscript')) |
83 |
schorsch |
1.1 |
|
84 |
schorsch |
1.8 |
if string.find(string.join(sys.argv[1:]), 'install') > -1: |
85 |
|
|
shareinstall_setup(env) |
86 |
schorsch |
1.1 |
|
87 |
schorsch |
1.6 |
Default('.') |
88 |
|
|
|
89 |
schorsch |
1.1 |
# virtual targets |
90 |
schorsch |
1.4 |
env.Alias('bininstall', '$RAD_BINDIR') |
91 |
|
|
env.Alias('rlibinstall', '$RAD_RLIBDIR') |
92 |
|
|
env.Alias('maninstall', '$RAD_MANDIR') |
93 |
schorsch |
1.1 |
|
94 |
|
|
env.Alias('build', ['#bin']) |
95 |
schorsch |
1.8 |
env.Alias('test', ['#test']) |
96 |
schorsch |
1.1 |
env.Alias('install', ['bininstall', 'rlibinstall', 'maninstall']) |
97 |
|
|
|