| Index: site_scons/site_tools/chromium_builders.py
 | 
| ===================================================================
 | 
| --- site_scons/site_tools/chromium_builders.py	(revision 12226)
 | 
| +++ site_scons/site_tools/chromium_builders.py	(working copy)
 | 
| @@ -52,6 +52,38 @@
 | 
|        else:
 | 
|          top[i] = new
 | 
|  
 | 
| +
 | 
| +def FilterOut(self, **kw):
 | 
| +  """Removes values from existing construction variables in an Environment.
 | 
| +
 | 
| +  The values to remove should be a list.  For example:
 | 
| +
 | 
| +  self.FilterOut(CPPDEFINES=['REMOVE_ME', 'ME_TOO'])
 | 
| +
 | 
| +  Args:
 | 
| +    self: Environment to alter.
 | 
| +    kw: (Any other named arguments are values to remove).
 | 
| +  """
 | 
| +
 | 
| +  kw = SCons.Environment.copy_non_reserved_keywords(kw)
 | 
| +  for key, val in kw.items():
 | 
| +    envval = self.get(key, None)
 | 
| +    if envval is None:
 | 
| +      # No existing variable in the environment, so nothing to delete.
 | 
| +      continue
 | 
| +
 | 
| +    for vremove in val:
 | 
| +      # Use while not if, so we can handle duplicates.
 | 
| +      while vremove in envval:
 | 
| +        envval.remove(vremove)
 | 
| +
 | 
| +    self[key] = envval
 | 
| +
 | 
| +    # TODO(sgk): SCons.Environment.Append() has much more logic to deal
 | 
| +    # with various types of values.  We should handle all those cases in here
 | 
| +    # too.  (If variable is a dict, etc.)
 | 
| +
 | 
| +
 | 
|  import __builtin__
 | 
|  __builtin__.ChromeFileList = ChromeFileList
 | 
|  
 | 
| @@ -119,6 +151,15 @@
 | 
|      result = env.ComponentLibrary(target, source, *args, **kw)
 | 
|    return result
 | 
|  
 | 
| +def ChromeLoadableModule(env, target, source, *args, **kw):
 | 
| +  source = compilable_files(env, source)
 | 
| +  if env.get('_GYP'):
 | 
| +    result = env.LoadableModule(target, source, *args, **kw)
 | 
| +  else:
 | 
| +    kw['COMPONENT_STATIC'] = True
 | 
| +    result = env.LoadableModule(target, source, *args, **kw)
 | 
| +  return result
 | 
| +
 | 
|  def ChromeStaticLibrary(env, target, source, *args, **kw):
 | 
|    source = compilable_files(env, source)
 | 
|    if env.get('_GYP'):
 | 
| @@ -189,6 +230,7 @@
 | 
|    env.AddMethod(ChromeProgram)
 | 
|    env.AddMethod(ChromeTestProgram)
 | 
|    env.AddMethod(ChromeLibrary)
 | 
| +  env.AddMethod(ChromeLoadableModule)
 | 
|    env.AddMethod(ChromeStaticLibrary)
 | 
|    env.AddMethod(ChromeSharedLibrary)
 | 
|    env.AddMethod(ChromeObject)
 | 
| @@ -196,6 +238,8 @@
 | 
|    env.AddMethod(ChromeMSVSProject)
 | 
|    env.AddMethod(ChromeMSVSSolution)
 | 
|  
 | 
| +  env.AddMethod(FilterOut)
 | 
| +
 | 
|    # Add the grit tool to the base environment because we use this a lot.
 | 
|    sys.path.append(env.Dir('$CHROME_SRC_DIR/tools/grit').abspath)
 | 
|    env.Tool('scons', toolpath=[env.Dir('$CHROME_SRC_DIR/tools/grit/grit')])
 | 
| 
 |