Steps towards isolating Windows-isms in the construction environment from Linux/Posix/Mac-isms, and fixes:

* Only put Windows settings on the construction environment when PLATFORM == 'win32', and provide a PLATFORM == 'posix' block for necessary settings there.
* Don't hard-code C:/ as the location of Microsoft Visual Studio 8, so we can find memset.obj even on buildbot systems that have it installed on D:.
* Work around how SCons 0.98.3 fails to handle environment variables imported from Visual Studio that use | to separate diferent architecture types in the (e.g.) PATH.  (This is fixed in 0.98.4, after which we can remove the workaround.)
* Deep copy the environment we use to build v8_shell.exe so objects therein can't pollute other environments.
TBR: evanm,bradnelson

git-svn-id: http://src.chromium.org/svn/trunk/src/build@223 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
sgk@google.com 2008-08-01 04:12:25 +00:00
Родитель 7819c1248e
Коммит 2b84924b9b
2 изменённых файлов: 49 добавлений и 27 удалений

Просмотреть файл

@ -48,9 +48,6 @@ processors = int(os.environ.get('NUMBER_OF_PROCESSORS', 1))
SetOption('num_jobs', processors + 1)
msvs_env = Environment(tools=['msvc', 'mslink', 'msvs'])['ENV']
env = Environment(
BUILD_TYPE = ARGUMENTS.get('BUILD_TYPE', 'Hammer'),
TARGET_ROOT = '#/$BUILD_TYPE',
@ -60,7 +57,7 @@ env = Environment(
PLATFORMSDK_VISTA_REL = '../third_party/platformsdk_vista_6_0',
PLATFORMSDK_VISTA = '#/$PLATFORMSDK_VISTA_REL',
VISUAL_STUDIO = 'C:/Program Files/Microsoft Visual Studio 8',
VISUAL_STUDIO = '/Program Files/Microsoft Visual Studio 8',
BASE_DIR = '#/$BUILD_TYPE/base',
BREAKPAD_DIR = '#/$BUILD_TYPE/breakpad',
@ -104,11 +101,18 @@ env = Environment(
THIRD_PARTY_WEBKIT_DIR = '$THIRD_PARTY_DIR/webkit',
PYTHON=sys.executable,
)
if env['PLATFORM'] == 'win32':
msvs_env = Environment(tools=['msvc', 'mslink', 'msvs'])['ENV']
env.Replace(
CYGWIN_DIR = Dir('#../third_party/cygwin'),
CYGWIN_BIN_DIR = '$CYGWIN_DIR/bin',
PYTHON=sys.executable,
PERL = '$CYGWIN_BIN_DIR/perl.exe',
PERL_INCLUDE_FLAG = '-I ',
PERL_INCLUDE_SUFFIX = '',
@ -176,14 +180,47 @@ env = Environment(
LIBPATH = [
'$PLATFORMSDK_VISTA/files/Lib',
'$PLATFORMSDK_VISTA/files/VC/LIB',
'c:/Program Files/Microsoft Visual Studio 8/VC/atlmfc/lib',
'$VISUAL_STUDIO/VC/atlmfc/lib',
],
LINKFLAGS = [
'/nologo',
'/DEBUG',
],
)
)
# TODO(sgk): remove once we upgrade to SCons 0.98.4
for var in ['INCLUDE', 'LIB', 'PATH']:
msvs_env[var] = msvs_env[var].split('|', 1)[0]
env['ENV'][var] = env['ENV'][var].split('|', 1)[0]
# Force scons to handle long include lines correctly.
pchcom_fixed = env['PCHCOM']
pchcom_fixed = pchcom_fixed.replace('${TARGETS[0]}', '$TARGET')
pchcom_fixed = pchcom_fixed.replace('${TARGETS[1]}', '$TARGETS1')
env.Replace(
CCCOM = "${TEMPFILE('%s')}" % env['CCCOM'],
CXXCOM = "${TEMPFILE('%s')}" % env['CXXCOM'],
SHCCCOM = "${TEMPFILE('%s')}" % env['SHCCCOM'],
SHCXXCOM = "${TEMPFILE('%s')}" % env['SHCXXCOM'],
PCHCOM = "${TEMPFILE('%s')}" % pchcom_fixed,
TARGETS1 = '${TARGETS[1]}',
)
env['ENV']['PROGRAMFILES'] = os.environ['PROGRAMFILES']
env['ENV']['SystemDrive'] = os.environ['SystemDrive']
env['ENV']['USERPROFILE'] = os.environ['USERPROFILE']
elif env['PLATFORM'] == 'posix':
env.Replace()
else:
print "Unsupported SCons $PLATFORM value %s" % repr(env['PLATFORM'])
Exit(1)
if ARGUMENTS.get('VERBOSE') in (None, '0'):
env['CCCOMSTR'] = 'Compiling $TARGET ...'
@ -206,27 +243,10 @@ AddOption('--clobber', action='store_true', dest='clobber', default=False,
if GetOption('clobber'):
shutil.rmtree(env.Dir('$TARGET_ROOT').abspath, True)
# Force scons to handle long include lines correctly.
pchcom_fixed = env['PCHCOM']
pchcom_fixed = pchcom_fixed.replace('${TARGETS[0]}', '$TARGET')
pchcom_fixed = pchcom_fixed.replace('${TARGETS[1]}', '$TARGETS1')
env.Replace(
CCCOM = "${TEMPFILE('%s')}" % env['CCCOM'],
CXXCOM = "${TEMPFILE('%s')}" % env['CXXCOM'],
SHCCCOM = "${TEMPFILE('%s')}" % env['SHCCCOM'],
SHCXXCOM = "${TEMPFILE('%s')}" % env['SHCXXCOM'],
PCHCOM = "${TEMPFILE('%s')}" % pchcom_fixed,
TARGETS1 = '${TARGETS[1]}',
)
env['ENV']['PROGRAMFILES'] = os.environ['PROGRAMFILES']
env['ENV']['SystemDrive'] = os.environ['SystemDrive']
env['ENV']['USERPROFILE'] = os.environ['USERPROFILE']
# Use timestamps change, followed by MD5 for speed
env.Decider('MD5-timestamp')
# Overlay things from a layer below.
env.Dir('$TARGET_ROOT').addRepository(Dir('..'))
@ -324,6 +344,7 @@ Supported build variables:
PROGRESS=type Display a progress indicator:
name: print each evaluated target name
spinner: print a spinner every 5 targets
VERBOSE=1 Display full command lines
"""
if GetOption('help'):

Просмотреть файл

@ -33,8 +33,9 @@ env = env.Clone()
# Grungy environment hackery to satisfy the Visual Studio that we're
# going to execute.
import copy
import os
env['ENV'] = os.environ.copy()
env['ENV'] = copy.deepcopy(os.environ)
env.AppendENVPath('INCLUDE', env['MSVS_ENV']['INCLUDE'])
env.AppendENVPath('LIB', env['MSVS_ENV']['LIB'])