Commit 4144ac3a authored by sgjesse@gmail.com's avatar sgjesse@gmail.com

Refactored the evn override handling to a single method and fixed the handling

of the case where ENV is not a dictionary which could happen when the
environment variable ENV was set when invoking SCons.

Fixed building dynamic library on Windows in the case where env overrides was
specified as before these was not passed to the linking of the DLL.

There is still a SCons issue when the environment variable ENV is set when
invoking SCons, however this looks like a SCons issue.


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@156 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent bdb91eb7
......@@ -30,6 +30,7 @@ import re
import sys
import os
from os.path import join, dirname, abspath
from types import DictType
root_dir = dirname(File('SConstruct').rfile().abspath)
sys.path.append(join(root_dir, 'tools'))
import js2c, utils
......@@ -370,6 +371,14 @@ class BuildContext(object):
else:
return env.SharedObject(input, **kw)
def ApplyEnvOverrides(self, env):
if not self.env_overrides:
return
if type(env['ENV']) == DictType:
env['ENV'].update(**self.env_overrides)
else:
env['ENV'] = self.env_overrides
def PostprocessOptions(options):
# Adjust architecture if the simulator option has been set
......@@ -428,6 +437,7 @@ def BuildSpecific(env, mode, env_overrides):
)
# Link the object files into a library.
context.ApplyEnvOverrides(env)
if context.options['library'] == 'static':
library = env.StaticLibrary(library_name, object_files)
else:
......
......@@ -97,7 +97,7 @@ def Abort(message):
def ConfigureObjectFiles():
env = Environment()
env.Replace(**context.flags['v8'])
env['ENV'].update(**context.env_overrides)
context.ApplyEnvOverrides(env)
env['BUILDERS']['JS2C'] = Builder(action=js2c.JS2C)
env['BUILDERS']['Snapshot'] = Builder(action='$SOURCE $TARGET --logfile $LOGFILE')
......
......@@ -53,7 +53,7 @@ def Build():
cctest_files = context.GetRelevantSources(SOURCES)
env = Environment()
env.Replace(**context.flags['cctest'])
env['ENV'].update(**context.env_overrides)
context.ApplyEnvOverrides(env)
# There seems to be a glitch in the way scons decides where to put
# PDB files when compiling using MSVC so we specify it manually.
# This should not affect any other platforms.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment