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