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

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: Rebased to master 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') | no next file with comments »
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 ApplyTLSEdit(env, nexe_name, raw_nexe):
1255 tls_edit_exe = env['BUILD_ENV'].File('${STAGING_DIR}/tls_edit${PROGSUFFIX}')
1256 return env.Command(
1257 nexe_name,
1258 [tls_edit_exe, raw_nexe],
1259 '${SOURCES} ${TARGET}')
1260
1261 pre_base_env.AddMethod(ApplyTLSEdit)
1254 1262
1255 def CommandValidatorTestNacl(env, name, image, 1263 def CommandValidatorTestNacl(env, name, image,
1256 validator_flags=None, 1264 validator_flags=None,
1257 validator=None, 1265 validator=None,
1258 size='medium', 1266 size='medium',
1259 **extra): 1267 **extra):
1260 validator = env.GetValidator(validator) 1268 validator = env.GetValidator(validator)
1261 if validator is None: 1269 if validator is None:
1262 print 'WARNING: no validator found. Skipping test %s' % name 1270 print 'WARNING: no validator found. Skipping test %s' % name
1263 return [] 1271 return []
(...skipping 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after
3400 env.Prepend(LINKFLAGS=['-B${LIB_DIR}/']) 3408 env.Prepend(LINKFLAGS=['-B${LIB_DIR}/'])
3401 3409
3402 AddImplicitLibs(nacl_env) 3410 AddImplicitLibs(nacl_env)
3403 AddImplicitLibs(nacl_irt_env) 3411 AddImplicitLibs(nacl_irt_env)
3404 3412
3405 nacl_irt_env.Append( 3413 nacl_irt_env.Append(
3406 BUILD_SCONSCRIPTS = [ 3414 BUILD_SCONSCRIPTS = [
3407 'src/shared/gio/nacl.scons', 3415 'src/shared/gio/nacl.scons',
3408 'src/shared/platform/nacl.scons', 3416 'src/shared/platform/nacl.scons',
3409 'src/shared/srpc/nacl.scons', 3417 'src/shared/srpc/nacl.scons',
3418 'src/tools/tls_edit/build.scons',
3410 'src/untrusted/irt/nacl.scons', 3419 'src/untrusted/irt/nacl.scons',
3411 'src/untrusted/nacl/nacl.scons', 3420 'src/untrusted/nacl/nacl.scons',
3412 'src/untrusted/stubs/nacl.scons', 3421 'src/untrusted/stubs/nacl.scons',
3413 'tests/irt_private_pthread/nacl.scons', 3422 'tests/irt_private_pthread/nacl.scons',
3414 ]) 3423 ])
3415 nacl_irt_env.AddChromeFilesFromGroup('untrusted_irt_scons_files') 3424 nacl_irt_env.AddChromeFilesFromGroup('untrusted_irt_scons_files')
3416 3425
3417 environment_list.append(nacl_irt_env) 3426 environment_list.append(nacl_irt_env)
3418 3427
3419 # Since browser_tests already use the IRT normally, those are fully covered 3428 # Since browser_tests already use the IRT normally, those are fully covered
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
3602 'linux' : MakeLinuxEnv, 3611 'linux' : MakeLinuxEnv,
3603 'linux2': MakeLinuxEnv, 3612 'linux2': MakeLinuxEnv,
3604 'darwin': MakeMacEnv, 3613 'darwin': MakeMacEnv,
3605 } 3614 }
3606 if sys.platform not in platform_func_map: 3615 if sys.platform not in platform_func_map:
3607 raise UserError('Unrecognized host platform: %s', sys.platform) 3616 raise UserError('Unrecognized host platform: %s', sys.platform)
3608 make_env_func = platform_func_map[sys.platform] 3617 make_env_func = platform_func_map[sys.platform]
3609 3618
3610 build_env = make_env_func(build_platform) 3619 build_env = make_env_func(build_platform)
3611 build_env['IS_BUILD_ENV'] = True 3620 build_env['IS_BUILD_ENV'] = True
3612 build_env['BUILD_SCONSCRIPTS'] = [] 3621
3622 # Building tls_edit depends on gio, platform, and validator_ragel.
3623 build_env['BUILD_SCONSCRIPTS'] = [
3624 # KEEP THIS SORTED PLEASE
3625 'src/shared/gio/build.scons',
3626 'src/shared/platform/build.scons',
3627 'src/trusted/validator_ragel/build.scons',
3628 ]
3613 3629
3614 # The build environment is only used for intermediate steps and should 3630 # 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 3631 # 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 3632 # 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 3633 # share all of our build scripts but not define any aliases, we should
3618 # override the alias function and essentially stub it out. 3634 # override the alias function and essentially stub it out.
3619 build_env.Alias = lambda env, target, source=[], actions=None, **kw : [] 3635 build_env.Alias = lambda env, target, source=[], actions=None, **kw : []
3620 3636
3621 dbg_build_env, opt_build_env = GenerateOptimizationLevels(build_env) 3637 return build_env
3622 3638
3623 return opt_build_env 3639 def LinkBuildEnv(selected_envs):
3640 build_env_map = {
3641 'opt': opt_build_env,
3642 'dbg': dbg_build_env,
3643 }
3624 3644
3625 def LinkBuildEnv(selected_envs, build_env): 3645 # We need to find the optimization level in order to know which
3646 # build environment we want to use
3647 opt_level = None
3648 for env in selected_envs:
3649 if 'OPTIMIZATION_LEVEL' in env:
3650 if env['OPTIMIZATION_LEVEL']:
3651 opt_level = env['OPTIMIZATION_LEVEL']
3652 break
3653
3654 build_env = build_env_map.get(opt_level, opt_build_env)
3626 for env in selected_envs: 3655 for env in selected_envs:
3627 env['BUILD_ENV'] = build_env 3656 env['BUILD_ENV'] = build_env
3628 3657
3629 # If platform is not the same as the host environment, add the targets 3658 if (opt_level not in build_env_map or
3630 # of the host environment so scons can find them 3659 GetBuildPlatform() != GetTargetPlatform()):
3631 if GetBuildPlatform() != GetTargetPlatform():
3632 selected_envs.append(build_env) 3660 selected_envs.append(build_env)
3633 3661
3634 def DumpEnvironmentInfo(selected_envs): 3662 def DumpEnvironmentInfo(selected_envs):
3635 if VerboseConfigInfo(pre_base_env): 3663 if VerboseConfigInfo(pre_base_env):
3636 Banner("The following environments have been configured") 3664 Banner("The following environments have been configured")
3637 for env in selected_envs: 3665 for env in selected_envs:
3638 for tag in RELEVANT_CONFIG: 3666 for tag in RELEVANT_CONFIG:
3639 assert tag in env, repr(tag) 3667 assert tag in env, repr(tag)
3640 print "%s: %s" % (tag, env.subst(env.get(tag))) 3668 print "%s: %s" % (tag, env.subst(env.get(tag)))
3641 for tag in MAYBE_RELEVANT_CONFIG: 3669 for tag in MAYBE_RELEVANT_CONFIG:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
3676 # print sytem info (optionally) 3704 # print sytem info (optionally)
3677 if VerboseConfigInfo(pre_base_env): 3705 if VerboseConfigInfo(pre_base_env):
3678 Banner('SCONS ARGS:' + str(sys.argv)) 3706 Banner('SCONS ARGS:' + str(sys.argv))
3679 os.system(pre_base_env.subst('${PYTHON} tools/sysinfo.py')) 3707 os.system(pre_base_env.subst('${PYTHON} tools/sysinfo.py'))
3680 3708
3681 CheckArguments() 3709 CheckArguments()
3682 3710
3683 SanityCheckEnvironments(environment_list) 3711 SanityCheckEnvironments(environment_list)
3684 selected_envs = FilterEnvironments(environment_list) 3712 selected_envs = FilterEnvironments(environment_list)
3685 3713
3686 # If we are building nacl, build nacl_irt too. This works around it being 3714 # If we are building NaCl, build nacl_irt too. This works around it being
3687 # a separate mode due to the vagaries of scons when we'd really rather it 3715 # 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 3716 # not be, while not requiring that every bot command line using --mode be
3689 # changed to list '...,nacl,nacl_irt' explicitly. 3717 # changed to list '...,nacl,nacl_irt' explicitly.
3690 if nacl_env in selected_envs: 3718 if nacl_env in selected_envs:
3691 selected_envs.append(nacl_irt_env) 3719 selected_envs.append(nacl_irt_env)
3692 3720
3693 # The nacl_irt_test_env requires nacl_env to build things correctly. 3721 # 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: 3722 if nacl_irt_test_env in selected_envs and nacl_env not in selected_envs:
3695 selected_envs.append(nacl_env) 3723 selected_envs.append(nacl_env)
3696 3724
3697
3698 DumpEnvironmentInfo(selected_envs) 3725 DumpEnvironmentInfo(selected_envs)
3699 LinkTrustedEnv(selected_envs) 3726 LinkTrustedEnv(selected_envs)
3700 LinkBuildEnv(selected_envs, MakeBuildEnv()) 3727
3728 # When building NaCl, any intermediate build tool that is used during the
3729 # build process must be built using the current build environment, not the
3730 # target. Create a build environment for this purpose and link it into
3731 # the selected environments
3732 dbg_build_env, opt_build_env = GenerateOptimizationLevels(MakeBuildEnv())
3733 LinkBuildEnv(selected_envs)
3734
3701 # This must happen after LinkTrustedEnv, since that is where TRUSTED_ENV 3735 # This must happen after LinkTrustedEnv, since that is where TRUSTED_ENV
3702 # is finally set, and env.UsingEmulator() checks TRUSTED_ENV for the emulator. 3736 # is finally set, and env.UsingEmulator() checks TRUSTED_ENV for the emulator.
3703 # This must also happen before BuildEnvironments. 3737 # This must also happen before BuildEnvironments.
3704 PnaclSetEmulatorForSandboxedTranslator(selected_envs) 3738 PnaclSetEmulatorForSandboxedTranslator(selected_envs)
3705 3739
3706 BuildEnvironments(selected_envs) 3740 BuildEnvironments(selected_envs)
3707 3741
3708 # Change default to build everything, but not run tests. 3742 # Change default to build everything, but not run tests.
3709 Default(['all_programs', 'all_bundles', 'all_test_programs', 'all_libraries']) 3743 Default(['all_programs', 'all_bundles', 'all_test_programs', 'all_libraries'])
3710 3744
3711 3745
3712 # Sanity check whether we are ready to build nacl modules 3746 # Sanity check whether we are ready to build nacl modules
3713 # NOTE: this uses stuff from: site_scons/site_tools/naclsdk.py 3747 # 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 3748 if nacl_env.Bit('naclsdk_validate') and (nacl_env in selected_envs or
3715 nacl_irt_env in selected_envs): 3749 nacl_irt_env in selected_envs):
3716 nacl_env.ValidateSdk() 3750 nacl_env.ValidateSdk()
3717 3751
3718 if BROKEN_TEST_COUNT > 0: 3752 if BROKEN_TEST_COUNT > 0:
3719 msg = "There are %d broken tests." % BROKEN_TEST_COUNT 3753 msg = "There are %d broken tests." % BROKEN_TEST_COUNT
3720 if GetOption('brief_comstr'): 3754 if GetOption('brief_comstr'):
3721 msg += " Add --verbose to the command line for more information." 3755 msg += " Add --verbose to the command line for more information."
3722 print msg 3756 print msg
3723 3757
3724 # separate warnings from actual build output 3758 # separate warnings from actual build output
3725 Banner('B U I L D - O U T P U T:') 3759 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698