Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2013 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2013 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 """Recipes for PNaCl toolchain packages. | 6 """Recipes for PNaCl toolchain packages. |
| 7 | 7 |
| 8 Recipes consist of specially-structured dictionaries, with keys for package | 8 Recipes consist of specially-structured dictionaries, with keys for package |
| 9 name, type, commands to execute, etc. The structure is documented in the | 9 name, type, commands to execute, etc. The structure is documented in the |
| 10 PackageBuilder docstring in toolchain_main.py. | 10 PackageBuilder docstring in toolchain_main.py. |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 'i686-w64-mingw32': ('i686-w64-mingw32-gcc', 'i686-w64-mingw32-g++'), | 121 'i686-w64-mingw32': ('i686-w64-mingw32-gcc', 'i686-w64-mingw32-g++'), |
| 122 # TODO: add arm-hosted support | 122 # TODO: add arm-hosted support |
| 123 'i686-pc-cygwin': ('gcc', 'g++'), | 123 'i686-pc-cygwin': ('gcc', 'g++'), |
| 124 } | 124 } |
| 125 return compiler[host] | 125 return compiler[host] |
| 126 | 126 |
| 127 def GSDJoin(*args): | 127 def GSDJoin(*args): |
| 128 return '_'.join([pynacl.gsd_storage.LegalizeName(arg) for arg in args]) | 128 return '_'.join([pynacl.gsd_storage.LegalizeName(arg) for arg in args]) |
| 129 | 129 |
| 130 # Return the host of the default toolchain to build target libraries with. | 130 # Return the host of the default toolchain to build target libraries with. |
| 131 def DefaultHostForTargetLibs(): | 131 def DefaultHostForTargetLibs(): |
|
jvoung (off chromium)
2014/09/18 16:17:33
This can be removed now, that it's no longer used.
Derek Schuff
2014/09/18 17:03:13
Done.
| |
| 132 tools = { 'win': 'i686-w64-mingw32', | 132 tools = { 'win': 'i686-w64-mingw32', |
| 133 'mac': 'x86_64-apple-darwin', | 133 'mac': 'x86_64-apple-darwin', |
| 134 'linux': 'i686-linux' } | 134 'linux': 'x86_64-linux' } |
| 135 return tools[pynacl.platform.GetOS()] | 135 return tools[pynacl.platform.GetOS()] |
| 136 | 136 |
| 137 | 137 |
| 138 def ConfigureHostArchFlags(host, extra_cflags=[]): | 138 def ConfigureHostArchFlags(host, extra_cflags=[]): |
| 139 """ Return flags passed to LLVM and binutils configure for compilers and | 139 """ Return flags passed to LLVM and binutils configure for compilers and |
| 140 compile flags. """ | 140 compile flags. """ |
| 141 configure_args = [] | 141 configure_args = [] |
| 142 extra_cc_args = [] | 142 extra_cc_args = [] |
| 143 | 143 |
| 144 native = pynacl.platform.PlatformTriple() | 144 native = pynacl.platform.PlatformTriple() |
| 145 is_cross = host != native | 145 is_cross = host != native |
| 146 if is_cross: | 146 if is_cross: |
| 147 if (pynacl.platform.IsLinux64() and | 147 if (pynacl.platform.IsLinux64() and |
| 148 fnmatch.fnmatch(host, '*-linux*')): | 148 fnmatch.fnmatch(host, '*-linux*')): |
| 149 # 64 bit linux can build 32 bit linux binaries while still being a native | 149 # 64 bit linux can build 32 bit linux binaries while still being a native |
| 150 # build for our purposes. But it's not what config.guess will yield, so | 150 # build for our purposes. But it's not what config.guess will yield, so |
| 151 # use --build to force it and make sure things build correctly. | 151 # use --build to force it and make sure things build correctly. |
| 152 configure_args.append('--build=' + host) | 152 configure_args.append('--build=' + host) |
| 153 else: | 153 else: |
| 154 configure_args.append('--host=' + host) | 154 configure_args.append('--host=' + host) |
| 155 if TripleIsLinux(host) and not TripleIsX8664(host): | 155 if TripleIsLinux(host) and not TripleIsX8664(host): |
| 156 # Chrome clang defaults to 64-bit builds, even when run on 32-bit Linux | 156 # Chrome clang defaults to 64-bit builds, even when run on 32-bit Linux. |
| 157 extra_cc_args = ['-m32'] | 157 extra_cc_args = ['-m32'] |
| 158 | 158 |
| 159 extra_cxx_args = list(extra_cc_args) | 159 extra_cxx_args = list(extra_cc_args) |
| 160 | 160 |
| 161 cc, cxx = CompilersForHost(host) | 161 cc, cxx = CompilersForHost(host) |
| 162 | 162 |
| 163 configure_args.append('CC=' + ' '.join([cc] + extra_cc_args)) | 163 configure_args.append('CC=' + ' '.join([cc] + extra_cc_args)) |
| 164 configure_args.append('CXX=' + ' '.join([cxx] + extra_cxx_args)) | 164 configure_args.append('CXX=' + ' '.join([cxx] + extra_cxx_args)) |
| 165 | 165 |
| 166 if TripleIsWindows(host): | 166 if TripleIsWindows(host): |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 'commands': GetGitSyncCmds('llvm'), | 329 'commands': GetGitSyncCmds('llvm'), |
| 330 }, | 330 }, |
| 331 'subzero_src': { | 331 'subzero_src': { |
| 332 'type': 'source', | 332 'type': 'source', |
| 333 'output_dirname': 'subzero', | 333 'output_dirname': 'subzero', |
| 334 'commands': GetGitSyncCmds('subzero'), | 334 'commands': GetGitSyncCmds('subzero'), |
| 335 }, | 335 }, |
| 336 } | 336 } |
| 337 return sources | 337 return sources |
| 338 | 338 |
| 339 def HostSubdir(host): | |
| 340 return 'host_x86_64' if TripleIsX8664(host) else 'host_x86_32' | |
| 341 | |
| 342 def TestsuiteSources(GetGitSyncCmds): | 339 def TestsuiteSources(GetGitSyncCmds): |
| 343 sources = { | 340 sources = { |
| 344 'llvm_testsuite_src': { | 341 'llvm_testsuite_src': { |
| 345 'type': 'source', | 342 'type': 'source', |
| 346 'output_dirname': 'llvm-test-suite', | 343 'output_dirname': 'llvm-test-suite', |
| 347 'commands': GetGitSyncCmds('llvm-test-suite'), | 344 'commands': GetGitSyncCmds('llvm-test-suite'), |
| 348 }, | 345 }, |
| 349 } | 346 } |
| 350 return sources | 347 return sources |
| 351 | 348 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 command.Copy(os.path.join('src', 'dlfcn.h'), | 388 command.Copy(os.path.join('src', 'dlfcn.h'), |
| 392 os.path.join('%(output)s', 'dlfcn.h')), | 389 os.path.join('%(output)s', 'dlfcn.h')), |
| 393 ], | 390 ], |
| 394 }, | 391 }, |
| 395 }) | 392 }) |
| 396 else: | 393 else: |
| 397 libs.update({ | 394 libs.update({ |
| 398 H('libcxx'): { | 395 H('libcxx'): { |
| 399 'dependencies': ['libcxx_src', 'libcxxabi_src'], | 396 'dependencies': ['libcxx_src', 'libcxxabi_src'], |
| 400 'type': 'build', | 397 'type': 'build', |
| 401 'output_subdir': HostSubdir(host), | |
| 402 'commands': [ | 398 'commands': [ |
| 403 command.SkipForIncrementalCommand([ | 399 command.SkipForIncrementalCommand([ |
| 404 'cmake', '-G', 'Unix Makefiles'] + | 400 'cmake', '-G', 'Unix Makefiles'] + |
| 405 LibCxxHostArchFlags(host) + | 401 LibCxxHostArchFlags(host) + |
| 406 ['-DLIBCXX_CXX_ABI=libcxxabi', | 402 ['-DLIBCXX_CXX_ABI=libcxxabi', |
| 407 '-DLIBCXX_LIBCXXABI_INCLUDE_PATHS=' + command.path.join( | 403 '-DLIBCXX_LIBCXXABI_INCLUDE_PATHS=' + command.path.join( |
| 408 '%(abs_libcxxabi_src)s', 'include'), | 404 '%(abs_libcxxabi_src)s', 'include'), |
| 409 '-DLIBCXX_ENABLE_SHARED=ON', | 405 '-DLIBCXX_ENABLE_SHARED=ON', |
| 410 '-DCMAKE_INSTALL_PREFIX=', | 406 '-DCMAKE_INSTALL_PREFIX=', |
| 411 '-DCMAKE_INSTALL_NAME_DIR=@executable_path/../lib', | 407 '-DCMAKE_INSTALL_NAME_DIR=@executable_path/../lib', |
| 412 '%(libcxx_src)s']), | 408 '%(libcxx_src)s']), |
| 413 command.Command(MakeCommand(host) + ['VERBOSE=1']), | 409 command.Command(MakeCommand(host) + ['VERBOSE=1']), |
| 414 command.Command(MAKE_DESTDIR_CMD + ['VERBOSE=1', 'install']), | 410 command.Command(MAKE_DESTDIR_CMD + ['VERBOSE=1', 'install']), |
| 415 ], | 411 ], |
| 416 }, | 412 }, |
| 417 }) | 413 }) |
| 418 return libs | 414 return libs |
| 419 | 415 |
| 420 | 416 |
| 421 def HostSubdir(host): | |
| 422 return 'host_x86_64' if TripleIsX8664(host) else 'host_x86_32' | |
| 423 | |
| 424 def HostTools(host, options): | 417 def HostTools(host, options): |
| 425 def H(component_name): | 418 def H(component_name): |
| 426 # Return a package name for a component name with a host triple. | 419 # Return a package name for a component name with a host triple. |
| 427 return GSDJoin(component_name, host) | 420 return GSDJoin(component_name, host) |
| 428 def BinSubdir(host): | |
| 429 return 'bin64' if host == 'x86_64-linux' else 'bin' | |
| 430 # Return the file name with the appropriate suffix for an executable file. | 421 # Return the file name with the appropriate suffix for an executable file. |
| 431 def Exe(file): | 422 def Exe(file): |
| 432 if TripleIsWindows(host): | 423 if TripleIsWindows(host): |
| 433 return file + '.exe' | 424 return file + '.exe' |
| 434 else: | 425 else: |
| 435 return file | 426 return file |
| 436 # Binutils still has some warnings when building with clang | 427 # Binutils still has some warnings when building with clang |
| 437 warning_flags = ['-Wno-extended-offsetof', '-Wno-absolute-value', | 428 warning_flags = ['-Wno-extended-offsetof', '-Wno-absolute-value', |
| 438 '-Wno-unused-function', '-Wno-unused-const-variable', | 429 '-Wno-unused-function', '-Wno-unused-const-variable', |
| 439 '-Wno-unneeded-internal-declaration', | 430 '-Wno-unneeded-internal-declaration', |
| 440 '-Wno-unused-private-field', '-Wno-format-security'] | 431 '-Wno-unused-private-field', '-Wno-format-security'] |
| 441 tools = { | 432 tools = { |
| 442 H('binutils_pnacl'): { | 433 H('binutils_pnacl'): { |
| 443 'dependencies': ['binutils_pnacl_src'], | 434 'dependencies': ['binutils_pnacl_src'], |
| 444 'type': 'build', | 435 'type': 'build', |
| 445 'output_subdir': HostSubdir(host), | |
| 446 'commands': [ | 436 'commands': [ |
| 447 command.SkipForIncrementalCommand([ | 437 command.SkipForIncrementalCommand([ |
| 448 'sh', | 438 'sh', |
| 449 '%(binutils_pnacl_src)s/configure'] + | 439 '%(binutils_pnacl_src)s/configure'] + |
| 450 ConfigureHostArchFlags(host, warning_flags) + | 440 ConfigureHostArchFlags(host, warning_flags) + |
| 451 ['--prefix=', | 441 ['--prefix=', |
| 452 '--disable-silent-rules', | 442 '--disable-silent-rules', |
| 453 '--target=arm-pc-nacl', | 443 '--target=arm-pc-nacl', |
| 454 '--program-prefix=le32-nacl-', | 444 '--program-prefix=le32-nacl-', |
| 455 '--enable-targets=arm-pc-nacl,i686-pc-nacl,x86_64-pc-nacl,' + | 445 '--enable-targets=arm-pc-nacl,i686-pc-nacl,x86_64-pc-nacl,' + |
| 456 'mipsel-pc-nacl', | 446 'mipsel-pc-nacl', |
| 457 '--enable-deterministic-archives', | 447 '--enable-deterministic-archives', |
| 458 '--enable-shared=no', | 448 '--enable-shared=no', |
| 459 '--enable-gold=default', | 449 '--enable-gold=default', |
| 460 '--enable-ld=no', | 450 '--enable-ld=no', |
| 461 '--enable-plugins', | 451 '--enable-plugins', |
| 462 '--without-gas', | 452 '--without-gas', |
| 463 '--without-zlib', | 453 '--without-zlib', |
| 464 '--with-sysroot=/arm-pc-nacl']), | 454 '--with-sysroot=/arm-pc-nacl']), |
| 465 command.Command(MakeCommand(host)), | 455 command.Command(MakeCommand(host)), |
| 466 command.Command(MAKE_DESTDIR_CMD + ['install-strip'])] + | 456 command.Command(MAKE_DESTDIR_CMD + ['install-strip'])] + |
| 467 [command.RemoveDirectory(os.path.join('%(output)s', dir)) | 457 [command.RemoveDirectory(os.path.join('%(output)s', dir)) |
| 468 for dir in ('arm-pc-nacl', 'lib', 'lib32')] | 458 for dir in ('arm-pc-nacl', 'lib', 'lib32')] |
| 469 }, | 459 }, |
| 470 H('driver'): { | 460 H('driver'): { |
| 471 'type': 'build', | 461 'type': 'build', |
| 472 'output_subdir': BinSubdir(host), | 462 'output_subdir': 'bin', |
| 473 'inputs': { 'src': PNACL_DRIVER_DIR }, | 463 'inputs': { 'src': PNACL_DRIVER_DIR }, |
| 474 'commands': [ | 464 'commands': [ |
| 475 command.Runnable( | 465 command.Runnable( |
| 476 None, | 466 None, |
| 477 pnacl_commands.InstallDriverScripts, | 467 pnacl_commands.InstallDriverScripts, |
| 478 '%(src)s', '%(output)s', | 468 '%(src)s', '%(output)s', |
| 479 host_windows=TripleIsWindows(host) or TripleIsCygWin(host), | 469 host_windows=TripleIsWindows(host) or TripleIsCygWin(host), |
| 480 host_64bit=TripleIsX8664(host)) | 470 host_64bit=TripleIsX8664(host)) |
| 481 ], | 471 ], |
| 482 }, | 472 }, |
| 483 } | 473 } |
| 484 | 474 |
| 485 llvm_cmake = { | 475 llvm_cmake = { |
| 486 H('llvm'): { | 476 H('llvm'): { |
| 487 'dependencies': ['clang_src', 'llvm_src', 'binutils_pnacl_src'], | 477 'dependencies': ['clang_src', 'llvm_src', 'binutils_pnacl_src'], |
| 488 'type': 'build', | 478 'type': 'build', |
| 489 'output_subdir': HostSubdir(host), | |
| 490 'commands': [ | 479 'commands': [ |
| 491 command.SkipForIncrementalCommand([ | 480 command.SkipForIncrementalCommand([ |
| 492 'cmake', '-G', 'Ninja'] + | 481 'cmake', '-G', 'Ninja'] + |
| 493 CmakeHostArchFlags(host, options) + | 482 CmakeHostArchFlags(host, options) + |
| 494 ['-DCMAKE_BUILD_TYPE=RelWithDebInfo', | 483 ['-DCMAKE_BUILD_TYPE=RelWithDebInfo', |
| 495 '-DCMAKE_INSTALL_PREFIX=%(output)s', | 484 '-DCMAKE_INSTALL_PREFIX=%(output)s', |
| 496 '-DCMAKE_INSTALL_RPATH=$ORIGIN/../lib', | 485 '-DCMAKE_INSTALL_RPATH=$ORIGIN/../lib', |
| 497 '-DLLVM_ENABLE_LIBCXX=ON', | 486 '-DLLVM_ENABLE_LIBCXX=ON', |
| 498 '-DBUILD_SHARED_LIBS=ON', | 487 '-DBUILD_SHARED_LIBS=ON', |
| 499 '-DLLVM_TARGETS_TO_BUILD=X86;ARM;Mips', | 488 '-DLLVM_TARGETS_TO_BUILD=X86;ARM;Mips', |
| 500 '-DLLVM_ENABLE_ASSERTIONS=ON', | 489 '-DLLVM_ENABLE_ASSERTIONS=ON', |
| 501 '-DLLVM_ENABLE_ZLIB=OFF', | 490 '-DLLVM_ENABLE_ZLIB=OFF', |
| 502 '-DLLVM_BUILD_TESTS=ON', | 491 '-DLLVM_BUILD_TESTS=ON', |
| 503 '-DLLVM_APPEND_VC_REV=ON', | 492 '-DLLVM_APPEND_VC_REV=ON', |
| 504 '-DLLVM_BINUTILS_INCDIR=%(abs_binutils_pnacl_src)s/include', | 493 '-DLLVM_BINUTILS_INCDIR=%(abs_binutils_pnacl_src)s/include', |
| 505 '-DLLVM_EXTERNAL_CLANG_SOURCE_DIR=%(clang_src)s', | 494 '-DLLVM_EXTERNAL_CLANG_SOURCE_DIR=%(clang_src)s', |
| 506 '%(llvm_src)s']), | 495 '%(llvm_src)s']), |
| 507 command.Command(['ninja', '-v']), | 496 command.Command(['ninja', '-v']), |
| 508 command.Command(['ninja', 'install']), | 497 command.Command(['ninja', 'install']), |
| 509 ], | 498 ], |
| 510 }, | 499 }, |
| 511 } | 500 } |
| 512 llvm_autoconf = { | 501 llvm_autoconf = { |
| 513 H('llvm'): { | 502 H('llvm'): { |
| 514 'dependencies': ['clang_src', 'llvm_src', 'binutils_pnacl_src', | 503 'dependencies': ['clang_src', 'llvm_src', 'binutils_pnacl_src', |
| 515 'subzero_src'], | 504 'subzero_src'], |
| 516 'type': 'build', | 505 'type': 'build', |
| 517 'output_subdir': HostSubdir(host), | |
| 518 'commands': [ | 506 'commands': [ |
| 519 command.SkipForIncrementalCommand([ | 507 command.SkipForIncrementalCommand([ |
| 520 'sh', | 508 'sh', |
| 521 '%(llvm_src)s/configure'] + | 509 '%(llvm_src)s/configure'] + |
| 522 ConfigureHostArchFlags(host) + | 510 ConfigureHostArchFlags(host) + |
| 523 LLVMConfigureAssertionsFlags(options) + | 511 LLVMConfigureAssertionsFlags(options) + |
| 524 ['--prefix=/', | 512 ['--prefix=/', |
| 525 '--enable-shared', | 513 '--enable-shared', |
| 526 '--disable-zlib', | 514 '--disable-zlib', |
| 527 '--disable-terminfo', | 515 '--disable-terminfo', |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 571 # Because target_lib_compiler is not a memoized target, its name doesn't | 559 # Because target_lib_compiler is not a memoized target, its name doesn't |
| 572 # need to have the host appended to it (it can be different on different | 560 # need to have the host appended to it (it can be different on different |
| 573 # hosts), which means that target library build rules don't have to care | 561 # hosts), which means that target library build rules don't have to care |
| 574 # what host they run on; they can just depend on 'target_lib_compiler' | 562 # what host they run on; they can just depend on 'target_lib_compiler' |
| 575 'target_lib_compiler': { | 563 'target_lib_compiler': { |
| 576 'type': 'work', | 564 'type': 'work', |
| 577 'output_subdir': 'target_lib_compiler', | 565 'output_subdir': 'target_lib_compiler', |
| 578 'dependencies': [ H('binutils_pnacl'), H('llvm'), host_lib ], | 566 'dependencies': [ H('binutils_pnacl'), H('llvm'), host_lib ], |
| 579 'inputs': { 'driver': PNACL_DRIVER_DIR }, | 567 'inputs': { 'driver': PNACL_DRIVER_DIR }, |
| 580 'commands': [ | 568 'commands': [ |
| 581 command.CopyRecursive( | 569 command.CopyRecursive('%(' + t + ')s', '%(output)s') |
| 582 '%(' + t + ')s', | |
| 583 os.path.join('%(output)s', HostSubdir(host))) | |
| 584 for t in [H('llvm'), H('binutils_pnacl'), host_lib]] + [ | 570 for t in [H('llvm'), H('binutils_pnacl'), host_lib]] + [ |
| 585 command.Runnable( | 571 command.Runnable( |
| 586 None, pnacl_commands.InstallDriverScripts, | 572 None, pnacl_commands.InstallDriverScripts, |
| 587 '%(driver)s', os.path.join('%(output)s', 'bin'), | 573 '%(driver)s', os.path.join('%(output)s', 'bin'), |
| 588 host_windows=TripleIsWindows(host) or TripleIsCygWin(host), | 574 host_windows=TripleIsWindows(host) or TripleIsCygWin(host), |
| 589 host_64bit=TripleIsX8664(host)) | 575 host_64bit=TripleIsX8664(host)) |
| 590 ] | 576 ] |
| 591 }, | 577 }, |
| 592 } | 578 } |
| 593 return compiler | 579 return compiler |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 704 legal_bias = pynacl.gsd_storage.LegalizeName(bias) | 690 legal_bias = pynacl.gsd_storage.LegalizeName(bias) |
| 705 common_packages.append('newlib_%s' % legal_bias) | 691 common_packages.append('newlib_%s' % legal_bias) |
| 706 common_packages.append('libcxx_%s' % legal_bias) | 692 common_packages.append('libcxx_%s' % legal_bias) |
| 707 common_packages.append('libstdcxx_%s' % legal_bias) | 693 common_packages.append('libstdcxx_%s' % legal_bias) |
| 708 common_packages.append('libs_support_bitcode_%s' % legal_bias) | 694 common_packages.append('libs_support_bitcode_%s' % legal_bias) |
| 709 | 695 |
| 710 # Host components | 696 # Host components |
| 711 host_packages = {} | 697 host_packages = {} |
| 712 for os_name, arch in (('win', 'x86-32'), | 698 for os_name, arch in (('win', 'x86-32'), |
| 713 ('mac', 'x86-64'), | 699 ('mac', 'x86-64'), |
| 714 ('linux', 'x86-32'), | |
| 715 ('linux', 'x86-64')): | 700 ('linux', 'x86-64')): |
| 716 triple = pynacl.platform.PlatformTriple(os_name, arch) | 701 triple = pynacl.platform.PlatformTriple(os_name, arch) |
| 717 legal_triple = pynacl.gsd_storage.LegalizeName(triple) | 702 legal_triple = pynacl.gsd_storage.LegalizeName(triple) |
| 718 host_packages.setdefault(os_name, []).extend( | 703 host_packages.setdefault(os_name, []).extend( |
| 719 ['binutils_pnacl_%s' % legal_triple, | 704 ['binutils_pnacl_%s' % legal_triple, |
| 720 'llvm_%s' % legal_triple, | 705 'llvm_%s' % legal_triple, |
| 721 'driver_%s' % legal_triple]) | 706 'driver_%s' % legal_triple]) |
| 722 if os_name != 'win': | 707 if os_name != 'win': |
| 723 host_packages[os_name].append('libcxx_%s' % legal_triple) | 708 host_packages[os_name].append('libcxx_%s' % legal_triple) |
| 724 | 709 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 737 return package_targets | 722 return package_targets |
| 738 | 723 |
| 739 if __name__ == '__main__': | 724 if __name__ == '__main__': |
| 740 # This sets the logging for gclient-alike repo sync. It will be overridden | 725 # This sets the logging for gclient-alike repo sync. It will be overridden |
| 741 # by the package builder based on the command-line flags. | 726 # by the package builder based on the command-line flags. |
| 742 logging.getLogger().setLevel(logging.DEBUG) | 727 logging.getLogger().setLevel(logging.DEBUG) |
| 743 parser = argparse.ArgumentParser(add_help=False) | 728 parser = argparse.ArgumentParser(add_help=False) |
| 744 parser.add_argument('--legacy-repo-sync', action='store_true', | 729 parser.add_argument('--legacy-repo-sync', action='store_true', |
| 745 dest='legacy_repo_sync', default=False, | 730 dest='legacy_repo_sync', default=False, |
| 746 help='Sync the git repo directories used by build.sh') | 731 help='Sync the git repo directories used by build.sh') |
| 747 parser.add_argument('--build-64bit-host', action='store_true', | |
| 748 dest='build_64bit_host', default=False, | |
| 749 help='Build 64-bit Linux host binaries in addition to 32') | |
| 750 parser.add_argument('--disable-llvm-assertions', action='store_false', | 732 parser.add_argument('--disable-llvm-assertions', action='store_false', |
| 751 dest='enable_llvm_assertions', default=True) | 733 dest='enable_llvm_assertions', default=True) |
| 752 parser.add_argument('--cmake', action='store_true', default=False, | 734 parser.add_argument('--cmake', action='store_true', default=False, |
| 753 help="Use LLVM's cmake ninja build instead of autoconf") | 735 help="Use LLVM's cmake ninja build instead of autoconf") |
| 754 parser.add_argument('--sanitize', choices=['address', 'thread', 'memory', | 736 parser.add_argument('--sanitize', choices=['address', 'thread', 'memory', |
| 755 'undefined'], | 737 'undefined'], |
| 756 help="Use a sanitizer with LLVM's clang cmake build") | 738 help="Use a sanitizer with LLVM's clang cmake build") |
| 757 parser.add_argument('--testsuite-sync', action='store_true', default=False, | 739 parser.add_argument('--testsuite-sync', action='store_true', default=False, |
| 758 help=('Sync the sources for the LLVM testsuite. ' | 740 help=('Sync the sources for the LLVM testsuite. ' |
| 759 'Only useful if --sync/ is also enabled')) | 741 'Only useful if --sync/ is also enabled')) |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 780 leftover_args.append('--sync-only') | 762 leftover_args.append('--sync-only') |
| 781 else: | 763 else: |
| 782 upload_packages = GetUploadPackageTargets() | 764 upload_packages = GetUploadPackageTargets() |
| 783 if pynacl.platform.IsWindows(): | 765 if pynacl.platform.IsWindows(): |
| 784 InstallMinGWHostCompiler() | 766 InstallMinGWHostCompiler() |
| 785 | 767 |
| 786 packages.update(HostToolsSources(GetGitSyncCmdsCallback(rev))) | 768 packages.update(HostToolsSources(GetGitSyncCmdsCallback(rev))) |
| 787 if args.testsuite_sync: | 769 if args.testsuite_sync: |
| 788 packages.update(TestsuiteSources(GetGitSyncCmdsCallback(rev))) | 770 packages.update(TestsuiteSources(GetGitSyncCmdsCallback(rev))) |
| 789 | 771 |
| 790 if pynacl.platform.IsLinux64(): | 772 hosts = [pynacl.platform.PlatformTriple()] |
| 791 hosts = ['i686-linux'] | |
| 792 if args.build_64bit_host: | |
| 793 hosts.append(pynacl.platform.PlatformTriple()) | |
| 794 else: | |
| 795 hosts = [pynacl.platform.PlatformTriple()] | |
| 796 if pynacl.platform.IsLinux() and BUILD_CROSS_MINGW: | 773 if pynacl.platform.IsLinux() and BUILD_CROSS_MINGW: |
| 797 hosts.append(pynacl.platform.PlatformTriple('win', 'x86-32')) | 774 hosts.append(pynacl.platform.PlatformTriple('win', 'x86-32')) |
| 798 for host in hosts: | 775 for host in hosts: |
| 799 packages.update(HostLibs(host)) | 776 packages.update(HostLibs(host)) |
| 800 packages.update(HostTools(host, args)) | 777 packages.update(HostTools(host, args)) |
| 801 packages.update(TargetLibCompiler(DefaultHostForTargetLibs())) | 778 packages.update(TargetLibCompiler(pynacl.platform.PlatformTriple())) |
| 802 # Don't build the target libs on Windows because of pathname issues. | 779 # Don't build the target libs on Windows because of pathname issues. |
| 803 # Only the linux64 bot is canonical (i.e. it will upload its packages). | 780 # Only the linux64 bot is canonical (i.e. it will upload its packages). |
| 804 # The other bots will use a 'work' target instead of a 'build' target for | 781 # The other bots will use a 'work' target instead of a 'build' target for |
| 805 # the target libs, so they will not be memoized, but can be used for tests. | 782 # the target libs, so they will not be memoized, but can be used for tests. |
| 806 # TODO(dschuff): Even better would be if we could memoize non-canonical | 783 # TODO(dschuff): Even better would be if we could memoize non-canonical |
| 807 # build targets without doing things like mangling their names (and for e.g. | 784 # build targets without doing things like mangling their names (and for e.g. |
| 808 # scons tests, skip running them if their dependencies haven't changed, like | 785 # scons tests, skip running them if their dependencies haven't changed, like |
| 809 # build targets) | 786 # build targets) |
| 810 is_canonical = pynacl.platform.IsLinux64() | 787 is_canonical = pynacl.platform.IsLinux64() |
| 811 if pynacl.platform.IsLinux() or pynacl.platform.IsMac(): | 788 if pynacl.platform.IsLinux() or pynacl.platform.IsMac(): |
| 812 packages.update(pnacl_targetlibs.TargetLibsSrc( | 789 packages.update(pnacl_targetlibs.TargetLibsSrc( |
| 813 GetGitSyncCmdsCallback(rev))) | 790 GetGitSyncCmdsCallback(rev))) |
| 814 for bias in BITCODE_BIASES: | 791 for bias in BITCODE_BIASES: |
| 815 packages.update(pnacl_targetlibs.BitcodeLibs(bias, is_canonical)) | 792 packages.update(pnacl_targetlibs.BitcodeLibs(bias, is_canonical)) |
| 816 for arch in ALL_ARCHES: | 793 for arch in ALL_ARCHES: |
| 817 packages.update(pnacl_targetlibs.NativeLibs(arch, is_canonical)) | 794 packages.update(pnacl_targetlibs.NativeLibs(arch, is_canonical)) |
| 818 packages.update(Metadata(rev)) | 795 packages.update(Metadata(rev)) |
| 819 if pynacl.platform.IsLinux() or pynacl.platform.IsMac(): | 796 if pynacl.platform.IsLinux() or pynacl.platform.IsMac(): |
| 820 packages.update(pnacl_targetlibs.UnsandboxedIRT( | 797 packages.update(pnacl_targetlibs.UnsandboxedIRT( |
| 821 'x86-32-%s' % pynacl.platform.GetOS())) | 798 'x86-32-%s' % pynacl.platform.GetOS())) |
| 822 | 799 |
| 823 | 800 |
| 824 tb = toolchain_main.PackageBuilder(packages, | 801 tb = toolchain_main.PackageBuilder(packages, |
| 825 upload_packages, | 802 upload_packages, |
| 826 leftover_args) | 803 leftover_args) |
| 827 tb.Main() | 804 tb.Main() |
| OLD | NEW |