summaryrefslogtreecommitdiffstats
path: root/build/SConscript.v8
blob: b89da2aa03ec8b6e5ffa87dadb55f0e6f2a847ac (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
# 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('env')

# Grab the -j flag from the outer environment, if available.
try:
  cpus = env.GetOption('num_jobs')
  cpu_flag = ' -j%d' % cpus
except AttributeError:
  cpu_flag = ''

env = env.Clone(
    V8_MODE = 'release',
    V8_SRC_DIR = '#/../v8',
    V8_MODE_DIR = '$V8_SRC_DIR/obj/$V8_MODE',
    SCONS='../third_party/scons/scons.py',
    SCONSFLAGS = ('-Q '
                  '--warn=no-deprecated '
                  '--warn=no-no-parallel-support' + cpu_flag),
)

# 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.

mksnapshot_exe = env.File('$V8_MODE_DIR/mksnapshot${PROGSUFFIX}')
libraries_obj = env.File('$V8_MODE_DIR/libraries${OBJSUFFIX}')
libraries_empty_obj = env.File('$V8_MODE_DIR/libraries-empty${OBJSUFFIX}')
snapshot_obj = env.File('$V8_MODE_DIR/snapshot${OBJSUFFIX}')
snapshot_empty_obj = env.File('$V8_MODE_DIR/snapshot-empty${OBJSUFFIX}')
v8_bin = env.File('$V8_SRC_DIR/shell${PROGSUFFIX}')
v8_lib = env.File('$V8_SRC_DIR/${LIBPREFIX}v8${LIBSUFFIX}'),

v8_scons_targets = [
    mksnapshot_exe,
    libraries_obj,
    libraries_empty_obj,
    snapshot_obj,
    snapshot_empty_obj,
    v8_bin,
    v8_lib,
]

if env['PLATFORM'] == 'win32':
  v8_scons_targets.extend([
      env.File('#/../v8/vc80.pdb')
  ])

v8 = env.Command(v8_scons_targets,
                 [],
                 'cd ../v8 && $PYTHON $SCONS $SCONSFLAGS $V8FLAGS',
                 V8FLAGS='mode=$V8_MODE snapshot=off sample=shell')
env.AlwaysBuild(v8)
env.Install('$V8_DIR', 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)

i = env.Install('$LIBS_DIR', v8_lib)
env.Alias('webkit', i)

i = env.Install('$TARGET_ROOT', v8_bin)
env.Alias('chrome', i)

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

env.ChromeStaticLibrary('v8_snapshot',
                        [libraries_empty_obj, snapshot_obj])