| OLD | NEW |
| (Empty) |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import os | |
| 6 | |
| 7 Import('env') | |
| 8 | |
| 9 if not env.Dir('$CHROME_SRC_DIR/v8').exists(): | |
| 10 Return() | |
| 11 | |
| 12 # The v8 build script wants a 'debug'/'release' string to tell it whether | |
| 13 # to build optimized. Convert our build flags into that form. | |
| 14 mode = 'release' | |
| 15 if env['TARGET_DEBUG']: | |
| 16 mode = 'debug' | |
| 17 | |
| 18 # Don't build V8 as a shared object because the v8 scons file doesn't support | |
| 19 # it. | |
| 20 env.Replace(COMPONENT_STATIC=True) | |
| 21 | |
| 22 env = env.Clone( | |
| 23 V8_MODE = mode, | |
| 24 V8_MODE_DIR = '$V8_DIR/obj/$V8_MODE', | |
| 25 V8_SCONS_COM = '$PYTHON $SCONS $SCONSFLAGS mode=$V8_MODE', | |
| 26 SCONS = '$CHROME_SRC_DIR/third_party/scons/scons.py', | |
| 27 SCONSFLAGS = ('-Q ' | |
| 28 '-C $OBJ_ROOT/v8 ' | |
| 29 '-Y $CHROME_SRC_DIR/v8 ' | |
| 30 '--warn=no-deprecated ' | |
| 31 '--warn=no-no-parallel-support'), | |
| 32 ) | |
| 33 | |
| 34 # Rather than build v8 with our own commands, we just shell out to v8's | |
| 35 # own SCons-based build, since their build system is complicated. | |
| 36 # This SConscript just declares dependencies on the outputs of that build. | |
| 37 # | |
| 38 # Arrange to make sure the build directory exists, since the subsidiary | |
| 39 # SCons we invoke will chdir there of its own accord. | |
| 40 | |
| 41 if not os.path.exists(env.Dir('$OBJ_ROOT/v8').abspath): | |
| 42 Mkdir(env.Dir('$OBJ_ROOT/v8').abspath) | |
| 43 | |
| 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 | |
| 50 v8_scons_targets_off = [ | |
| 51 '$V8_DIR/shell%s${PROGSUFFIX}' % binsuffix, | |
| 52 '$V8_DIR/${LIBPREFIX}v8%s${LIBSUFFIX}' % binsuffix, | |
| 53 '$V8_MODE_DIR/mksnapshot${PROGSUFFIX}', | |
| 54 '$V8_MODE_DIR/libraries${OBJSUFFIX}', | |
| 55 '$V8_MODE_DIR/snapshot-empty${OBJSUFFIX}', | |
| 56 ] | |
| 57 | |
| 58 v8_scons_targets_on = [ | |
| 59 '$V8_MODE_DIR/libraries-empty${OBJSUFFIX}', | |
| 60 '$V8_MODE_DIR/snapshot${OBJSUFFIX}', | |
| 61 ] | |
| 62 | |
| 63 if env.Bit('windows'): | |
| 64 v8_scons_targets_off.extend([ | |
| 65 env.File('$V8_DIR/vc80.pdb') | |
| 66 ]) | |
| 67 | |
| 68 v8 = env.Command(v8_scons_targets_off + v8_scons_targets_on, | |
| 69 [], | |
| 70 ['$V8_SCONS_COM snapshot=off sample=shell', | |
| 71 '$V8_SCONS_COM snapshot=on ${TARGETS[-%d:].abspath}' | |
| 72 % len(v8_scons_targets_on)]) | |
| 73 env.AlwaysBuild(v8) | |
| 74 | |
| 75 # Tell our SCons invocation to *not* delete v8.lib and the other targets | |
| 76 # before building them, so the subsidiary v8 SCons call doesn't always | |
| 77 # rebuild them (thereby causing us to always rebuild their dependents). | |
| 78 env.Precious(v8) | |
| 79 | |
| 80 | |
| 81 env.Install('$TARGET_ROOT', v8[0]) | |
| 82 env.Install('$LIB_DIR', v8[1]) | |
| 83 env.Install('$V8_DIR', '$V8_MODE_DIR/snapshot-empty${OBJSUFFIX}') | |
| 84 | |
| 85 # To satisfy tests expecting the following .exe name. | |
| 86 if env.Bit('windows'): | |
| 87 # TODO(evanm): this may be necessary on other platforms(?) | |
| 88 i = env.InstallAs('$TARGET_ROOT/v8_shell_sample${PROGSUFFIX}', v8[0]) | |
| 89 | |
| 90 env.ChromeLibrary('v8_snapshot', | |
| 91 ['$V8_MODE_DIR/libraries-empty${OBJSUFFIX}', | |
| 92 '$V8_MODE_DIR/snapshot${OBJSUFFIX}']) | |
| 93 | |
| 94 env.ChromeMSVSProject('$V8_DIR/tools/visual_studio/v8.vcproj', | |
| 95 dependencies = [ | |
| 96 '$V8_DIR/tools/visual_studio/v8_base.vcproj', | |
| 97 ], | |
| 98 guid='{21E22961-22BF-4493-BD3A-868F93DA5179}') | |
| 99 | |
| 100 env.ChromeMSVSProject('$V8_DIR/tools/visual_studio/v8_base.vcproj', | |
| 101 guid='{EC8B7909-62AF-470D-A75D-E1D89C837142}') | |
| 102 | |
| 103 env.ChromeMSVSProject('$V8_DIR/tools/visual_studio/v8_mksnapshot.vcproj', | |
| 104 dependencies = [ | |
| 105 '$V8_DIR/tools/visual_studio/v8.vcproj', | |
| 106 ], | |
| 107 guid='{865575D0-37E2-405E-8CBA-5F6C485B5A26}') | |
| 108 | |
| 109 env.ChromeMSVSProject('$V8_DIR/tools/visual_studio/v8_shell_sample.vcproj', | |
| 110 dependencies = [ | |
| 111 '$V8_DIR/tools/visual_studio/v8_snapshot.vcproj', | |
| 112 ], | |
| 113 guid='{2DE20FFA-6F5E-48D9-84D8-09B044A5B119}') | |
| 114 | |
| 115 env.ChromeMSVSProject('$V8_DIR/tools/visual_studio/v8_snapshot.vcproj', | |
| 116 dependencies = [ | |
| 117 '$V8_DIR/tools/visual_studio/v8_mksnapshot.vcproj', | |
| 118 '$V8_DIR/tools/visual_studio/v8_base.vcproj', | |
| 119 ], | |
| 120 guid='{C0334F9A-1168-4101-9DD8-C30FB252D435}') | |
| OLD | NEW |