| OLD | NEW |
| 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 def AddBiasForPNaCl(env, temporarily_allow=True): | 347 def AddBiasForPNaCl(env, temporarily_allow=True): |
| 348 assert(env.Bit('bitcode')) | 348 assert(env.Bit('bitcode')) |
| 349 # re: the temporarily_allow flag -- that is for: | 349 # re: the temporarily_allow flag -- that is for: |
| 350 # BUG= http://code.google.com/p/nativeclient/issues/detail?id=1248 | 350 # BUG= http://code.google.com/p/nativeclient/issues/detail?id=1248 |
| 351 if env.Bit('pnacl_generate_pexe') and not temporarily_allow: | 351 if env.Bit('pnacl_generate_pexe') and not temporarily_allow: |
| 352 env.Replace(CC='NO-NATIVE-CC-INVOCATION-ALLOWED', | 352 env.Replace(CC='NO-NATIVE-CC-INVOCATION-ALLOWED', |
| 353 CXX='NO-NATIVE-CXX-INVOCATION-ALLOWED') | 353 CXX='NO-NATIVE-CXX-INVOCATION-ALLOWED') |
| 354 return | 354 return |
| 355 | 355 |
| 356 if env.Bit('target_arm'): | 356 if env.Bit('target_arm'): |
| 357 env.AppendUnique(CCFLAGS=['--pnacl-arm-bias'], | 357 bias_flag = '--pnacl-bias=arm' |
| 358 ASPPFLAGS=['--pnacl-arm-bias']) | |
| 359 elif env.Bit('target_x86_32'): | 358 elif env.Bit('target_x86_32'): |
| 360 env.AppendUnique(CCFLAGS=['--pnacl-i686-bias'], | 359 bias_flag = '--pnacl-bias=x86-32' |
| 361 ASPPFLAGS=['--pnacl-i686-bias']) | |
| 362 elif env.Bit('target_x86_64'): | 360 elif env.Bit('target_x86_64'): |
| 363 env.AppendUnique(CCFLAGS=['--pnacl-x86_64-bias'], | 361 bias_flag = '--pnacl-bias=x86-64' |
| 364 ASPPFLAGS=['--pnacl-x86_64-bias']) | |
| 365 elif env.Bit('target_mips32'): | 362 elif env.Bit('target_mips32'): |
| 366 env.AppendUnique(CCFLAGS=['--pnacl-mips-bias'], | 363 bias_flag = '--pnacl-bias=mips32' |
| 367 ASPPFLAGS=['--pnacl-mips-bias']) | |
| 368 else: | 364 else: |
| 369 raise Exception("Unknown architecture!") | 365 raise Exception("Unknown architecture!") |
| 370 | 366 |
| 367 if env.Bit('nonsfi_nacl'): |
| 368 bias_flag += '-nonsfi' |
| 369 |
| 370 env.AppendUnique(CCFLAGS=[bias_flag], |
| 371 ASPPFLAGS=[bias_flag]) |
| 372 |
| 371 | 373 |
| 372 def ValidateSdk(env): | 374 def ValidateSdk(env): |
| 373 checkables = ['${NACL_SDK_INCLUDE}/stdio.h'] | 375 checkables = ['${NACL_SDK_INCLUDE}/stdio.h'] |
| 374 for c in checkables: | 376 for c in checkables: |
| 375 if os.path.exists(env.subst(c)): | 377 if os.path.exists(env.subst(c)): |
| 376 continue | 378 continue |
| 377 # Windows build does not use cygwin and so can not see nacl subdirectory | 379 # Windows build does not use cygwin and so can not see nacl subdirectory |
| 378 # if it's cygwin's symlink - check for /include instead... | 380 # if it's cygwin's symlink - check for /include instead... |
| 379 if os.path.exists(re.sub(r'(nacl64|nacl)/include/([^/]*)$', | 381 if os.path.exists(re.sub(r'(nacl64|nacl)/include/([^/]*)$', |
| 380 r'include/\2', | 382 r'include/\2', |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 # translation. | 709 # translation. |
| 708 if not os.path.exists(version_file) or env.Bit('use_sandboxed_translator'): | 710 if not os.path.exists(version_file) or env.Bit('use_sandboxed_translator'): |
| 709 version_file = os.path.join(os.path.dirname(root), 'pnacl_translator', | 711 version_file = os.path.join(os.path.dirname(root), 'pnacl_translator', |
| 710 'FEATURE_VERSION') | 712 'FEATURE_VERSION') |
| 711 if os.path.exists(version_file): | 713 if os.path.exists(version_file): |
| 712 with open(version_file, 'r') as fh: | 714 with open(version_file, 'r') as fh: |
| 713 version = int(fh.read()) | 715 version = int(fh.read()) |
| 714 else: | 716 else: |
| 715 version = 0 | 717 version = 0 |
| 716 env.Replace(TOOLCHAIN_FEATURE_VERSION=version) | 718 env.Replace(TOOLCHAIN_FEATURE_VERSION=version) |
| OLD | NEW |