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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
# Copyright 2009, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import __builtin__
import os
import sys
import SCons.Script.SConsOptions
Import('env')
try:
_ = __builtin__.v8_built
Return()
except AttributeError:
__builtin__.v8_built = True
if env.Bit('windows'):
script_suffix = '.bat'
else:
script_suffix = '.sh'
env = env.Clone(
V8_MODE = 'release',
V8_MODE_DIR = '$V8_SRC_DIR/obj/$V8_MODE',
V8_SCONS_COM = '$PYTHON $SCONS -C $V8_SRC_DIR -f SConstruct '
'$DEBUG_OPTS mode=$V8_MODE importenv=INCLUDE,LIB',
SCONS = '$SCONS_DIR/scons.py',
DEBUG_OPTS = ['--debug=%s' % item for item in GetOption('debug')]
)
# 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_snapshot = [
libraries_empty_obj,
snapshot_obj,
]
v8_scons_targets_no_snapshot = [
mksnapshot_exe,
libraries_obj,
snapshot_empty_obj,
v8_bin,
v8_lib,
]
v8_env = env.Clone()
if v8_env.Bit('windows'):
v8_env['ENV']['VSCOMNTOOLS'] = env.subst('$VC80_DIR/Common7/Tools')
# SCons crashes if USERPROFILE isn't defined, and it's not defined
# on Vista for some reason, so this is to make the Vista build work.
try:
v8_env['ENV']['USERPROFILE'] = os.environ['USERPROFILE']
except KeyError:
v8_env['ENV']['USERPROFILE'] = ""
include_path = ";".join(
[v8_env.subst("$INCLUDE"),
v8_env.subst("$PLATFORM_SDK_VISTA_6_0_DIR/Include")])
try:
v8_env['ENV']['INCLUDE'] += ";" + include_path
except KeyError:
v8_env['ENV']['INCLUDE'] = include_path
lib_path = ";".join(
[v8_env.subst("$LIB"),
v8_env.subst("$PLATFORM_SDK_VISTA_6_0_DIR/Lib")])
try:
v8_env['ENV']['LIB'] += ";" + lib_path
except KeyError:
v8_env['ENV']['LIB'] = lib_path
v8_no_snapshot = v8_env.Command(
v8_scons_targets_no_snapshot,
[],
['$V8_SCONS_COM msvcltcg=off snapshot=off sample=shell'])
v8_snapshot = v8_env.Command(
v8_scons_targets_snapshot,
[],
['$V8_SCONS_COM msvcltcg=off snapshot=on'])
v8_env.AlwaysBuild(v8_no_snapshot)
v8_env.AlwaysBuild(v8_snapshot)
# 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).
v8_env.Precious(v8_no_snapshot)
v8_env.Precious(v8_snapshot)
v8_env.Install('$LIB_DIR', v8_lib)
|