From: sgjesse@gmail.com Date: Fri, 5 Sep 2008 10:00:50 +0000 (+0000) Subject: Refactored the evn override handling to a single method and fixed the handling X-Git-Tag: upstream/4.7.83~25458 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4144ac3adc60e8be209837fed557206bd683566d;p=platform%2Fupstream%2Fv8.git 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 --- diff --git a/SConstruct b/SConstruct index ebb2b9e..c872039 100644 --- a/SConstruct +++ b/SConstruct @@ -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: diff --git a/src/SConscript b/src/SConscript index 15ec440..3b3f5e8 100644 --- a/src/SConscript +++ b/src/SConscript @@ -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') diff --git a/test/cctest/SConscript b/test/cctest/SConscript index cc59199..3576cbc 100644 --- a/test/cctest/SConscript +++ b/test/cctest/SConscript @@ -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.