1 |
schorsch |
1.1 |
|
2 |
|
|
import os |
3 |
|
|
import sys |
4 |
|
|
import string |
5 |
|
|
|
6 |
|
|
OPTFILE = 'rayopts.py' |
7 |
schorsch |
1.4 |
SourceSignatures('timestamp') |
8 |
schorsch |
1.1 |
def set_opts(env): |
9 |
|
|
# XXX add some caching |
10 |
|
|
opts = Options(OPTFILE, ARGUMENTS) |
11 |
|
|
opts.Add('SKIP', 'Skip Display of License terms', 0) |
12 |
|
|
opts.Add('RAD_BINDIR', 'Install executables here', env['RAD_BINDIR']) |
13 |
|
|
opts.Add('RAD_RLIBDIR', 'Install support files here', env['RAD_RLIBDIR']) |
14 |
|
|
opts.Add('RAD_MANDIR', 'Install man pages here', env['RAD_MANDIR']) |
15 |
schorsch |
1.2 |
opts.Add('RAD_DEBUG', 'Build a debug version', 0) |
16 |
schorsch |
1.1 |
opts.Update(env) |
17 |
|
|
opts.Save(OPTFILE, env) |
18 |
|
|
Help(opts.GenerateHelpText(env, sort=cmp)) |
19 |
|
|
# where stuff is located in the source tree |
20 |
|
|
env['RAD_BUILDLIB'] = '#src/lib' |
21 |
|
|
env['RAD_BUILDBIN'] = '#bin' |
22 |
|
|
env['RAD_BUILDRLIB'] = '#lib' |
23 |
|
|
env['RAD_BUILDMAN'] = '#doc/man' |
24 |
|
|
|
25 |
|
|
def allplats_setup(env): |
26 |
|
|
from build_utils import find_libs |
27 |
|
|
find_libs.find_x11(env) |
28 |
|
|
find_libs.find_gl(env) # OpenGL |
29 |
|
|
|
30 |
|
|
def post_common_setup(env): |
31 |
|
|
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 |
|
|
|
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 |
|
|
|
47 |
schorsch |
1.4 |
if os.name == 'posix': |
48 |
|
|
from build_utils import install |
49 |
|
|
csh_b = Builder(action = install.install_cshscript, |
50 |
|
|
suffix = '', src_suffix = '.csh') |
51 |
|
|
env.Append(BUILDERS={'InstallCsh': csh_b}) |
52 |
|
|
|
53 |
schorsch |
1.1 |
# configure platform-specific stuff |
54 |
|
|
from build_utils import load_plat |
55 |
schorsch |
1.2 |
load_plat.load_plat(env, ARGUMENTS, platform=None) |
56 |
schorsch |
1.1 |
|
57 |
|
|
# override options |
58 |
|
|
set_opts(env) |
59 |
|
|
|
60 |
|
|
# accept license |
61 |
|
|
if not env['SKIP'] and not '-c' in sys.argv: |
62 |
|
|
from build_utils import copyright |
63 |
|
|
copyright.show_license() |
64 |
|
|
|
65 |
|
|
# fill in generic config |
66 |
|
|
allplats_setup(env) |
67 |
|
|
|
68 |
schorsch |
1.4 |
|
69 |
|
|
|
70 |
schorsch |
1.1 |
# Bring in all the actual things to build |
71 |
|
|
Export('env') |
72 |
|
|
SConscript(os.path.join('src', 'common', 'SConscript')) |
73 |
|
|
post_common_setup(env) |
74 |
|
|
for d in Split('meta cv gen ot rt px hd util cal'): |
75 |
schorsch |
1.3 |
print d |
76 |
schorsch |
1.1 |
SConscript(os.path.join('src', d, 'SConscript')) |
77 |
|
|
|
78 |
|
|
if string.find(string.join(sys.argv[1:]), 'install') > -1: |
79 |
|
|
shareinstall_setup(env) |
80 |
|
|
|
81 |
schorsch |
1.6 |
Default('.') |
82 |
|
|
|
83 |
schorsch |
1.1 |
# virtual targets |
84 |
schorsch |
1.4 |
env.Alias('bininstall', '$RAD_BINDIR') |
85 |
|
|
env.Alias('rlibinstall', '$RAD_RLIBDIR') |
86 |
|
|
env.Alias('maninstall', '$RAD_MANDIR') |
87 |
schorsch |
1.1 |
|
88 |
|
|
env.Alias('build', ['#bin']) |
89 |
|
|
env.Alias('test', ['#src/test']) |
90 |
|
|
env.Alias('install', ['bininstall', 'rlibinstall', 'maninstall']) |
91 |
|
|
|