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