OLD | NEW |
1 #! -*- python -*- | 1 #! -*- python -*- |
2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2011 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 glob | 7 import glob |
8 import os | 8 import os |
9 import platform | 9 import platform |
10 import shutil | 10 import shutil |
(...skipping 3346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3357 | 3357 |
3358 | 3358 |
3359 # The IRT-building environment was cloned from nacl_env, but it should | 3359 # The IRT-building environment was cloned from nacl_env, but it should |
3360 # ignore the --nacl_glibc, nacl_pic=1 and bitcode=1 switches. | 3360 # ignore the --nacl_glibc, nacl_pic=1 and bitcode=1 switches. |
3361 # We have to reinstantiate the naclsdk.py magic after clearing those flags, | 3361 # We have to reinstantiate the naclsdk.py magic after clearing those flags, |
3362 # so it regenerates the tool paths right. | 3362 # so it regenerates the tool paths right. |
3363 # TODO(mcgrathr,bradnelson): could get cleaner if naclsdk.py got folded back in. | 3363 # TODO(mcgrathr,bradnelson): could get cleaner if naclsdk.py got folded back in. |
3364 nacl_irt_env.ClearBits('nacl_glibc') | 3364 nacl_irt_env.ClearBits('nacl_glibc') |
3365 nacl_irt_env.ClearBits('nacl_pic') | 3365 nacl_irt_env.ClearBits('nacl_pic') |
3366 # For ARM: Can only build arm IRT w/ bitcode=1. | 3366 # For ARM: Can only build arm IRT w/ bitcode=1. |
3367 # For x86-64: there are calling convention differences between pnacl and gcc. | 3367 if not nacl_irt_env.Bit('target_arm'): |
3368 # http://code.google.com/p/nativeclient/issues/detail?id=1902 | |
3369 # We can try building a pnacl-specific x86-64 IRT for now, but that means | |
3370 # that we aren't testing the same x86-64 IRT that comes with chrome. | |
3371 if not (nacl_irt_env.Bit('target_arm') | |
3372 or nacl_irt_env.Bit('target_x86_64')): | |
3373 nacl_irt_env.ClearBits('bitcode') | 3368 nacl_irt_env.ClearBits('bitcode') |
3374 nacl_irt_env.Tool('naclsdk') | 3369 nacl_irt_env.Tool('naclsdk') |
3375 # These are unfortunately clobbered by running Tool, which | 3370 # These are unfortunately clobbered by running Tool, which |
3376 # we needed to do to get the destination directory reset. | 3371 # we needed to do to get the destination directory reset. |
3377 # We want all the same values from nacl_env. | 3372 # We want all the same values from nacl_env. |
3378 nacl_irt_env.Replace(EXTRA_CFLAGS=nacl_env['EXTRA_CFLAGS'], | 3373 nacl_irt_env.Replace(EXTRA_CFLAGS=nacl_env['EXTRA_CFLAGS'], |
3379 EXTRA_CXXFLAGS=nacl_env['EXTRA_CXXFLAGS'], | 3374 EXTRA_CXXFLAGS=nacl_env['EXTRA_CXXFLAGS'], |
3380 CCFLAGS=nacl_env['CCFLAGS'], | 3375 CCFLAGS=nacl_env['CCFLAGS'], |
3381 CFLAGS=nacl_env['CFLAGS'], | 3376 CFLAGS=nacl_env['CFLAGS'], |
3382 CXXFLAGS=nacl_env['CXXFLAGS']) | 3377 CXXFLAGS=nacl_env['CXXFLAGS']) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3456 lib_nodes = env.Replicate('${LIB_DIR}', nodes) | 3451 lib_nodes = env.Replicate('${LIB_DIR}', nodes) |
3457 PublishLibrary(env, lib_nodes) | 3452 PublishLibrary(env, lib_nodes) |
3458 return lib_nodes | 3453 return lib_nodes |
3459 nacl_env.AddMethod(NaClAddObject, 'AddObjectToSdk') | 3454 nacl_env.AddMethod(NaClAddObject, 'AddObjectToSdk') |
3460 | 3455 |
3461 # We want to do this for nacl_env when not under --nacl_glibc, | 3456 # We want to do this for nacl_env when not under --nacl_glibc, |
3462 # but for nacl_irt_env whether or not under --nacl_glibc, so | 3457 # but for nacl_irt_env whether or not under --nacl_glibc, so |
3463 # we do it separately for each after making nacl_irt_env and | 3458 # we do it separately for each after making nacl_irt_env and |
3464 # clearing its Bit('nacl_glibc'). | 3459 # clearing its Bit('nacl_glibc'). |
3465 def AddImplicitLibs(env): | 3460 def AddImplicitLibs(env): |
| 3461 implicit_libs = [] |
| 3462 |
| 3463 # Require the pnacl_irt_shim for pnacl x86-64. |
| 3464 # Use -B to have the compiler look for the fresh libpnacl_irt_shim.a. |
| 3465 if env.Bit('bitcode') and env.Bit('target_x86_64'): |
| 3466 implicit_libs += ['libpnacl_irt_shim.a'] |
| 3467 |
3466 if not env.Bit('nacl_glibc'): | 3468 if not env.Bit('nacl_glibc'): |
3467 # These are automatically linked in by the compiler, either directly | 3469 # These are automatically linked in by the compiler, either directly |
3468 # or via the linker script that is -lc. In the non-glibc build, we | 3470 # or via the linker script that is -lc. In the non-glibc build, we |
3469 # are the ones providing these files, so we need dependencies. | 3471 # are the ones providing these files, so we need dependencies. |
3470 # The ComponentProgram method (site_scons/site_tools/component_builders.py) | 3472 # The ComponentProgram method (site_scons/site_tools/component_builders.py) |
3471 # adds dependencies on env['IMPLICIT_LIBS'] if that's set. | 3473 # adds dependencies on env['IMPLICIT_LIBS'] if that's set. |
3472 if env.Bit('bitcode'): | 3474 if env.Bit('bitcode'): |
3473 implicit_libs = ['libnacl.a'] | 3475 implicit_libs += ['libnacl.a'] |
3474 else: | 3476 else: |
3475 implicit_libs = ['crt1.o', | 3477 implicit_libs += ['crt1.o', |
3476 'libnacl.a', | 3478 'libnacl.a', |
3477 'crti.o', | 3479 'crti.o', |
3478 'crtn.o'] | 3480 'crtn.o'] |
3479 # TODO(mcgrathr): multilib nonsense defeats -B! figure out a better way. | 3481 # TODO(mcgrathr): multilib nonsense defeats -B! figure out a better way. |
3480 if GetPlatform('targetplatform') == 'x86-32': | 3482 if GetPlatform('targetplatform') == 'x86-32': |
3481 implicit_libs.append(os.path.join('32', 'crt1.o')) | 3483 implicit_libs.append(os.path.join('32', 'crt1.o')) |
| 3484 |
| 3485 if implicit_libs != []: |
3482 env['IMPLICIT_LIBS'] = [env.File(os.path.join('${LIB_DIR}', file)) | 3486 env['IMPLICIT_LIBS'] = [env.File(os.path.join('${LIB_DIR}', file)) |
3483 for file in implicit_libs] | 3487 for file in implicit_libs] |
3484 # The -B<dir>/ flag is necessary to tell gcc to look for crt[1in].o there. | 3488 # The -B<dir>/ flag is necessary to tell gcc to look for crt[1in].o there. |
3485 env.Prepend(LINKFLAGS=['-B${LIB_DIR}/']) | 3489 env.Prepend(LINKFLAGS=['-B${LIB_DIR}/']) |
3486 | 3490 |
3487 AddImplicitLibs(nacl_env) | 3491 AddImplicitLibs(nacl_env) |
3488 AddImplicitLibs(nacl_irt_env) | 3492 AddImplicitLibs(nacl_irt_env) |
3489 | 3493 |
3490 nacl_irt_env.Append( | 3494 nacl_irt_env.Append( |
3491 BUILD_SCONSCRIPTS = [ | 3495 BUILD_SCONSCRIPTS = [ |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3760 nacl_env.ValidateSdk() | 3764 nacl_env.ValidateSdk() |
3761 | 3765 |
3762 if BROKEN_TEST_COUNT > 0: | 3766 if BROKEN_TEST_COUNT > 0: |
3763 msg = "There are %d broken tests." % BROKEN_TEST_COUNT | 3767 msg = "There are %d broken tests." % BROKEN_TEST_COUNT |
3764 if GetOption('brief_comstr'): | 3768 if GetOption('brief_comstr'): |
3765 msg += " Add --verbose to the command line for more information." | 3769 msg += " Add --verbose to the command line for more information." |
3766 print msg | 3770 print msg |
3767 | 3771 |
3768 # separate warnings from actual build output | 3772 # separate warnings from actual build output |
3769 Banner('B U I L D - O U T P U T:') | 3773 Banner('B U I L D - O U T P U T:') |
OLD | NEW |