Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: toolchain_build/toolchain_build_pnacl.py

Issue 867403003: Adding le32-nacl build of pnacl tools. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: fi Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 def TripleIsX8664(t): 135 def TripleIsX8664(t):
136 return fnmatch.fnmatch(t, 'x86_64*') 136 return fnmatch.fnmatch(t, 'x86_64*')
137 137
138 138
139 # Return a tuple (C compiler, C++ compiler) of the compilers to compile the host 139 # Return a tuple (C compiler, C++ compiler) of the compilers to compile the host
140 # toolchains 140 # toolchains
141 def CompilersForHost(host): 141 def CompilersForHost(host):
142 compiler = { 142 compiler = {
143 # For now we only do native builds for linux and mac 143 # For now we only do native builds for linux and mac
144 # treat 32-bit linux like a native build 144 # treat 32-bit linux like a native build
145 'i686-linux': (CHROME_CLANG, CHROME_CLANGXX), 145 'i686-linux': (CHROME_CLANG, CHROME_CLANGXX, 'ar', 'ranlib'),
146 'x86_64-linux': (CHROME_CLANG, CHROME_CLANGXX), 146 'x86_64-linux': (CHROME_CLANG, CHROME_CLANGXX, 'ar', 'ranlib'),
147 'x86_64-apple-darwin': (CHROME_CLANG, CHROME_CLANGXX), 147 'x86_64-apple-darwin': (CHROME_CLANG, CHROME_CLANGXX, 'ar', 'ranlib'),
148 # Windows build should work for native and cross 148 # Windows build should work for native and cross
149 'i686-w64-mingw32': ('i686-w64-mingw32-gcc', 'i686-w64-mingw32-g++'), 149 'i686-w64-mingw32': (
150 'i686-w64-mingw32-gcc', 'i686-w64-mingw32-g++', 'ar', 'ranlib'),
150 # TODO: add arm-hosted support 151 # TODO: add arm-hosted support
151 'i686-pc-cygwin': ('gcc', 'g++'), 152 'i686-pc-cygwin': ('gcc', 'g++', 'ar', 'ranlib'),
152 } 153 }
154 if host == 'le32-nacl':
155 nacl_sdk = os.environ.get('NACL_SDK_ROOT')
156 assert nacl_sdk, 'NACL_SDK_ROOT not set'
157 pnacl_bin_dir = os.path.join(nacl_sdk, 'toolchain/linux_pnacl/bin')
158 glibc_bin_dir = os.path.join(nacl_sdk, 'toolchain/linux_x86_glibc/bin')
159 compiler.update({
160 'le32-nacl': (os.path.join(pnacl_bin_dir, 'pnacl-clang'),
161 os.path.join(pnacl_bin_dir, 'pnacl-clang++'),
162 os.path.join(pnacl_bin_dir, 'pnacl-ar'),
163 os.path.join(pnacl_bin_dir, 'pnacl-ranlib')),
164 })
153 return compiler[host] 165 return compiler[host]
154 166
155 167
156 def GSDJoin(*args): 168 def GSDJoin(*args):
157 return '_'.join([pynacl.gsd_storage.LegalizeName(arg) for arg in args]) 169 return '_'.join([pynacl.gsd_storage.LegalizeName(arg) for arg in args])
158 170
159 171
160 def ConfigureHostArchFlags(host, extra_cflags, options): 172 def ConfigureHostArchFlags(host, extra_cflags, options, extra_configure=None):
161 """ Return flags passed to LLVM and binutils configure for compilers and 173 """ Return flags passed to LLVM and binutils configure for compilers and
162 compile flags. """ 174 compile flags. """
163 configure_args = [] 175 configure_args = []
164 extra_cc_args = [] 176 extra_cc_args = []
165 177
178 configure_args += options.extra_configure_args
179 if extra_configure is not None:
180 configure_args += extra_configure
181 if options.extra_cc_args is not None:
182 extra_cc_args += [options.extra_cc_args]
Derek Schuff 2015/01/26 17:13:54 should options.extra_cc_args already be a list?
bradn 2015/01/26 19:32:20 So I decided it was easier to treat this one as a
183
166 native = pynacl.platform.PlatformTriple() 184 native = pynacl.platform.PlatformTriple()
167 is_cross = host != native 185 is_cross = host != native
168 if is_cross: 186 if is_cross:
169 if (pynacl.platform.IsLinux64() and 187 if (pynacl.platform.IsLinux64() and
170 fnmatch.fnmatch(host, '*-linux*')): 188 fnmatch.fnmatch(host, '*-linux*')):
171 # 64 bit linux can build 32 bit linux binaries while still being a native 189 # 64 bit linux can build 32 bit linux binaries while still being a native
172 # build for our purposes. But it's not what config.guess will yield, so 190 # build for our purposes. But it's not what config.guess will yield, so
173 # use --build to force it and make sure things build correctly. 191 # use --build to force it and make sure things build correctly.
174 configure_args.append('--build=' + host) 192 configure_args.append('--build=' + host)
175 else: 193 else:
176 configure_args.append('--host=' + host) 194 configure_args.append('--host=' + host)
177 if TripleIsLinux(host) and not TripleIsX8664(host): 195 if TripleIsLinux(host) and not TripleIsX8664(host):
178 # Chrome clang defaults to 64-bit builds, even when run on 32-bit Linux. 196 # Chrome clang defaults to 64-bit builds, even when run on 32-bit Linux.
179 extra_cc_args = ['-m32'] 197 extra_cc_args = ['-m32']
180 198
181 extra_cxx_args = list(extra_cc_args) 199 extra_cxx_args = list(extra_cc_args)
182 200
183 if not options.gcc: 201 if not options.gcc:
184 cc, cxx = CompilersForHost(host) 202 cc, cxx, ar, ranlib = CompilersForHost(host)
185 203
186 configure_args.append('CC=' + ' '.join([cc] + extra_cc_args)) 204 configure_args.append('CC=' + ' '.join([cc] + extra_cc_args))
187 configure_args.append('CXX=' + ' '.join([cxx] + extra_cxx_args)) 205 configure_args.append('CXX=' + ' '.join([cxx] + extra_cxx_args))
206 configure_args.append('AR=' + ar)
207 configure_args.append('RANLIB=' + ranlib)
188 208
189 if TripleIsWindows(host): 209 if TripleIsWindows(host):
190 # The i18n support brings in runtime dependencies on MinGW DLLs 210 # The i18n support brings in runtime dependencies on MinGW DLLs
191 # that we don't want to have to distribute alongside our binaries. 211 # that we don't want to have to distribute alongside our binaries.
192 # So just disable it, and compiler messages will always be in US English. 212 # So just disable it, and compiler messages will always be in US English.
193 configure_args.append('--disable-nls') 213 configure_args.append('--disable-nls')
194 configure_args.extend(['LDFLAGS=-L%(abs_libdl)s -ldl', 214 configure_args.extend(['LDFLAGS=-L%(abs_libdl)s -ldl',
195 'CFLAGS=-isystem %(abs_libdl)s', 215 'CFLAGS=-isystem %(abs_libdl)s',
196 'CXXFLAGS=-isystem %(abs_libdl)s']) 216 'CXXFLAGS=-isystem %(abs_libdl)s'])
197 if is_cross: 217 if is_cross:
198 # LLVM's linux->mingw cross build needs this 218 # LLVM's linux->mingw cross build needs this
199 configure_args.append('CC_FOR_BUILD=gcc') 219 configure_args.append('CC_FOR_BUILD=gcc')
200 else: 220 else:
201 if TripleIsMac(host): 221 if TripleIsMac(host):
202 # This is required for building with recent libc++ against OSX 10.6 222 # This is required for building with recent libc++ against OSX 10.6
203 extra_cflags.append('-U__STRICT_ANSI__') 223 extra_cflags.append('-U__STRICT_ANSI__')
204 if options.gcc: 224 if options.gcc or host == 'le32-nacl':
205 configure_args.extend(['CFLAGS=' + ' '.join(extra_cflags), 225 configure_args.extend(['CFLAGS=' + ' '.join(extra_cflags),
206 'CXXFLAGS=' + ' '.join(extra_cflags)]) 226 'CXXFLAGS=' + ' '.join(extra_cflags)])
207 else: 227 else:
208 configure_args.extend( 228 configure_args.extend(
209 ['CFLAGS=' + ' '.join(extra_cflags), 229 ['CFLAGS=' + ' '.join(extra_cflags),
210 'LDFLAGS=-L%(' + GSDJoin('abs_libcxx', host) + ')s/lib', 230 'LDFLAGS=-L%(' + GSDJoin('abs_libcxx', host) + ')s/lib',
211 'CXXFLAGS=-stdlib=libc++ -I%(' + GSDJoin('abs_libcxx', host) + 231 'CXXFLAGS=-stdlib=libc++ -I%(' + GSDJoin('abs_libcxx', host) +
212 ')s/include/c++/v1 ' + ' '.join(extra_cflags)]) 232 ')s/include/c++/v1 ' + ' '.join(extra_cflags)])
213 233
214 return configure_args 234 return configure_args
215 235
216 236
217 def LibCxxHostArchFlags(host): 237 def LibCxxHostArchFlags(host):
218 cc, cxx = CompilersForHost(host) 238 cc, cxx, _, _ = CompilersForHost(host)
219 cmake_flags = [] 239 cmake_flags = []
220 cmake_flags.extend(['-DCMAKE_C_COMPILER='+cc, '-DCMAKE_CXX_COMPILER='+cxx]) 240 cmake_flags.extend(['-DCMAKE_C_COMPILER='+cc, '-DCMAKE_CXX_COMPILER='+cxx])
221 if TripleIsLinux(host) and not TripleIsX8664(host): 241 if TripleIsLinux(host) and not TripleIsX8664(host):
222 # Chrome clang defaults to 64-bit builds, even when run on 32-bit Linux 242 # Chrome clang defaults to 64-bit builds, even when run on 32-bit Linux
223 cmake_flags.extend(['-DCMAKE_C_FLAGS=-m32', 243 cmake_flags.extend(['-DCMAKE_C_FLAGS=-m32',
224 '-DCMAKE_CXX_FLAGS=-m32']) 244 '-DCMAKE_CXX_FLAGS=-m32'])
225 return cmake_flags 245 return cmake_flags
226 246
227 def CmakeHostArchFlags(host, options): 247 def CmakeHostArchFlags(host, options):
228 """ Set flags passed to LLVM cmake for compilers and compile flags. """ 248 """ Set flags passed to LLVM cmake for compilers and compile flags. """
229 cmake_flags = [] 249 cmake_flags = []
230 cc, cxx = CompilersForHost(host) 250 cc, cxx, _, _ = CompilersForHost(host)
231 251
232 cmake_flags.extend(['-DCMAKE_C_COMPILER='+cc, '-DCMAKE_CXX_COMPILER='+cxx]) 252 cmake_flags.extend(['-DCMAKE_C_COMPILER='+cc, '-DCMAKE_CXX_COMPILER='+cxx])
233 253
234 # There seems to be a bug in chrome clang where it exposes the msan interface 254 # There seems to be a bug in chrome clang where it exposes the msan interface
235 # (even when compiling without msan) but then does not link with an 255 # (even when compiling without msan) but then does not link with an
236 # msan-enabled compiler_rt, leaving references to __msan_allocated_memory 256 # msan-enabled compiler_rt, leaving references to __msan_allocated_memory
237 # undefined. 257 # undefined.
238 cmake_flags.append('-DHAVE_SANITIZER_MSAN_INTERFACE_H=FALSE') 258 cmake_flags.append('-DHAVE_SANITIZER_MSAN_INTERFACE_H=FALSE')
239 259
240 if options.sanitize: 260 if options.sanitize:
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 if TripleIsLinux(host): 404 if TripleIsLinux(host):
385 libname = 'libc++.so.1' 405 libname = 'libc++.so.1'
386 elif TripleIsMac(host): 406 elif TripleIsMac(host):
387 libname = 'libc++.1.dylib' 407 libname = 'libc++.1.dylib'
388 else: 408 else:
389 return [] 409 return []
390 return [command.Mkdir(dest, parents=True), 410 return [command.Mkdir(dest, parents=True),
391 command.Copy('%(' + GSDJoin('abs_libcxx', host) +')s/lib/' + libname, 411 command.Copy('%(' + GSDJoin('abs_libcxx', host) +')s/lib/' + libname,
392 os.path.join(dest, libname))] 412 os.path.join(dest, libname))]
393 413
394 def CreateSymLinksToDirectToNaClTools(): 414 def CreateSymLinksToDirectToNaClTools(host):
415 if host == 'le32-nacl':
416 return []
395 return ( 417 return (
396 [command.Command(['ln', '-f', 418 [command.Command(['ln', '-f',
397 command.path.join('%(output)s', 'bin','clang'), 419 command.path.join('%(output)s', 'bin','clang'),
398 command.path.join('%(output)s', 'bin', 420 command.path.join('%(output)s', 'bin',
399 arch + '-nacl-clang')]) 421 arch + '-nacl-clang')])
400 for arch in DIRECT_TO_NACL_ARCHES] + 422 for arch in DIRECT_TO_NACL_ARCHES] +
401 [command.Command(['ln', '-f', 423 [command.Command(['ln', '-f',
402 command.path.join('%(output)s', 'bin','clang'), 424 command.path.join('%(output)s', 'bin','clang'),
403 command.path.join('%(output)s', 'bin', 425 command.path.join('%(output)s', 'bin',
404 arch + '-nacl-clang++')]) 426 arch + '-nacl-clang++')])
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 def HostTools(host, options): 485 def HostTools(host, options):
464 def H(component_name): 486 def H(component_name):
465 # Return a package name for a component name with a host triple. 487 # Return a package name for a component name with a host triple.
466 return GSDJoin(component_name, host) 488 return GSDJoin(component_name, host)
467 # Return the file name with the appropriate suffix for an executable file. 489 # Return the file name with the appropriate suffix for an executable file.
468 def Exe(file): 490 def Exe(file):
469 if TripleIsWindows(host): 491 if TripleIsWindows(host):
470 return file + '.exe' 492 return file + '.exe'
471 else: 493 else:
472 return file 494 return file
495
496 werror = []
497 extra_gold_deps = []
498 if host == 'le32-nacl':
499 # TODO(bradnelson): Fix warnings so this can go away.
500 werror = ['--enable-werror=no']
501 extra_gold_deps = [H('llvm')]
502
473 # Binutils still has some warnings when building with clang 503 # Binutils still has some warnings when building with clang
474 if not options.gcc: 504 if not options.gcc:
475 warning_flags = ['-Wno-extended-offsetof', '-Wno-absolute-value', 505 warning_flags = ['-Wno-extended-offsetof', '-Wno-absolute-value',
476 '-Wno-unused-function', '-Wno-unused-const-variable', 506 '-Wno-unused-function', '-Wno-unused-const-variable',
477 '-Wno-unneeded-internal-declaration', 507 '-Wno-unneeded-internal-declaration',
478 '-Wno-unused-private-field', '-Wno-format-security'] 508 '-Wno-unused-private-field', '-Wno-format-security']
479 else: 509 else:
480 warning_flags = ['-Wno-unused-function', '-Wno-unused-value'] 510 warning_flags = ['-Wno-unused-function', '-Wno-unused-value']
511
481 tools = { 512 tools = {
482 # The binutils_pnacl package is used both for bitcode linking (gold) and 513 # The binutils_pnacl package is used both for bitcode linking (gold) and
483 # for its conventional use with arm-nacl-clang. 514 # for its conventional use with arm-nacl-clang.
484 H('binutils_pnacl'): { 515 H('binutils_pnacl'): {
485 'dependencies': ['binutils_pnacl_src'], 516 'dependencies': ['binutils_pnacl_src'] + extra_gold_deps,
486 'type': 'build', 517 'type': 'build',
487 'inputs' : { 'macros': os.path.join(NACL_DIR, 518 'inputs' : { 'macros': os.path.join(NACL_DIR,
488 'pnacl', 'support', 'clang_direct', 'nacl-arm-macros.s')}, 519 'pnacl', 'support', 'clang_direct', 'nacl-arm-macros.s')},
489 'commands': [ 520 'commands': [
490 command.SkipForIncrementalCommand([ 521 command.SkipForIncrementalCommand([
491 'sh', 522 'sh',
492 '%(binutils_pnacl_src)s/configure'] + 523 '%(binutils_pnacl_src)s/configure'] +
493 ConfigureBinutilsCommon() + 524 ConfigureBinutilsCommon() +
494 ConfigureHostArchFlags(host, warning_flags, options) + 525 ConfigureHostArchFlags(
526 host, warning_flags, options,
527 options.binutils_pnacl_extra_configure) +
495 ['--target=arm-nacl', 528 ['--target=arm-nacl',
496 '--program-prefix=le32-nacl-', 529 '--program-prefix=le32-nacl-',
497 '--enable-targets=arm-nacl,i686-nacl,x86_64-nacl,' + 530 '--enable-targets=arm-nacl,i686-nacl,x86_64-nacl,' +
498 'mipsel-nacl', 531 'mipsel-nacl',
499 '--enable-shared=no', 532 '--enable-shared=no',
500 '--enable-gold=default', 533 '--enable-gold=default',
501 '--enable-plugins', 534 '--enable-plugins',
502 '--without-gas', 535 '--without-gas',
503 '--with-sysroot=/le32-nacl']), 536 '--with-sysroot=/le32-nacl'] + werror),
504 command.Command(MakeCommand(host)), 537 command.Command(MakeCommand(host)),
505 command.Command(MAKE_DESTDIR_CMD + ['install-strip'])] + 538 command.Command(MAKE_DESTDIR_CMD + ['install-strip'])] +
506 [command.RemoveDirectory(os.path.join('%(output)s', dir)) 539 [command.RemoveDirectory(os.path.join('%(output)s', dir))
507 for dir in ('lib', 'lib32')] + 540 for dir in ('lib', 'lib32')] +
508 # Since it has dual use, just create links for both sets of names 541 # Since it has dual use, just create links for both sets of names
509 # (i.e. le32-nacl-foo and arm-nacl-foo) 542 # (i.e. le32-nacl-foo and arm-nacl-foo)
510 # TODO(dschuff): Use the redirector scripts here like binutils_x86 543 # TODO(dschuff): Use the redirector scripts here like binutils_x86
511 [command.Command([ 544 [command.Command([
512 'ln', '-f', 545 'ln', '-f',
513 command.path.join('%(output)s', 'bin', 'le32-nacl-' + tool), 546 command.path.join('%(output)s', 'bin', 'le32-nacl-' + tool),
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 '-DLLVM_ENABLE_ASSERTIONS=ON', 591 '-DLLVM_ENABLE_ASSERTIONS=ON',
559 '-DLLVM_ENABLE_ZLIB=OFF', 592 '-DLLVM_ENABLE_ZLIB=OFF',
560 '-DLLVM_BUILD_TESTS=ON', 593 '-DLLVM_BUILD_TESTS=ON',
561 '-DLLVM_APPEND_VC_REV=ON', 594 '-DLLVM_APPEND_VC_REV=ON',
562 '-DLLVM_BINUTILS_INCDIR=%(abs_binutils_pnacl_src)s/include', 595 '-DLLVM_BINUTILS_INCDIR=%(abs_binutils_pnacl_src)s/include',
563 '-DLLVM_EXTERNAL_CLANG_SOURCE_DIR=%(clang_src)s', 596 '-DLLVM_EXTERNAL_CLANG_SOURCE_DIR=%(clang_src)s',
564 '%(llvm_src)s']), 597 '%(llvm_src)s']),
565 command.Command(['ninja', '-v']), 598 command.Command(['ninja', '-v']),
566 command.Command(['ninja', 'install']), 599 command.Command(['ninja', 'install']),
567 ] + 600 ] +
568 CreateSymLinksToDirectToNaClTools() 601 CreateSymLinksToDirectToNaClTools(host)
569 }, 602 },
570 } 603 }
604 cleanup_libs = []
Derek Schuff 2015/01/26 17:13:54 maybe call this cleanup_static_libs
bradn 2015/01/26 19:32:20 Done.
605 shared = []
606 if host != 'le32-nacl':
607 shared = ['--enable-shared']
608 cleanup_libs = [
609 command.Remove(*[os.path.join('%(output)s', 'lib', f) for f
610 in '*.a', '*Hello.*', 'BugpointPasses.*']),
611 ]
571 llvm_autoconf = { 612 llvm_autoconf = {
572 H('llvm'): { 613 H('llvm'): {
573 'dependencies': ['clang_src', 'llvm_src', 'binutils_pnacl_src', 614 'dependencies': ['clang_src', 'llvm_src', 'binutils_pnacl_src',
574 'subzero_src'], 615 'subzero_src'],
575 'type': 'build', 616 'type': 'build',
576 'commands': [ 617 'commands': [
577 command.SkipForIncrementalCommand([ 618 command.SkipForIncrementalCommand([
578 'sh', 619 'sh',
579 '%(llvm_src)s/configure'] + 620 '%(llvm_src)s/configure'] +
580 ConfigureHostArchFlags(host, [], options) + 621 ConfigureHostArchFlags(host, [], options) +
581 LLVMConfigureAssertionsFlags(options) + 622 LLVMConfigureAssertionsFlags(options) +
582 ['--prefix=/', 623 ['--prefix=/',
583 '--enable-shared',
584 '--disable-zlib', 624 '--disable-zlib',
585 '--disable-terminfo', 625 '--disable-terminfo',
586 '--disable-jit', 626 '--disable-jit',
587 '--disable-bindings', # ocaml is currently the only binding. 627 '--disable-bindings', # ocaml is currently the only binding.
588 '--with-binutils-include=%(abs_binutils_pnacl_src)s/include', 628 '--with-binutils-include=%(abs_binutils_pnacl_src)s/include',
589 '--enable-targets=x86,arm,mips', 629 '--enable-targets=x86,arm,mips',
590 '--program-prefix=', 630 '--program-prefix=',
591 '--enable-optimized', 631 '--enable-optimized',
592 '--with-clang-srcdir=%(abs_clang_src)s'])] + 632 '--with-clang-srcdir=%(abs_clang_src)s'] + shared)] +
593 CopyHostLibcxxForLLVMBuild( 633 CopyHostLibcxxForLLVMBuild(
594 host, 634 host,
595 os.path.join('Release+Asserts', 'lib'), 635 os.path.join('Release+Asserts', 'lib'),
596 options) + 636 options) +
597 [command.Command(MakeCommand(host) + [ 637 [command.Command(MakeCommand(host) + [
598 'VERBOSE=1', 638 'VERBOSE=1',
599 'NACL_SANDBOX=0', 639 'NACL_SANDBOX=0',
640 'PNACL_BROWSER_TRANSLATOR=0',
600 'SUBZERO_SRC_ROOT=%(abs_subzero_src)s', 641 'SUBZERO_SRC_ROOT=%(abs_subzero_src)s',
601 'all']), 642 'all']),
602 command.Command(MAKE_DESTDIR_CMD + ['install']), 643 command.Command(MAKE_DESTDIR_CMD + ['install'])] +
603 command.Remove(*[os.path.join('%(output)s', 'lib', f) for f in 644 cleanup_libs + [
604 '*.a', '*Hello.*', 'BugpointPasses.*']),
605 command.Remove(*[os.path.join('%(output)s', 'bin', f) for f in 645 command.Remove(*[os.path.join('%(output)s', 'bin', f) for f in
606 Exe('clang-format'), Exe('clang-check'), 646 Exe('clang-format'), Exe('clang-check'),
607 Exe('c-index-test'), Exe('clang-tblgen'), 647 Exe('c-index-test'), Exe('clang-tblgen'),
608 Exe('llvm-tblgen')])] + 648 Exe('llvm-tblgen')])] +
609 CreateSymLinksToDirectToNaClTools() + 649 CreateSymLinksToDirectToNaClTools(host) +
610 CopyWindowsHostLibs(host), 650 CopyWindowsHostLibs(host),
611 }, 651 },
612 } 652 }
613 if options.cmake: 653 if options.cmake:
614 tools.update(llvm_cmake) 654 tools.update(llvm_cmake)
615 else: 655 else:
616 tools.update(llvm_autoconf) 656 tools.update(llvm_autoconf)
617 if TripleIsWindows(host): 657 if TripleIsWindows(host):
618 tools[H('binutils_pnacl')]['dependencies'].append('libdl') 658 tools[H('binutils_pnacl')]['dependencies'].append('libdl')
619 tools[H('llvm')]['dependencies'].append('libdl') 659 tools[H('llvm')]['dependencies'].append('libdl')
620 elif not options.gcc: 660 elif not options.gcc and host != 'le32-nacl':
621 tools[H('binutils_pnacl')]['dependencies'].append(H('libcxx')) 661 tools[H('binutils_pnacl')]['dependencies'].append(H('libcxx'))
622 tools[H('llvm')]['dependencies'].append(H('libcxx')) 662 tools[H('llvm')]['dependencies'].append(H('libcxx'))
623 return tools 663 return tools
624 664
625 665
626 def TargetLibCompiler(host, options): 666 def TargetLibCompiler(host, options):
627 def H(component_name): 667 def H(component_name):
628 return GSDJoin(component_name, host) 668 return GSDJoin(component_name, host)
629 compiler = { 669 compiler = {
630 # Because target_lib_compiler is not a memoized target, its name doesn't 670 # Because target_lib_compiler is not a memoized target, its name doesn't
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 parser.add_argument('--gcc', action='store_true', default=False, 991 parser.add_argument('--gcc', action='store_true', default=False,
952 help="Use the default compiler 'cc' instead of clang") 992 help="Use the default compiler 'cc' instead of clang")
953 parser.add_argument('--sanitize', choices=['address', 'thread', 'memory', 993 parser.add_argument('--sanitize', choices=['address', 'thread', 'memory',
954 'undefined'], 994 'undefined'],
955 help="Use a sanitizer with LLVM's clang cmake build") 995 help="Use a sanitizer with LLVM's clang cmake build")
956 parser.add_argument('--testsuite-sync', action='store_true', default=False, 996 parser.add_argument('--testsuite-sync', action='store_true', default=False,
957 help=('Sync the sources for the LLVM testsuite. ' 997 help=('Sync the sources for the LLVM testsuite. '
958 'Only useful if --sync/ is also enabled')) 998 'Only useful if --sync/ is also enabled'))
959 parser.add_argument('--build-sbtc', action='store_true', default=False, 999 parser.add_argument('--build-sbtc', action='store_true', default=False,
960 help='Build the sandboxed translators') 1000 help='Build the sandboxed translators')
1001 parser.add_argument('--pnacl-in-pnacl', action='store_true', default=False,
1002 help='Build with a PNaCl toolchain')
1003 parser.add_argument('--extra-cc-args', default=None,
1004 help='Extra arguments to pass to cc/cxx')
1005 parser.add_argument('--extra-configure-arg', dest='extra_configure_args',
1006 default=[], action='append',
1007 help='Extra arguments to pass pass to host configure')
1008 parser.add_argument('--binutils-pnacl-extra-configure',
1009 default=[], action='append',
1010 help='Extra binutils-pnacl arguments '
1011 'to pass pass to host configure')
961 args, leftover_args = parser.parse_known_args() 1012 args, leftover_args = parser.parse_known_args()
962 if '-h' in leftover_args or '--help' in leftover_args: 1013 if '-h' in leftover_args or '--help' in leftover_args:
963 print 'The following arguments are specific to toolchain_build_pnacl.py:' 1014 print 'The following arguments are specific to toolchain_build_pnacl.py:'
964 parser.print_help() 1015 parser.print_help()
965 print 'The rest of the arguments are generic, in toolchain_main.py' 1016 print 'The rest of the arguments are generic, in toolchain_main.py'
966 1017
967 if args.sanitize and not args.cmake: 1018 if args.sanitize and not args.cmake:
968 print 'Use of sanitizers requires a cmake build' 1019 print 'Use of sanitizers requires a cmake build'
969 sys.exit(1) 1020 sys.exit(1)
970 1021
(...skipping 13 matching lines...) Expand all
984 leftover_args.append('--sync-only') 1035 leftover_args.append('--sync-only')
985 else: 1036 else:
986 upload_packages = GetUploadPackageTargets() 1037 upload_packages = GetUploadPackageTargets()
987 if pynacl.platform.IsWindows(): 1038 if pynacl.platform.IsWindows():
988 InstallMinGWHostCompiler() 1039 InstallMinGWHostCompiler()
989 1040
990 packages.update(HostToolsSources(GetGitSyncCmdsCallback(rev))) 1041 packages.update(HostToolsSources(GetGitSyncCmdsCallback(rev)))
991 if args.testsuite_sync: 1042 if args.testsuite_sync:
992 packages.update(TestsuiteSources(GetGitSyncCmdsCallback(rev))) 1043 packages.update(TestsuiteSources(GetGitSyncCmdsCallback(rev)))
993 1044
994 hosts = [pynacl.platform.PlatformTriple()] 1045 if args.pnacl_in_pnacl:
1046 hosts = ['le32-nacl']
1047 else:
1048 hosts = [pynacl.platform.PlatformTriple()]
995 if pynacl.platform.IsLinux() and BUILD_CROSS_MINGW: 1049 if pynacl.platform.IsLinux() and BUILD_CROSS_MINGW:
996 hosts.append(pynacl.platform.PlatformTriple('win', 'x86-32')) 1050 hosts.append(pynacl.platform.PlatformTriple('win', 'x86-32'))
997 for host in hosts: 1051 for host in hosts:
998 packages.update(HostLibs(host, args))
999 packages.update(HostTools(host, args)) 1052 packages.update(HostTools(host, args))
1000 packages.update(HostToolsDirectToNacl(host)) 1053 if not args.pnacl_in_pnacl:
1001 packages.update(TargetLibCompiler(pynacl.platform.PlatformTriple(), args)) 1054 packages.update(HostLibs(host, args))
1055 packages.update(HostToolsDirectToNacl(host, args))
1056 if not args.pnacl_in_pnacl:
1057 packages.update(TargetLibCompiler(pynacl.platform.PlatformTriple(), args))
1002 # Don't build the target libs on Windows because of pathname issues. 1058 # Don't build the target libs on Windows because of pathname issues.
1003 # Only the linux64 bot is canonical (i.e. it will upload its packages). 1059 # Only the linux64 bot is canonical (i.e. it will upload its packages).
1004 # The other bots will use a 'work' target instead of a 'build' target for 1060 # The other bots will use a 'work' target instead of a 'build' target for
1005 # the target libs, so they will not be memoized, but can be used for tests. 1061 # the target libs, so they will not be memoized, but can be used for tests.
1006 # TODO(dschuff): Even better would be if we could memoize non-canonical 1062 # TODO(dschuff): Even better would be if we could memoize non-canonical
1007 # build targets without doing things like mangling their names (and for e.g. 1063 # build targets without doing things like mangling their names (and for e.g.
1008 # scons tests, skip running them if their dependencies haven't changed, like 1064 # scons tests, skip running them if their dependencies haven't changed, like
1009 # build targets) 1065 # build targets)
1010 is_canonical = pynacl.platform.IsLinux64() 1066 is_canonical = pynacl.platform.IsLinux64()
1011 if pynacl.platform.IsLinux() or pynacl.platform.IsMac(): 1067 if ((pynacl.platform.IsLinux() or pynacl.platform.IsMac())
1068 and not args.pnacl_in_pnacl):
1012 packages.update(pnacl_targetlibs.TargetLibsSrc( 1069 packages.update(pnacl_targetlibs.TargetLibsSrc(
1013 GetGitSyncCmdsCallback(rev))) 1070 GetGitSyncCmdsCallback(rev)))
1014 for bias in BITCODE_BIASES: 1071 for bias in BITCODE_BIASES:
1015 packages.update(pnacl_targetlibs.TargetLibs(bias, is_canonical)) 1072 packages.update(pnacl_targetlibs.TargetLibs(bias, is_canonical))
1016 for arch in DIRECT_TO_NACL_ARCHES: 1073 for arch in DIRECT_TO_NACL_ARCHES:
1017 packages.update(pnacl_targetlibs.TargetLibs(arch, is_canonical)) 1074 packages.update(pnacl_targetlibs.TargetLibs(arch, is_canonical))
1018 packages.update(pnacl_targetlibs.SDKLibs(arch, is_canonical)) 1075 packages.update(pnacl_targetlibs.SDKLibs(arch, is_canonical))
1019 for arch in TRANSLATOR_ARCHES: 1076 for arch in TRANSLATOR_ARCHES:
1020 packages.update(pnacl_targetlibs.TranslatorLibs(arch, is_canonical)) 1077 packages.update(pnacl_targetlibs.TranslatorLibs(arch, is_canonical))
1021 packages.update(Metadata(rev, is_canonical)) 1078 packages.update(Metadata(rev, is_canonical))
1022 packages.update(pnacl_targetlibs.SDKCompiler( 1079 packages.update(pnacl_targetlibs.SDKCompiler(
1023 ['le32'] + DIRECT_TO_NACL_ARCHES)) 1080 ['le32'] + DIRECT_TO_NACL_ARCHES))
1024 packages.update(pnacl_targetlibs.SDKLibs('le32', is_canonical)) 1081 packages.update(pnacl_targetlibs.SDKLibs('le32', is_canonical))
1025 if pynacl.platform.IsLinux() or pynacl.platform.IsMac():
1026 unsandboxed_irt_canonical = is_canonical or pynacl.platform.IsMac() 1082 unsandboxed_irt_canonical = is_canonical or pynacl.platform.IsMac()
1027 packages.update(pnacl_targetlibs.UnsandboxedIRT( 1083 packages.update(pnacl_targetlibs.UnsandboxedIRT(
1028 'x86-32-%s' % pynacl.platform.GetOS(), unsandboxed_irt_canonical)) 1084 'x86-32-%s' % pynacl.platform.GetOS(), unsandboxed_irt_canonical))
1029 1085
1030 if args.build_sbtc: 1086 if args.build_sbtc and not args.pnacl_in_pnacl:
1031 packages.update(pnacl_sandboxed_translator.SandboxedTranslators( 1087 packages.update(pnacl_sandboxed_translator.SandboxedTranslators(
1032 SANDBOXED_TRANSLATOR_ARCHES)) 1088 SANDBOXED_TRANSLATOR_ARCHES))
1033 1089
1034 tb = toolchain_main.PackageBuilder(packages, 1090 tb = toolchain_main.PackageBuilder(packages,
1035 upload_packages, 1091 upload_packages,
1036 leftover_args) 1092 leftover_args)
1037 tb.Main() 1093 tb.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698