OLD | NEW |
1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os | 5 import os |
6 | 6 |
7 Import('env') | 7 Import('env') |
8 | 8 |
9 # Grab the -j flag from the outer environment, if available. | 9 # Grab the -j flag from the outer environment, if available. |
10 try: | 10 try: |
11 cpus = env.GetOption('num_jobs') | 11 cpus = env.GetOption('num_jobs') |
12 cpu_flag = ' -j%d' % cpus | 12 cpu_flag = ' -j%d' % cpus |
13 except AttributeError: | 13 except AttributeError: |
14 cpu_flag = '' | 14 cpu_flag = '' |
15 | 15 |
| 16 # The v8 build script wants a 'debug'/'release' string to tell it whether |
| 17 # to build optimized. Convert our build flags into that form. |
| 18 mode = 'release' |
| 19 if env['TARGET_DEBUG']: |
| 20 mode = 'debug' |
| 21 |
16 env = env.Clone( | 22 env = env.Clone( |
17 V8_MODE = 'debug', | 23 V8_MODE = mode, |
18 V8_MODE_DIR = '$V8_DIR/obj/$V8_MODE', | 24 V8_MODE_DIR = '$V8_DIR/obj/$V8_MODE', |
19 V8_SCONS_COM = '$PYTHON $SCONS $SCONSFLAGS mode=$V8_MODE', | 25 V8_SCONS_COM = '$PYTHON $SCONS $SCONSFLAGS mode=$V8_MODE', |
20 SCONS='$CHROME_SRC_DIR/third_party/scons/scons.py', | 26 SCONS='$CHROME_SRC_DIR/third_party/scons/scons.py', |
21 SCONSFLAGS = ('-Q ' | 27 SCONSFLAGS = ('-Q ' |
22 '-C $OBJ_ROOT/v8 ' | 28 '-C $OBJ_ROOT/v8 ' |
23 '-Y $CHROME_SRC_DIR/v8 ' | 29 '-Y $CHROME_SRC_DIR/v8 ' |
24 '--warn=no-deprecated ' | 30 '--warn=no-deprecated ' |
25 '--warn=no-no-parallel-support' + cpu_flag), | 31 '--warn=no-no-parallel-support' + cpu_flag), |
26 ) | 32 ) |
27 | 33 |
28 # Rather than build v8 with our own commands, we just shell out to v8's | 34 # Rather than build v8 with our own commands, we just shell out to v8's |
29 # own SCons-based build, since their build system is complicated. | 35 # own SCons-based build, since their build system is complicated. |
30 # This SConscript just declares dependencies on the outputs of that build. | 36 # This SConscript just declares dependencies on the outputs of that build. |
31 # | 37 # |
32 # Arrange to make sure the build directory exists, since the subsidiary | 38 # Arrange to make sure the build directory exists, since the subsidiary |
33 # SCons we invoke will chdir there of its own accord. | 39 # SCons we invoke will chdir there of its own accord. |
34 | 40 |
35 if not os.path.exists(env.Dir('$OBJ_ROOT/v8').abspath): | 41 if not os.path.exists(env.Dir('$OBJ_ROOT/v8').abspath): |
36 Mkdir(env.Dir('$OBJ_ROOT/v8').abspath) | 42 Mkdir(env.Dir('$OBJ_ROOT/v8').abspath) |
37 | 43 |
38 | 44 |
| 45 # v8 builds all outputs "foo" instead as "foo_g" in debug mode. |
| 46 binsuffix = '' |
| 47 if env['TARGET_DEBUG']: |
| 48 binsuffix = '_g' |
| 49 |
39 v8_scons_targets_off = [ | 50 v8_scons_targets_off = [ |
40 '$V8_DIR/shell_g${PROGSUFFIX}', | 51 '$V8_DIR/shell%s${PROGSUFFIX}' % binsuffix, |
41 '$V8_DIR/${LIBPREFIX}v8_g${LIBSUFFIX}', | 52 '$V8_DIR/${LIBPREFIX}v8%s${LIBSUFFIX}' % binsuffix, |
42 '$V8_MODE_DIR/mksnapshot${PROGSUFFIX}', | 53 '$V8_MODE_DIR/mksnapshot${PROGSUFFIX}', |
43 '$V8_MODE_DIR/libraries${OBJSUFFIX}', | 54 '$V8_MODE_DIR/libraries${OBJSUFFIX}', |
44 '$V8_MODE_DIR/snapshot-empty${OBJSUFFIX}', | 55 '$V8_MODE_DIR/snapshot-empty${OBJSUFFIX}', |
45 ] | 56 ] |
46 | 57 |
47 v8_scons_targets_on = [ | 58 v8_scons_targets_on = [ |
48 '$V8_MODE_DIR/libraries-empty${OBJSUFFIX}', | 59 '$V8_MODE_DIR/libraries-empty${OBJSUFFIX}', |
49 '$V8_MODE_DIR/snapshot${OBJSUFFIX}', | 60 '$V8_MODE_DIR/snapshot${OBJSUFFIX}', |
50 ] | 61 ] |
51 | 62 |
(...skipping 20 matching lines...) Expand all Loading... |
72 env.Install('$V8_DIR', '$V8_MODE_DIR/snapshot-empty${OBJSUFFIX}') | 83 env.Install('$V8_DIR', '$V8_MODE_DIR/snapshot-empty${OBJSUFFIX}') |
73 | 84 |
74 # To satisfy tests expecting the following .exe name. | 85 # To satisfy tests expecting the following .exe name. |
75 if env['PLATFORM'] == 'win32': | 86 if env['PLATFORM'] == 'win32': |
76 # TODO(evanm): this may be necessary on other platforms(?) | 87 # TODO(evanm): this may be necessary on other platforms(?) |
77 i = env.InstallAs('$TARGET_ROOT/v8_shell_sample${PROGSUFFIX}', v8[0]) | 88 i = env.InstallAs('$TARGET_ROOT/v8_shell_sample${PROGSUFFIX}', v8[0]) |
78 | 89 |
79 env.ChromeStaticLibrary('v8_snapshot', | 90 env.ChromeStaticLibrary('v8_snapshot', |
80 ['$V8_MODE_DIR/libraries-empty${OBJSUFFIX}', | 91 ['$V8_MODE_DIR/libraries-empty${OBJSUFFIX}', |
81 '$V8_MODE_DIR/snapshot${OBJSUFFIX}']) | 92 '$V8_MODE_DIR/snapshot${OBJSUFFIX}']) |
OLD | NEW |