OLD | NEW |
---|---|
1 #! -*- python -*- | 1 #! -*- python -*- |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import atexit | 6 import atexit |
7 import json | 7 import json |
8 import os | 8 import os |
9 import platform | 9 import platform |
10 import re | 10 import re |
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1249 if image: | 1249 if image: |
1250 return env.SConstructAbsPath(image) | 1250 return env.SConstructAbsPath(image) |
1251 | 1251 |
1252 if chrome_irt: | 1252 if chrome_irt: |
1253 return nacl_irt_env.File('${STAGING_DIR}/irt.nexe') | 1253 return nacl_irt_env.File('${STAGING_DIR}/irt.nexe') |
1254 else: | 1254 else: |
1255 return nacl_irt_env.File('${STAGING_DIR}/irt_core.nexe') | 1255 return nacl_irt_env.File('${STAGING_DIR}/irt_core.nexe') |
1256 | 1256 |
1257 pre_base_env.AddMethod(GetIrtNexe) | 1257 pre_base_env.AddMethod(GetIrtNexe) |
1258 | 1258 |
1259 def GetTLSEdit(env): | |
1260 return env['BUILD_ENV'].File('${STAGING_DIR}/tls_edit${PROGSUFFIX}') | |
1261 | |
1262 pre_base_env.AddMethod(GetTLSEdit) | |
1259 | 1263 |
1260 def CommandValidatorTestNacl(env, name, image, | 1264 def CommandValidatorTestNacl(env, name, image, |
1261 validator_flags=None, | 1265 validator_flags=None, |
1262 validator=None, | 1266 validator=None, |
1263 size='medium', | 1267 size='medium', |
1264 **extra): | 1268 **extra): |
1265 validator = env.GetValidator(validator) | 1269 validator = env.GetValidator(validator) |
1266 if validator is None: | 1270 if validator is None: |
1267 print 'WARNING: no validator found. Skipping test %s' % name | 1271 print 'WARNING: no validator found. Skipping test %s' % name |
1268 return [] | 1272 return [] |
(...skipping 2328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3597 'linux' : MakeLinuxEnv, | 3601 'linux' : MakeLinuxEnv, |
3598 'linux2': MakeLinuxEnv, | 3602 'linux2': MakeLinuxEnv, |
3599 'darwin': MakeMacEnv, | 3603 'darwin': MakeMacEnv, |
3600 } | 3604 } |
3601 if sys.platform not in platform_func_map: | 3605 if sys.platform not in platform_func_map: |
3602 raise UserError('Unrecognized host platform: %s', sys.platform) | 3606 raise UserError('Unrecognized host platform: %s', sys.platform) |
3603 make_env_func = platform_func_map[sys.platform] | 3607 make_env_func = platform_func_map[sys.platform] |
3604 | 3608 |
3605 build_env = make_env_func(build_platform) | 3609 build_env = make_env_func(build_platform) |
3606 build_env['IS_BUILD_ENV'] = True | 3610 build_env['IS_BUILD_ENV'] = True |
3607 build_env['BUILD_SCONSCRIPTS'] = [] | 3611 build_env['BUILD_SCONSCRIPTS'] = [ |
3612 # KEEP THIS SORTED PLEASE | |
Roland McGrath
2014/01/24 18:50:49
This should have a comment saying that it's tls_ed
| |
3613 'src/shared/gio/build.scons', | |
3614 'src/shared/platform/build.scons', | |
3615 'src/trusted/validator_ragel/build.scons', | |
3616 ] | |
3608 | 3617 |
3609 # The build environment is only used for intermediate steps and should | 3618 # The build environment is only used for intermediate steps and should |
3610 # not be creating any targets. Aliases are used as means to add targets | 3619 # not be creating any targets. Aliases are used as means to add targets |
3611 # to builds (IE, all_programs, all_libraries...etc.). Since we want to | 3620 # to builds (IE, all_programs, all_libraries...etc.). Since we want to |
3612 # share all of our build scripts but not define any aliases, we should | 3621 # share all of our build scripts but not define any aliases, we should |
3613 # override the alias function and essentially stub it out. | 3622 # override the alias function and essentially stub it out. |
3614 build_env.Alias = lambda env, target, source=[], actions=None, **kw : [] | 3623 build_env.Alias = lambda env, target, source=[], actions=None, **kw : [] |
3615 | 3624 |
3616 dbg_build_env, opt_build_env = GenerateOptimizationLevels(build_env) | 3625 return build_env |
3617 | 3626 |
3618 return opt_build_env | 3627 def LinkBuildEnv(selected_envs): |
3628 build_env_map = { | |
3629 'opt': opt_build_env, | |
3630 'dbg': dbg_build_env, | |
3631 } | |
3619 | 3632 |
3620 def LinkBuildEnv(selected_envs, build_env): | 3633 # We need to find the optimization level in order to know which |
3634 # build environment we want to use | |
3635 opt_level = None | |
3636 for env in selected_envs: | |
3637 if 'OPTIMIZATION_LEVEL' in env: | |
3638 if env['OPTIMIZATION_LEVEL']: | |
3639 opt_level = env['OPTIMIZATION_LEVEL'] | |
3640 break | |
3641 | |
3642 build_env = build_env_map.get(opt_level, opt_build_env) | |
3621 for env in selected_envs: | 3643 for env in selected_envs: |
3622 env['BUILD_ENV'] = build_env | 3644 env['BUILD_ENV'] = build_env |
3623 | 3645 |
3624 # If platform is not the same as the host environment, add the targets | 3646 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
| |
3625 # of the host environment so scons can find them | 3647 GetBuildPlatform() != GetTargetPlatform(): |
3626 if GetBuildPlatform() != GetTargetPlatform(): | |
3627 selected_envs.append(build_env) | 3648 selected_envs.append(build_env) |
3628 | 3649 |
3629 def DumpEnvironmentInfo(selected_envs): | 3650 def DumpEnvironmentInfo(selected_envs): |
3630 if VerboseConfigInfo(pre_base_env): | 3651 if VerboseConfigInfo(pre_base_env): |
3631 Banner("The following environments have been configured") | 3652 Banner("The following environments have been configured") |
3632 for env in selected_envs: | 3653 for env in selected_envs: |
3633 for tag in RELEVANT_CONFIG: | 3654 for tag in RELEVANT_CONFIG: |
3634 assert tag in env, repr(tag) | 3655 assert tag in env, repr(tag) |
3635 print "%s: %s" % (tag, env.subst(env.get(tag))) | 3656 print "%s: %s" % (tag, env.subst(env.get(tag))) |
3636 for tag in MAYBE_RELEVANT_CONFIG: | 3657 for tag in MAYBE_RELEVANT_CONFIG: |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3682 # a separate mode due to the vagaries of scons when we'd really rather it | 3703 # a separate mode due to the vagaries of scons when we'd really rather it |
3683 # not be, while not requiring that every bot command line using --mode be | 3704 # not be, while not requiring that every bot command line using --mode be |
3684 # changed to list '...,nacl,nacl_irt' explicitly. | 3705 # changed to list '...,nacl,nacl_irt' explicitly. |
3685 if nacl_env in selected_envs: | 3706 if nacl_env in selected_envs: |
3686 selected_envs.append(nacl_irt_env) | 3707 selected_envs.append(nacl_irt_env) |
3687 | 3708 |
3688 # The nacl_irt_test_env requires nacl_env to build things correctly. | 3709 # The nacl_irt_test_env requires nacl_env to build things correctly. |
3689 if nacl_irt_test_env in selected_envs and nacl_env not in selected_envs: | 3710 if nacl_irt_test_env in selected_envs and nacl_env not in selected_envs: |
3690 selected_envs.append(nacl_env) | 3711 selected_envs.append(nacl_env) |
3691 | 3712 |
3692 | |
3693 DumpEnvironmentInfo(selected_envs) | 3713 DumpEnvironmentInfo(selected_envs) |
3694 LinkTrustedEnv(selected_envs) | 3714 LinkTrustedEnv(selected_envs) |
3695 LinkBuildEnv(selected_envs, MakeBuildEnv()) | 3715 |
3716 # When building nacl, any intermediate build tool that is used during the | |
3717 # 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/
| |
3718 # target. Create a build environment for this purpose and link it into | |
3719 # the selected environments | |
3720 dbg_build_env, opt_build_env = GenerateOptimizationLevels(MakeBuildEnv()) | |
3721 LinkBuildEnv(selected_envs) | |
3722 | |
3696 # This must happen after LinkTrustedEnv, since that is where TRUSTED_ENV | 3723 # This must happen after LinkTrustedEnv, since that is where TRUSTED_ENV |
3697 # is finally set, and env.UsingEmulator() checks TRUSTED_ENV for the emulator. | 3724 # is finally set, and env.UsingEmulator() checks TRUSTED_ENV for the emulator. |
3698 # This must also happen before BuildEnvironments. | 3725 # This must also happen before BuildEnvironments. |
3699 PnaclSetEmulatorForSandboxedTranslator(selected_envs) | 3726 PnaclSetEmulatorForSandboxedTranslator(selected_envs) |
3700 | 3727 |
3701 BuildEnvironments(selected_envs) | 3728 BuildEnvironments(selected_envs) |
3702 | 3729 |
3703 # Change default to build everything, but not run tests. | 3730 # Change default to build everything, but not run tests. |
3704 Default(['all_programs', 'all_bundles', 'all_test_programs', 'all_libraries']) | 3731 Default(['all_programs', 'all_bundles', 'all_test_programs', 'all_libraries']) |
3705 | 3732 |
3706 | 3733 |
3707 # Sanity check whether we are ready to build nacl modules | 3734 # Sanity check whether we are ready to build nacl modules |
3708 # NOTE: this uses stuff from: site_scons/site_tools/naclsdk.py | 3735 # NOTE: this uses stuff from: site_scons/site_tools/naclsdk.py |
3709 if nacl_env.Bit('naclsdk_validate') and (nacl_env in selected_envs or | 3736 if nacl_env.Bit('naclsdk_validate') and (nacl_env in selected_envs or |
3710 nacl_irt_env in selected_envs): | 3737 nacl_irt_env in selected_envs): |
3711 nacl_env.ValidateSdk() | 3738 nacl_env.ValidateSdk() |
3712 | 3739 |
3713 if BROKEN_TEST_COUNT > 0: | 3740 if BROKEN_TEST_COUNT > 0: |
3714 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 3741 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
3715 if GetOption('brief_comstr'): | 3742 if GetOption('brief_comstr'): |
3716 msg += " Add --verbose to the command line for more information." | 3743 msg += " Add --verbose to the command line for more information." |
3717 print msg | 3744 print msg |
3718 | 3745 |
3719 # separate warnings from actual build output | 3746 # separate warnings from actual build output |
3720 Banner('B U I L D - O U T P U T:') | 3747 Banner('B U I L D - O U T P U T:') |
OLD | NEW |