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

Side by Side Diff: site_scons/site_tools/naclsdk.py

Issue 758223003: Cleanup: Use Bit('build_ARCH') instead of Bit('target_ARCH') (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Fix + simplify Created 6 years 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 | « site_scons/site_tools/library_deps.py ('k') | src/nonsfi/linux/nacl.scons » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/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 """NaCl SDK tool SCons.""" 6 """NaCl SDK tool SCons."""
7 7
8 import __builtin__ 8 import __builtin__
9 import re 9 import re
10 import os 10 import os
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 ASPP=arch_flag + cc_flags, 330 ASPP=arch_flag + cc_flags,
331 LINK=cc_flags) # Already has -arch 331 LINK=cc_flags) # Already has -arch
332 env['LD'] = 'NO-NATIVE-LD-INVOCATION-ALLOWED' 332 env['LD'] = 'NO-NATIVE-LD-INVOCATION-ALLOWED'
333 env['SHLINK'] = '${LINK}' 333 env['SHLINK'] = '${LINK}'
334 if env.Bit('built_elsewhere'): 334 if env.Bit('built_elsewhere'):
335 _StubOutEnvToolsForBuiltElsewhere(env) 335 _StubOutEnvToolsForBuiltElsewhere(env)
336 336
337 # Get an environment for nacl-gcc when in PNaCl mode. 337 # Get an environment for nacl-gcc when in PNaCl mode.
338 def PNaClGetNNaClEnv(env): 338 def PNaClGetNNaClEnv(env):
339 assert(env.Bit('bitcode')) 339 assert(env.Bit('bitcode'))
340 assert(not env.Bit('target_mips32')) 340 assert(not env.Bit('build_mips32'))
341 341
342 # This is kind of a hack. We clone the environment, 342 # This is kind of a hack. We clone the environment,
343 # clear the bitcode bit, and then reload naclsdk.py 343 # clear the bitcode bit, and then reload naclsdk.py
344 native_env = env.Clone() 344 native_env = env.Clone()
345 native_env.ClearBits('bitcode') 345 native_env.ClearBits('bitcode')
346 if env.Bit('built_elsewhere'): 346 if env.Bit('built_elsewhere'):
347 _StubOutEnvToolsForBuiltElsewhere(env) 347 _StubOutEnvToolsForBuiltElsewhere(env)
348 else: 348 else:
349 native_env = native_env.Clone(tools=['naclsdk']) 349 native_env = native_env.Clone(tools=['naclsdk'])
350 if native_env.Bit('pnacl_generate_pexe'): 350 if native_env.Bit('pnacl_generate_pexe'):
(...skipping 14 matching lines...) Expand all
365 # For example: __i686__, __arm__, __mips__, __x86_64__ 365 # For example: __i686__, __arm__, __mips__, __x86_64__
366 def AddBiasForPNaCl(env, temporarily_allow=True): 366 def AddBiasForPNaCl(env, temporarily_allow=True):
367 assert(env.Bit('bitcode')) 367 assert(env.Bit('bitcode'))
368 # re: the temporarily_allow flag -- that is for: 368 # re: the temporarily_allow flag -- that is for:
369 # BUG= http://code.google.com/p/nativeclient/issues/detail?id=1248 369 # BUG= http://code.google.com/p/nativeclient/issues/detail?id=1248
370 if env.Bit('pnacl_generate_pexe') and not temporarily_allow: 370 if env.Bit('pnacl_generate_pexe') and not temporarily_allow:
371 env.Replace(CC='NO-NATIVE-CC-INVOCATION-ALLOWED', 371 env.Replace(CC='NO-NATIVE-CC-INVOCATION-ALLOWED',
372 CXX='NO-NATIVE-CXX-INVOCATION-ALLOWED') 372 CXX='NO-NATIVE-CXX-INVOCATION-ALLOWED')
373 return 373 return
374 374
375 if env.Bit('target_arm'): 375 if env.Bit('build_arm'):
376 bias_flag = '--pnacl-bias=arm' 376 bias_flag = '--pnacl-bias=arm'
377 elif env.Bit('target_x86_32'): 377 elif env.Bit('build_x86_32'):
378 bias_flag = '--pnacl-bias=x86-32' 378 bias_flag = '--pnacl-bias=x86-32'
379 elif env.Bit('target_x86_64'): 379 elif env.Bit('build_x86_64'):
380 bias_flag = '--pnacl-bias=x86-64' 380 bias_flag = '--pnacl-bias=x86-64'
381 elif env.Bit('target_mips32'): 381 elif env.Bit('build_mips32'):
382 bias_flag = '--pnacl-bias=mips32' 382 bias_flag = '--pnacl-bias=mips32'
383 else: 383 else:
384 raise Exception("Unknown architecture!") 384 raise Exception("Unknown architecture!")
385 385
386 if env.Bit('nonsfi_nacl'): 386 if env.Bit('nonsfi_nacl'):
387 bias_flag += '-nonsfi' 387 bias_flag += '-nonsfi'
388 388
389 env.AppendUnique(CCFLAGS=[bias_flag], 389 env.AppendUnique(CCFLAGS=[bias_flag],
390 ASPPFLAGS=[bias_flag]) 390 ASPPFLAGS=[bias_flag])
391 391
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 root = env.GetToolchainDir() 682 root = env.GetToolchainDir()
683 683
684 # if bitcode=1 use pnacl toolchain 684 # if bitcode=1 use pnacl toolchain
685 if env.Bit('bitcode'): 685 if env.Bit('bitcode'):
686 _SetEnvForPnacl(env, root) 686 _SetEnvForPnacl(env, root)
687 elif env.Bit('built_elsewhere'): 687 elif env.Bit('built_elsewhere'):
688 _StubOutEnvToolsForBuiltElsewhere(env) 688 _StubOutEnvToolsForBuiltElsewhere(env)
689 else: 689 else:
690 _SetEnvForNativeSdk(env, root) 690 _SetEnvForNativeSdk(env, root)
691 691
692 if (env.Bit('bitcode') or env.Bit('nacl_clang')) and env.Bit('target_x86'): 692 if (env.Bit('bitcode') or env.Bit('nacl_clang')) and env.Bit('build_x86'):
693 # Get GDB from the nacl-gcc toolchain even when using PNaCl. 693 # Get GDB from the nacl-gcc toolchain even when using PNaCl.
694 # TODO(mseaborn): We really want the nacl-gdb binary to be in a 694 # TODO(mseaborn): We really want the nacl-gdb binary to be in a
695 # separate tarball from the nacl-gcc toolchain, then this step 695 # separate tarball from the nacl-gcc toolchain, then this step
696 # will not be necessary. 696 # will not be necessary.
697 # See http://code.google.com/p/nativeclient/issues/detail?id=2773 697 # See http://code.google.com/p/nativeclient/issues/detail?id=2773
698 temp_env = env.Clone() 698 temp_env = env.Clone()
699 temp_env.ClearBits('bitcode', 'nacl_clang') 699 temp_env.ClearBits('bitcode', 'nacl_clang')
700 temp_root = temp_env.GetToolchainDir() 700 temp_root = temp_env.GetToolchainDir()
701 _SetEnvForNativeSdk(temp_env, temp_root) 701 _SetEnvForNativeSdk(temp_env, temp_root)
702 env.Replace(GDB=temp_env['GDB']) 702 env.Replace(GDB=temp_env['GDB'])
(...skipping 25 matching lines...) Expand all
728 # translation. 728 # translation.
729 if not os.path.exists(version_file) or env.Bit('use_sandboxed_translator'): 729 if not os.path.exists(version_file) or env.Bit('use_sandboxed_translator'):
730 version_file = os.path.join(os.path.dirname(root), 'pnacl_translator', 730 version_file = os.path.join(os.path.dirname(root), 'pnacl_translator',
731 'FEATURE_VERSION') 731 'FEATURE_VERSION')
732 if os.path.exists(version_file): 732 if os.path.exists(version_file):
733 with open(version_file, 'r') as fh: 733 with open(version_file, 'r') as fh:
734 version = int(fh.read()) 734 version = int(fh.read())
735 else: 735 else:
736 version = 0 736 version = 0
737 env.Replace(TOOLCHAIN_FEATURE_VERSION=version) 737 env.Replace(TOOLCHAIN_FEATURE_VERSION=version)
OLDNEW
« no previous file with comments | « site_scons/site_tools/library_deps.py ('k') | src/nonsfi/linux/nacl.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698