# 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') # 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_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' + 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. # # 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_scons_targets_off = [ '$V8_DIR/shell${PROGSUFFIX}', '$V8_DIR/${LIBPREFIX}v8${LIBSUFFIX}', '$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['PLATFORM'] == 'win32': 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['PLATFORM'] == 'win32': # 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}'])