Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: SConstruct

Issue 140653005: Adds tls_edit utility which patches irt_core.nexe's TLS usage. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Fixed wrong variable usage in tls_edit Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | build/common.gypi » ('j') | build/common.gypi » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 2336 matching lines...) Expand 10 before | Expand all | Expand 10 after
3600 'linux' : MakeLinuxEnv, 3604 'linux' : MakeLinuxEnv,
3601 'linux2': MakeLinuxEnv, 3605 'linux2': MakeLinuxEnv,
3602 'darwin': MakeMacEnv, 3606 'darwin': MakeMacEnv,
3603 } 3607 }
3604 if sys.platform not in platform_func_map: 3608 if sys.platform not in platform_func_map:
3605 raise UserError('Unrecognized host platform: %s', sys.platform) 3609 raise UserError('Unrecognized host platform: %s', sys.platform)
3606 make_env_func = platform_func_map[sys.platform] 3610 make_env_func = platform_func_map[sys.platform]
3607 3611
3608 build_env = make_env_func(build_platform) 3612 build_env = make_env_func(build_platform)
3609 build_env['IS_BUILD_ENV'] = True 3613 build_env['IS_BUILD_ENV'] = True
3610 build_env['BUILD_SCONSCRIPTS'] = [] 3614
3615 # Building tls_edit depends on gio, platform, and validator_ragel.
3616 build_env['BUILD_SCONSCRIPTS'] = [
3617 # KEEP THIS SORTED PLEASE
3618 'src/shared/gio/build.scons',
3619 'src/shared/platform/build.scons',
3620 'src/trusted/validator_ragel/build.scons',
3621 ]
3611 3622
3612 # The build environment is only used for intermediate steps and should 3623 # The build environment is only used for intermediate steps and should
3613 # not be creating any targets. Aliases are used as means to add targets 3624 # not be creating any targets. Aliases are used as means to add targets
3614 # to builds (IE, all_programs, all_libraries...etc.). Since we want to 3625 # to builds (IE, all_programs, all_libraries...etc.). Since we want to
3615 # share all of our build scripts but not define any aliases, we should 3626 # share all of our build scripts but not define any aliases, we should
3616 # override the alias function and essentially stub it out. 3627 # override the alias function and essentially stub it out.
3617 build_env.Alias = lambda env, target, source=[], actions=None, **kw : [] 3628 build_env.Alias = lambda env, target, source=[], actions=None, **kw : []
3618 3629
3619 dbg_build_env, opt_build_env = GenerateOptimizationLevels(build_env) 3630 return build_env
3620 3631
3621 return opt_build_env 3632 def LinkBuildEnv(selected_envs):
3633 build_env_map = {
3634 'opt': opt_build_env,
3635 'dbg': dbg_build_env,
3636 }
3622 3637
3623 def LinkBuildEnv(selected_envs, build_env): 3638 # We need to find the optimization level in order to know which
3639 # build environment we want to use
3640 opt_level = None
3641 for env in selected_envs:
3642 if 'OPTIMIZATION_LEVEL' in env:
3643 if env['OPTIMIZATION_LEVEL']:
3644 opt_level = env['OPTIMIZATION_LEVEL']
3645 break
3646
3647 build_env = build_env_map.get(opt_level, opt_build_env)
3624 for env in selected_envs: 3648 for env in selected_envs:
3625 env['BUILD_ENV'] = build_env 3649 env['BUILD_ENV'] = build_env
3626 3650
3627 # If platform is not the same as the host environment, add the targets 3651 if (opt_level not in build_env_map or
3628 # of the host environment so scons can find them 3652 GetBuildPlatform() != GetTargetPlatform()):
3629 if GetBuildPlatform() != GetTargetPlatform():
3630 selected_envs.append(build_env) 3653 selected_envs.append(build_env)
3631 3654
3632 def DumpEnvironmentInfo(selected_envs): 3655 def DumpEnvironmentInfo(selected_envs):
3633 if VerboseConfigInfo(pre_base_env): 3656 if VerboseConfigInfo(pre_base_env):
3634 Banner("The following environments have been configured") 3657 Banner("The following environments have been configured")
3635 for env in selected_envs: 3658 for env in selected_envs:
3636 for tag in RELEVANT_CONFIG: 3659 for tag in RELEVANT_CONFIG:
3637 assert tag in env, repr(tag) 3660 assert tag in env, repr(tag)
3638 print "%s: %s" % (tag, env.subst(env.get(tag))) 3661 print "%s: %s" % (tag, env.subst(env.get(tag)))
3639 for tag in MAYBE_RELEVANT_CONFIG: 3662 for tag in MAYBE_RELEVANT_CONFIG:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
3685 # a separate mode due to the vagaries of scons when we'd really rather it 3708 # a separate mode due to the vagaries of scons when we'd really rather it
3686 # not be, while not requiring that every bot command line using --mode be 3709 # not be, while not requiring that every bot command line using --mode be
3687 # changed to list '...,nacl,nacl_irt' explicitly. 3710 # changed to list '...,nacl,nacl_irt' explicitly.
3688 if nacl_env in selected_envs: 3711 if nacl_env in selected_envs:
3689 selected_envs.append(nacl_irt_env) 3712 selected_envs.append(nacl_irt_env)
3690 3713
3691 # The nacl_irt_test_env requires nacl_env to build things correctly. 3714 # The nacl_irt_test_env requires nacl_env to build things correctly.
3692 if nacl_irt_test_env in selected_envs and nacl_env not in selected_envs: 3715 if nacl_irt_test_env in selected_envs and nacl_env not in selected_envs:
3693 selected_envs.append(nacl_env) 3716 selected_envs.append(nacl_env)
3694 3717
3695
3696 DumpEnvironmentInfo(selected_envs) 3718 DumpEnvironmentInfo(selected_envs)
3697 LinkTrustedEnv(selected_envs) 3719 LinkTrustedEnv(selected_envs)
3698 LinkBuildEnv(selected_envs, MakeBuildEnv()) 3720
3721 # When building nacl, any intermediate build tool that is used during the
3722 # build process must be built using the current build environment, not the
3723 # target. Create a build environment for this purpose and link it into
3724 # the selected environments
3725 dbg_build_env, opt_build_env = GenerateOptimizationLevels(MakeBuildEnv())
3726 LinkBuildEnv(selected_envs)
3727
3699 # This must happen after LinkTrustedEnv, since that is where TRUSTED_ENV 3728 # This must happen after LinkTrustedEnv, since that is where TRUSTED_ENV
3700 # is finally set, and env.UsingEmulator() checks TRUSTED_ENV for the emulator. 3729 # is finally set, and env.UsingEmulator() checks TRUSTED_ENV for the emulator.
3701 # This must also happen before BuildEnvironments. 3730 # This must also happen before BuildEnvironments.
3702 PnaclSetEmulatorForSandboxedTranslator(selected_envs) 3731 PnaclSetEmulatorForSandboxedTranslator(selected_envs)
3703 3732
3704 BuildEnvironments(selected_envs) 3733 BuildEnvironments(selected_envs)
3705 3734
3706 # Change default to build everything, but not run tests. 3735 # Change default to build everything, but not run tests.
3707 Default(['all_programs', 'all_bundles', 'all_test_programs', 'all_libraries']) 3736 Default(['all_programs', 'all_bundles', 'all_test_programs', 'all_libraries'])
3708 3737
3709 3738
3710 # Sanity check whether we are ready to build nacl modules 3739 # Sanity check whether we are ready to build nacl modules
3711 # NOTE: this uses stuff from: site_scons/site_tools/naclsdk.py 3740 # NOTE: this uses stuff from: site_scons/site_tools/naclsdk.py
3712 if nacl_env.Bit('naclsdk_validate') and (nacl_env in selected_envs or 3741 if nacl_env.Bit('naclsdk_validate') and (nacl_env in selected_envs or
3713 nacl_irt_env in selected_envs): 3742 nacl_irt_env in selected_envs):
3714 nacl_env.ValidateSdk() 3743 nacl_env.ValidateSdk()
3715 3744
3716 if BROKEN_TEST_COUNT > 0: 3745 if BROKEN_TEST_COUNT > 0:
3717 msg = "There are %d broken tests." % BROKEN_TEST_COUNT 3746 msg = "There are %d broken tests." % BROKEN_TEST_COUNT
3718 if GetOption('brief_comstr'): 3747 if GetOption('brief_comstr'):
3719 msg += " Add --verbose to the command line for more information." 3748 msg += " Add --verbose to the command line for more information."
3720 print msg 3749 print msg
3721 3750
3722 # separate warnings from actual build output 3751 # separate warnings from actual build output
3723 Banner('B U I L D - O U T P U T:') 3752 Banner('B U I L D - O U T P U T:')
OLDNEW
« no previous file with comments | « no previous file | build/common.gypi » ('j') | build/common.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698