Chromium Code Reviews| Index: SConstruct |
| diff --git a/SConstruct b/SConstruct |
| index d5486d4c4073ab54171b2562662353441076fa6c..0e6679319a640a11b266b66032cba70c6101519d 100755 |
| --- a/SConstruct |
| +++ b/SConstruct |
| @@ -1256,6 +1256,10 @@ def GetIrtNexe(env, chrome_irt=False): |
| pre_base_env.AddMethod(GetIrtNexe) |
| +def GetTLSEdit(env): |
| + return env['BUILD_ENV'].File('${STAGING_DIR}/tls_edit${PROGSUFFIX}') |
| + |
| +pre_base_env.AddMethod(GetTLSEdit) |
| def CommandValidatorTestNacl(env, name, image, |
| validator_flags=None, |
| @@ -3604,7 +3608,12 @@ def MakeBuildEnv(): |
| build_env = make_env_func(build_platform) |
| build_env['IS_BUILD_ENV'] = True |
| - build_env['BUILD_SCONSCRIPTS'] = [] |
| + build_env['BUILD_SCONSCRIPTS'] = [ |
| + # KEEP THIS SORTED PLEASE |
|
Roland McGrath
2014/01/24 18:50:49
This should have a comment saying that it's tls_ed
|
| + 'src/shared/gio/build.scons', |
| + 'src/shared/platform/build.scons', |
| + 'src/trusted/validator_ragel/build.scons', |
| + ] |
| # The build environment is only used for intermediate steps and should |
| # not be creating any targets. Aliases are used as means to add targets |
| @@ -3613,17 +3622,29 @@ def MakeBuildEnv(): |
| # override the alias function and essentially stub it out. |
| build_env.Alias = lambda env, target, source=[], actions=None, **kw : [] |
| - dbg_build_env, opt_build_env = GenerateOptimizationLevels(build_env) |
| + return build_env |
| - return opt_build_env |
| +def LinkBuildEnv(selected_envs): |
| + build_env_map = { |
| + 'opt': opt_build_env, |
| + 'dbg': dbg_build_env, |
| + } |
| -def LinkBuildEnv(selected_envs, build_env): |
| + # We need to find the optimization level in order to know which |
| + # build environment we want to use |
| + opt_level = None |
| + for env in selected_envs: |
| + if 'OPTIMIZATION_LEVEL' in env: |
| + if env['OPTIMIZATION_LEVEL']: |
| + opt_level = env['OPTIMIZATION_LEVEL'] |
| + break |
| + |
| + build_env = build_env_map.get(opt_level, opt_build_env) |
| for env in selected_envs: |
| env['BUILD_ENV'] = build_env |
| - # If platform is not the same as the host environment, add the targets |
| - # of the host environment so scons can find them |
| - if GetBuildPlatform() != GetTargetPlatform(): |
| + if opt_level not in build_env_map or \ |
|
Roland McGrath
2014/01/24 18:50:49
Use parens around a wrapped expr, and no backslash
|
| + GetBuildPlatform() != GetTargetPlatform(): |
| selected_envs.append(build_env) |
| def DumpEnvironmentInfo(selected_envs): |
| @@ -3689,10 +3710,16 @@ if nacl_env in selected_envs: |
| if nacl_irt_test_env in selected_envs and nacl_env not in selected_envs: |
| selected_envs.append(nacl_env) |
| - |
| DumpEnvironmentInfo(selected_envs) |
| LinkTrustedEnv(selected_envs) |
| -LinkBuildEnv(selected_envs, MakeBuildEnv()) |
| + |
| +# When building nacl, any intermediate build tool that is used during the |
| +# build process must built using the current build environment, not the |
|
Roland McGrath
2014/01/24 18:50:49
s/must built/must be built/
|
| +# target. Create a build environment for this purpose and link it into |
| +# the selected environments |
| +dbg_build_env, opt_build_env = GenerateOptimizationLevels(MakeBuildEnv()) |
| +LinkBuildEnv(selected_envs) |
| + |
| # This must happen after LinkTrustedEnv, since that is where TRUSTED_ENV |
| # is finally set, and env.UsingEmulator() checks TRUSTED_ENV for the emulator. |
| # This must also happen before BuildEnvironments. |