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