Refactored the evn override handling to a single method and fixed the handling
authorsgjesse@gmail.com <sgjesse@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 5 Sep 2008 10:00:50 +0000 (10:00 +0000)
committersgjesse@gmail.com <sgjesse@gmail.com@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 5 Sep 2008 10:00:50 +0000 (10:00 +0000)
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

SConstruct
src/SConscript
test/cctest/SConscript

index ebb2b9e..c872039 100644 (file)
@@ -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:
index 15ec440..3b3f5e8 100644 (file)
@@ -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')
 
index cc59199..3576cbc 100644 (file)
@@ -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.