summaryrefslogtreecommitdiffstats
path: root/build/SConscript.v8
blob: c41c38d845263aeb26edbb79fcf53e2927cb4430 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os

Import('env')

if not env.Dir('$CHROME_SRC_DIR/v8').exists():
  Return()

# The v8 build script wants a 'debug'/'release' string to tell it whether
# to build optimized.  Convert our build flags into that form.
mode = 'release'
if env['TARGET_DEBUG']:
  mode = 'debug'

env = env.Clone(
    V8_MODE = mode,
    V8_MODE_DIR = '$V8_DIR/obj/$V8_MODE',
    V8_SCONS_COM = '$PYTHON $SCONS $SCONSFLAGS mode=$V8_MODE',
    SCONS = '$CHROME_SRC_DIR/third_party/scons/scons.py',
    SCONSFLAGS = ('-Q '
                  '-C $OBJ_ROOT/v8 '
                  '-Y $CHROME_SRC_DIR/v8 '
                  '--warn=no-deprecated '
                  '--warn=no-no-parallel-support'),
)

# Rather than build v8 with our own commands, we just shell out to v8's
# own SCons-based build, since their build system is complicated.
# This SConscript just declares dependencies on the outputs of that build.
#
# Arrange to make sure the build directory exists, since the subsidiary
# SCons we invoke will chdir there of its own accord.

if not os.path.exists(env.Dir('$OBJ_ROOT/v8').abspath):
  Mkdir(env.Dir('$OBJ_ROOT/v8').abspath)


# v8 builds all outputs "foo" instead as "foo_g" in debug mode.
binsuffix = ''
if env['TARGET_DEBUG']:
  binsuffix = '_g'

v8_scons_targets_off = [
    '$V8_DIR/shell%s${PROGSUFFIX}' % binsuffix,
    '$V8_DIR/${LIBPREFIX}v8%s${LIBSUFFIX}' % binsuffix,
    '$V8_MODE_DIR/mksnapshot${PROGSUFFIX}',
    '$V8_MODE_DIR/libraries${OBJSUFFIX}',
    '$V8_MODE_DIR/snapshot-empty${OBJSUFFIX}',
]

v8_scons_targets_on = [
    '$V8_MODE_DIR/libraries-empty${OBJSUFFIX}',
    '$V8_MODE_DIR/snapshot${OBJSUFFIX}',
]

if env.Bit('windows'):
  v8_scons_targets_off.extend([
      env.File('$V8_DIR/vc80.pdb')
  ])

v8 = env.Command(v8_scons_targets_off + v8_scons_targets_on,
                 [],
                 ['$V8_SCONS_COM snapshot=off sample=shell',
                  '$V8_SCONS_COM snapshot=on ${TARGETS[-%d:].abspath}'
                      % len(v8_scons_targets_on)])
env.AlwaysBuild(v8)

# Tell our SCons invocation to *not* delete v8.lib and the other targets
# before building them, so the subsidiary v8 SCons call doesn't always
# rebuild them (thereby causing us to always rebuild their dependents).
env.Precious(v8)


env.Install('$TARGET_ROOT', v8[0])
env.Install('$LIBS_DIR', v8[1])
env.Install('$V8_DIR', '$V8_MODE_DIR/snapshot-empty${OBJSUFFIX}')

# To satisfy tests expecting the following .exe name.
if env.Bit('windows'):
  # TODO(evanm): this may be necessary on other platforms(?)
  i = env.InstallAs('$TARGET_ROOT/v8_shell_sample${PROGSUFFIX}', v8[0])

env.ChromeStaticLibrary('v8_snapshot',
                        ['$V8_MODE_DIR/libraries-empty${OBJSUFFIX}',
                         '$V8_MODE_DIR/snapshot${OBJSUFFIX}'])

env.ChromeMSVSProject('$V8_DIR/tools/visual_studio/v8.vcproj',
                dependencies = [
                    '$V8_DIR/tools/visual_studio/v8_base.vcproj',
                ],
                guid='{21E22961-22BF-4493-BD3A-868F93DA5179}')

env.ChromeMSVSProject('$V8_DIR/tools/visual_studio/v8_base.vcproj',
                guid='{EC8B7909-62AF-470D-A75D-E1D89C837142}')

env.ChromeMSVSProject('$V8_DIR/tools/visual_studio/v8_mksnapshot.vcproj',
                dependencies = [
                    '$V8_DIR/tools/visual_studio/v8.vcproj',
                ],
                guid='{865575D0-37E2-405E-8CBA-5F6C485B5A26}')

env.ChromeMSVSProject('$V8_DIR/tools/visual_studio/v8_shell_sample.vcproj',
                dependencies = [
                    '$V8_DIR/tools/visual_studio/v8_snapshot.vcproj',
                ],
                guid='{2DE20FFA-6F5E-48D9-84D8-09B044A5B119}')

env.ChromeMSVSProject('$V8_DIR/tools/visual_studio/v8_snapshot.vcproj',
                dependencies = [
                    '$V8_DIR/tools/visual_studio/v8_mksnapshot.vcproj',
                    '$V8_DIR/tools/visual_studio/v8_base.vcproj',
                ],
                guid='{C0334F9A-1168-4101-9DD8-C30FB252D435}')