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

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: fix Created 5 years, 11 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):
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
166 native = pynacl.platform.PlatformTriple() 178 native = pynacl.platform.PlatformTriple()
167 is_cross = host != native 179 is_cross = host != native
168 if is_cross: 180 if is_cross:
169 if (pynacl.platform.IsLinux64() and 181 if (pynacl.platform.IsLinux64() and
170 fnmatch.fnmatch(host, '*-linux*')): 182 fnmatch.fnmatch(host, '*-linux*')):
171 # 64 bit linux can build 32 bit linux binaries while still being a native 183 # 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 184 # 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. 185 # use --build to force it and make sure things build correctly.
174 configure_args.append('--build=' + host) 186 configure_args.append('--build=' + host)
175 else: 187 else:
176 configure_args.append('--host=' + host) 188 configure_args.append('--host=' + host)
177 if TripleIsLinux(host) and not TripleIsX8664(host): 189 if TripleIsLinux(host) and not TripleIsX8664(host):
178 # Chrome clang defaults to 64-bit builds, even when run on 32-bit Linux. 190 # Chrome clang defaults to 64-bit builds, even when run on 32-bit Linux.
179 extra_cc_args = ['-m32'] 191 extra_cc_args = ['-m32']
180 192
193 if host == 'le32-nacl':
194 # Some code in llvm uses intrisics not supported in the pnacl stable
195 # abi.
196 extra_cc_args += ['--pnacl-disable-abi-check']
197
198 nacl_sdk = os.environ.get('NACL_SDK_ROOT')
199 assert nacl_sdk, 'NACL_SDK_ROOT not set'
200 linux_pnacl = os.path.join(nacl_sdk, 'toolchain/linux_pnacl')
201 usr_local = os.path.join(linux_pnacl, 'le32-nacl/usr')
202 extra_cc_args += ['-Dmain=nacl_main']
203 extra_cc_args += ['-include', 'nacl_main.h']
204 extra_cc_args += ['-include', 'spawn.h']
205 extra_cc_args += ['-I', os.path.join(usr_local, 'include', 'glibc-compat')]
206 extra_cc_args += ['-I', os.path.join(nacl_sdk, 'include')]
207 extra_cc_args += ['-I', os.path.join(usr_local, 'include')]
208 extra_cc_args += ['-L' + os.path.join(nacl_sdk, 'lib', 'pnacl', 'Release')]
209 extra_cc_args += ['-L' + os.path.join(linux_pnacl, 'sdk/lib')]
210 extra_cc_args += [
211 '-Wl,--undefined=PSUserCreateInstance',
212 '-Wl,--undefined=nacl_main',
213 '-Wl,--undefined=waitpid',
214 '-Wl,--undefined=spawnve',
215 '-Wl,--undefined=LLVMgold_onload',
216 '-lcli_main', '-pthread']
217 extra_cc_args += [
218 '-lppapi_simple', '-lnacl_spawn',
219 '-lnacl_io', '-lppapi_cpp', '-lppapi', '-lc++', '-lm', '-lglibc-compat']
220
181 extra_cxx_args = list(extra_cc_args) 221 extra_cxx_args = list(extra_cc_args)
Derek Schuff 2015/01/24 00:15:37 is there some particular reason why all the linker
bradn 2015/01/25 07:42:35 After a good bit of experimentation, it seems the
182 222
183 if not options.gcc: 223 if not options.gcc:
184 cc, cxx = CompilersForHost(host) 224 cc, cxx, ar, ranlib = CompilersForHost(host)
185 225
186 configure_args.append('CC=' + ' '.join([cc] + extra_cc_args)) 226 configure_args.append('CC=' + ' '.join([cc] + extra_cc_args))
187 configure_args.append('CXX=' + ' '.join([cxx] + extra_cxx_args)) 227 configure_args.append('CXX=' + ' '.join([cxx] + extra_cxx_args))
228 configure_args.append('AR=' + ar)
229 configure_args.append('RANLIB=' + ranlib)
188 230
189 if TripleIsWindows(host): 231 if TripleIsWindows(host):
190 # The i18n support brings in runtime dependencies on MinGW DLLs 232 # The i18n support brings in runtime dependencies on MinGW DLLs
191 # that we don't want to have to distribute alongside our binaries. 233 # 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. 234 # So just disable it, and compiler messages will always be in US English.
193 configure_args.append('--disable-nls') 235 configure_args.append('--disable-nls')
194 configure_args.extend(['LDFLAGS=-L%(abs_libdl)s -ldl', 236 configure_args.extend(['LDFLAGS=-L%(abs_libdl)s -ldl',
195 'CFLAGS=-isystem %(abs_libdl)s', 237 'CFLAGS=-isystem %(abs_libdl)s',
196 'CXXFLAGS=-isystem %(abs_libdl)s']) 238 'CXXFLAGS=-isystem %(abs_libdl)s'])
197 if is_cross: 239 if is_cross:
198 # LLVM's linux->mingw cross build needs this 240 # LLVM's linux->mingw cross build needs this
199 configure_args.append('CC_FOR_BUILD=gcc') 241 configure_args.append('CC_FOR_BUILD=gcc')
242 elif host == 'le32-nacl':
243 configure_args.append('--disable-compiler-version-checks')
244 configure_args.append('ac_cv_func_vfork_works=no')
245 configure_args.append('--with-gold-ldadd=' + ' '.join(extra_cflags))
200 else: 246 else:
201 if TripleIsMac(host): 247 if TripleIsMac(host):
202 # This is required for building with recent libc++ against OSX 10.6 248 # This is required for building with recent libc++ against OSX 10.6
203 extra_cflags.append('-U__STRICT_ANSI__') 249 extra_cflags.append('-U__STRICT_ANSI__')
204 if options.gcc: 250 if options.gcc:
205 configure_args.extend(['CFLAGS=' + ' '.join(extra_cflags), 251 configure_args.extend(['CFLAGS=' + ' '.join(extra_cflags),
206 'CXXFLAGS=' + ' '.join(extra_cflags)]) 252 'CXXFLAGS=' + ' '.join(extra_cflags)])
207 else: 253 else:
208 configure_args.extend( 254 configure_args.extend(
209 ['CFLAGS=' + ' '.join(extra_cflags), 255 ['CFLAGS=' + ' '.join(extra_cflags),
210 'LDFLAGS=-L%(' + GSDJoin('abs_libcxx', host) + ')s/lib', 256 'LDFLAGS=-L%(' + GSDJoin('abs_libcxx', host) + ')s/lib',
211 'CXXFLAGS=-stdlib=libc++ -I%(' + GSDJoin('abs_libcxx', host) + 257 'CXXFLAGS=-stdlib=libc++ -I%(' + GSDJoin('abs_libcxx', host) +
212 ')s/include/c++/v1 ' + ' '.join(extra_cflags)]) 258 ')s/include/c++/v1 ' + ' '.join(extra_cflags)])
213 259
214 return configure_args 260 return configure_args
215 261
216 262
217 def LibCxxHostArchFlags(host): 263 def LibCxxHostArchFlags(host):
218 cc, cxx = CompilersForHost(host) 264 cc, cxx, _, _ = CompilersForHost(host)
219 cmake_flags = [] 265 cmake_flags = []
220 cmake_flags.extend(['-DCMAKE_C_COMPILER='+cc, '-DCMAKE_CXX_COMPILER='+cxx]) 266 cmake_flags.extend(['-DCMAKE_C_COMPILER='+cc, '-DCMAKE_CXX_COMPILER='+cxx])
221 if TripleIsLinux(host) and not TripleIsX8664(host): 267 if TripleIsLinux(host) and not TripleIsX8664(host):
222 # Chrome clang defaults to 64-bit builds, even when run on 32-bit Linux 268 # Chrome clang defaults to 64-bit builds, even when run on 32-bit Linux
223 cmake_flags.extend(['-DCMAKE_C_FLAGS=-m32', 269 cmake_flags.extend(['-DCMAKE_C_FLAGS=-m32',
224 '-DCMAKE_CXX_FLAGS=-m32']) 270 '-DCMAKE_CXX_FLAGS=-m32'])
225 return cmake_flags 271 return cmake_flags
226 272
227 def CmakeHostArchFlags(host, options): 273 def CmakeHostArchFlags(host, options):
228 """ Set flags passed to LLVM cmake for compilers and compile flags. """ 274 """ Set flags passed to LLVM cmake for compilers and compile flags. """
229 cmake_flags = [] 275 cmake_flags = []
230 cc, cxx = CompilersForHost(host) 276 cc, cxx, _, _ = CompilersForHost(host)
231 277
232 cmake_flags.extend(['-DCMAKE_C_COMPILER='+cc, '-DCMAKE_CXX_COMPILER='+cxx]) 278 cmake_flags.extend(['-DCMAKE_C_COMPILER='+cc, '-DCMAKE_CXX_COMPILER='+cxx])
233 279
234 # There seems to be a bug in chrome clang where it exposes the msan interface 280 # 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 281 # (even when compiling without msan) but then does not link with an
236 # msan-enabled compiler_rt, leaving references to __msan_allocated_memory 282 # msan-enabled compiler_rt, leaving references to __msan_allocated_memory
237 # undefined. 283 # undefined.
238 cmake_flags.append('-DHAVE_SANITIZER_MSAN_INTERFACE_H=FALSE') 284 cmake_flags.append('-DHAVE_SANITIZER_MSAN_INTERFACE_H=FALSE')
239 285
240 if options.sanitize: 286 if options.sanitize:
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 if TripleIsLinux(host): 430 if TripleIsLinux(host):
385 libname = 'libc++.so.1' 431 libname = 'libc++.so.1'
386 elif TripleIsMac(host): 432 elif TripleIsMac(host):
387 libname = 'libc++.1.dylib' 433 libname = 'libc++.1.dylib'
388 else: 434 else:
389 return [] 435 return []
390 return [command.Mkdir(dest, parents=True), 436 return [command.Mkdir(dest, parents=True),
391 command.Copy('%(' + GSDJoin('abs_libcxx', host) +')s/lib/' + libname, 437 command.Copy('%(' + GSDJoin('abs_libcxx', host) +')s/lib/' + libname,
392 os.path.join(dest, libname))] 438 os.path.join(dest, libname))]
393 439
394 def CreateSymLinksToDirectToNaClTools(): 440 def CreateSymLinksToDirectToNaClTools(host):
441 if host == 'le32-nacl':
442 return []
395 return ( 443 return (
396 [command.Command(['ln', '-f', 444 [command.Command(['ln', '-f',
397 command.path.join('%(output)s', 'bin','clang'), 445 command.path.join('%(output)s', 'bin','clang'),
398 command.path.join('%(output)s', 'bin', 446 command.path.join('%(output)s', 'bin',
399 arch + '-nacl-clang')]) 447 arch + '-nacl-clang')])
400 for arch in DIRECT_TO_NACL_ARCHES] + 448 for arch in DIRECT_TO_NACL_ARCHES] +
401 [command.Command(['ln', '-f', 449 [command.Command(['ln', '-f',
402 command.path.join('%(output)s', 'bin','clang'), 450 command.path.join('%(output)s', 'bin','clang'),
403 command.path.join('%(output)s', 'bin', 451 command.path.join('%(output)s', 'bin',
404 arch + '-nacl-clang++')]) 452 arch + '-nacl-clang++')])
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 def HostTools(host, options): 511 def HostTools(host, options):
464 def H(component_name): 512 def H(component_name):
465 # Return a package name for a component name with a host triple. 513 # Return a package name for a component name with a host triple.
466 return GSDJoin(component_name, host) 514 return GSDJoin(component_name, host)
467 # Return the file name with the appropriate suffix for an executable file. 515 # Return the file name with the appropriate suffix for an executable file.
468 def Exe(file): 516 def Exe(file):
469 if TripleIsWindows(host): 517 if TripleIsWindows(host):
470 return file + '.exe' 518 return file + '.exe'
471 else: 519 else:
472 return file 520 return file
521
522 werror = []
523 static_llvm_plugin = []
524 static_llvm_deps = []
525 if host == 'le32-nacl':
526 werror = ['--enable-werror=no']
527 static_llvm_deps = ['llvm_le32_nacl']
Derek Schuff 2015/01/24 00:15:37 this can be H('llvm')
bradn 2015/01/25 07:42:35 Done.
528 static_llvm_plugin = [
529 '-L%(abs_top_srcdir)s/toolchain_build/'
530 'out/llvm_le32_nacl_work/Release+Asserts/lib',
531 '-Wl,--start-group',
532 '-lLLVMgold', '-lLLVMCodeGen', '-lLTO', '-lLLVMX86Disassembler',
Derek Schuff 2015/01/24 00:15:37 It occurs to be that we could make our le32 clang
bradn 2015/01/25 07:42:36 Agreed, though I'm torn as I have longer term ambi
533 '-lLLVMX86AsmParser', '-lLLVMX86CodeGen', '-lLLVMX86Desc',
534 '-lLLVMX86Info', '-lLLVMX86AsmPrinter', '-lLLVMX86Utils',
535 '-lLLVMARMDisassembler', '-lLLVMARMCodeGen', '-lLLVMNaClTransforms',
536 '-lLLVMARMAsmParser', '-lLLVMARMDesc', '-lLLVMARMInfo',
537 '-lLLVMARMAsmPrinter', '-lLLVMMipsDisassembler', '-lLLVMMipsCodeGen',
538 '-lLLVMSelectionDAG', '-lLLVMAsmPrinter', '-lLLVMCodeGen',
539 '-lLLVMMipsAsmParser', '-lLLVMMipsDesc', '-lLLVMMipsInfo',
540 '-lLLVMMipsAsmPrinter', '-lLLVMMCDisassembler', '-lLLVMLTO',
541 '-lLLVMMCParser', '-lLLVMLinker', '-lLLVMipo', '-lLLVMObjCARCOpts',
542 '-lLLVMVectorize', '-lLLVMScalarOpts', '-lLLVMInstCombine',
543 '-lLLVMTransformUtils', '-lLLVMipa', '-lLLVMBitWriter',
544 '-lLLVMBitReader', '-lLLVMAnalysis', '-lLLVMTarget', '-lLLVMMC',
545 '-lLLVMObject', '-lLLVMCore', '-lLLVMSupport',
546 '-Wl,--end-group',
547 ]
548
473 # Binutils still has some warnings when building with clang 549 # Binutils still has some warnings when building with clang
474 if not options.gcc: 550 if not options.gcc:
475 warning_flags = ['-Wno-extended-offsetof', '-Wno-absolute-value', 551 warning_flags = ['-Wno-extended-offsetof', '-Wno-absolute-value',
476 '-Wno-unused-function', '-Wno-unused-const-variable', 552 '-Wno-unused-function', '-Wno-unused-const-variable',
477 '-Wno-unneeded-internal-declaration', 553 '-Wno-unneeded-internal-declaration',
478 '-Wno-unused-private-field', '-Wno-format-security'] 554 '-Wno-unused-private-field', '-Wno-format-security']
555 if host == 'le32-nacl':
556 warning_flags += ['-Wno-invalid-noreturn']
479 else: 557 else:
480 warning_flags = ['-Wno-unused-function', '-Wno-unused-value'] 558 warning_flags = ['-Wno-unused-function', '-Wno-unused-value']
559
481 tools = { 560 tools = {
482 # The binutils_pnacl package is used both for bitcode linking (gold) and 561 # The binutils_pnacl package is used both for bitcode linking (gold) and
483 # for its conventional use with arm-nacl-clang. 562 # for its conventional use with arm-nacl-clang.
484 H('binutils_pnacl'): { 563 H('binutils_pnacl'): {
485 'dependencies': ['binutils_pnacl_src'], 564 'dependencies': ['binutils_pnacl_src'] + static_llvm_deps,
486 'type': 'build', 565 'type': 'build',
487 'inputs' : { 'macros': os.path.join(NACL_DIR, 566 'inputs' : { 'macros': os.path.join(NACL_DIR,
488 'pnacl', 'support', 'clang_direct', 'nacl-arm-macros.s')}, 567 'pnacl', 'support', 'clang_direct', 'nacl-arm-macros.s')},
489 'commands': [ 568 'commands': [
490 command.SkipForIncrementalCommand([ 569 command.SkipForIncrementalCommand([
491 'sh', 570 'sh',
492 '%(binutils_pnacl_src)s/configure'] + 571 '%(binutils_pnacl_src)s/configure'] +
493 ConfigureBinutilsCommon() + 572 ConfigureBinutilsCommon() +
494 ConfigureHostArchFlags(host, warning_flags, options) + 573 ConfigureHostArchFlags( host, warning_flags +
574 static_llvm_plugin, options) +
495 ['--target=arm-nacl', 575 ['--target=arm-nacl',
496 '--program-prefix=le32-nacl-', 576 '--program-prefix=le32-nacl-',
497 '--enable-targets=arm-nacl,i686-nacl,x86_64-nacl,' + 577 '--enable-targets=arm-nacl,i686-nacl,x86_64-nacl,' +
498 'mipsel-nacl', 578 'mipsel-nacl',
499 '--enable-shared=no', 579 '--enable-shared=no',
500 '--enable-gold=default', 580 '--enable-gold=default',
501 '--enable-plugins', 581 '--enable-plugins',
502 '--without-gas', 582 '--without-gas',
503 '--with-sysroot=/le32-nacl']), 583 '--with-sysroot=/le32-nacl'] + werror),
504 command.Command(MakeCommand(host)), 584 command.Command(MakeCommand(host)),
505 command.Command(MAKE_DESTDIR_CMD + ['install-strip'])] + 585 command.Command(MAKE_DESTDIR_CMD + ['install-strip'])] +
506 [command.RemoveDirectory(os.path.join('%(output)s', dir)) 586 [command.RemoveDirectory(os.path.join('%(output)s', dir))
507 for dir in ('lib', 'lib32')] + 587 for dir in ('lib', 'lib32')] +
508 # Since it has dual use, just create links for both sets of names 588 # Since it has dual use, just create links for both sets of names
509 # (i.e. le32-nacl-foo and arm-nacl-foo) 589 # (i.e. le32-nacl-foo and arm-nacl-foo)
510 # TODO(dschuff): Use the redirector scripts here like binutils_x86 590 # TODO(dschuff): Use the redirector scripts here like binutils_x86
511 [command.Command([ 591 [command.Command([
512 'ln', '-f', 592 'ln', '-f',
513 command.path.join('%(output)s', 'bin', 'le32-nacl-' + tool), 593 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', 638 '-DLLVM_ENABLE_ASSERTIONS=ON',
559 '-DLLVM_ENABLE_ZLIB=OFF', 639 '-DLLVM_ENABLE_ZLIB=OFF',
560 '-DLLVM_BUILD_TESTS=ON', 640 '-DLLVM_BUILD_TESTS=ON',
561 '-DLLVM_APPEND_VC_REV=ON', 641 '-DLLVM_APPEND_VC_REV=ON',
562 '-DLLVM_BINUTILS_INCDIR=%(abs_binutils_pnacl_src)s/include', 642 '-DLLVM_BINUTILS_INCDIR=%(abs_binutils_pnacl_src)s/include',
563 '-DLLVM_EXTERNAL_CLANG_SOURCE_DIR=%(clang_src)s', 643 '-DLLVM_EXTERNAL_CLANG_SOURCE_DIR=%(clang_src)s',
564 '%(llvm_src)s']), 644 '%(llvm_src)s']),
565 command.Command(['ninja', '-v']), 645 command.Command(['ninja', '-v']),
566 command.Command(['ninja', 'install']), 646 command.Command(['ninja', 'install']),
567 ] + 647 ] +
568 CreateSymLinksToDirectToNaClTools() 648 CreateSymLinksToDirectToNaClTools(host)
569 }, 649 },
570 } 650 }
651 if host == 'le32-nacl':
652 shared = []
653 else:
654 shared = ['--enable-shared']
571 llvm_autoconf = { 655 llvm_autoconf = {
572 H('llvm'): { 656 H('llvm'): {
573 'dependencies': ['clang_src', 'llvm_src', 'binutils_pnacl_src', 657 'dependencies': ['clang_src', 'llvm_src', 'binutils_pnacl_src',
574 'subzero_src'], 658 'subzero_src'],
575 'type': 'build', 659 'type': 'build',
576 'commands': [ 660 'commands': [
577 command.SkipForIncrementalCommand([ 661 command.SkipForIncrementalCommand([
578 'sh', 662 'sh',
579 '%(llvm_src)s/configure'] + 663 '%(llvm_src)s/configure'] +
580 ConfigureHostArchFlags(host, [], options) + 664 ConfigureHostArchFlags(host, [], options) +
581 LLVMConfigureAssertionsFlags(options) + 665 LLVMConfigureAssertionsFlags(options) +
582 ['--prefix=/', 666 ['--prefix=/',
583 '--enable-shared',
584 '--disable-zlib', 667 '--disable-zlib',
585 '--disable-terminfo', 668 '--disable-terminfo',
586 '--disable-jit', 669 '--disable-jit',
587 '--disable-bindings', # ocaml is currently the only binding. 670 '--disable-bindings', # ocaml is currently the only binding.
588 '--with-binutils-include=%(abs_binutils_pnacl_src)s/include', 671 '--with-binutils-include=%(abs_binutils_pnacl_src)s/include',
589 '--enable-targets=x86,arm,mips', 672 '--enable-targets=x86,arm,mips',
590 '--program-prefix=', 673 '--program-prefix=',
591 '--enable-optimized', 674 '--enable-optimized',
592 '--with-clang-srcdir=%(abs_clang_src)s'])] + 675 '--with-clang-srcdir=%(abs_clang_src)s'] + shared)] +
593 CopyHostLibcxxForLLVMBuild( 676 CopyHostLibcxxForLLVMBuild(
594 host, 677 host,
595 os.path.join('Release+Asserts', 'lib'), 678 os.path.join('Release+Asserts', 'lib'),
596 options) + 679 options) +
597 [command.Command(MakeCommand(host) + [ 680 [command.Command(MakeCommand(host) + [
598 'VERBOSE=1', 681 'VERBOSE=1',
599 'NACL_SANDBOX=0', 682 'NACL_SANDBOX=0',
683 'PNACL_BROWSER_TRANSLATOR=0',
600 'SUBZERO_SRC_ROOT=%(abs_subzero_src)s', 684 'SUBZERO_SRC_ROOT=%(abs_subzero_src)s',
601 'all']), 685 'all']),
602 command.Command(MAKE_DESTDIR_CMD + ['install']), 686 command.Command(MAKE_DESTDIR_CMD + ['install']),
603 command.Remove(*[os.path.join('%(output)s', 'lib', f) for f in 687 command.Remove(*[os.path.join('%(output)s', 'lib', f) for f in
604 '*.a', '*Hello.*', 'BugpointPasses.*']), 688 '*.a', '*Hello.*', 'BugpointPasses.*']),
605 command.Remove(*[os.path.join('%(output)s', 'bin', f) for f in 689 command.Remove(*[os.path.join('%(output)s', 'bin', f) for f in
606 Exe('clang-format'), Exe('clang-check'), 690 Exe('clang-format'), Exe('clang-check'),
607 Exe('c-index-test'), Exe('clang-tblgen'), 691 Exe('c-index-test'), Exe('clang-tblgen'),
608 Exe('llvm-tblgen')])] + 692 Exe('llvm-tblgen')])] +
609 CreateSymLinksToDirectToNaClTools() + 693 CreateSymLinksToDirectToNaClTools(host) +
610 CopyWindowsHostLibs(host), 694 CopyWindowsHostLibs(host),
611 }, 695 },
612 } 696 }
613 if options.cmake: 697 if options.cmake:
614 tools.update(llvm_cmake) 698 tools.update(llvm_cmake)
615 else: 699 else:
616 tools.update(llvm_autoconf) 700 tools.update(llvm_autoconf)
617 if TripleIsWindows(host): 701 if TripleIsWindows(host):
618 tools[H('binutils_pnacl')]['dependencies'].append('libdl') 702 tools[H('binutils_pnacl')]['dependencies'].append('libdl')
619 tools[H('llvm')]['dependencies'].append('libdl') 703 tools[H('llvm')]['dependencies'].append('libdl')
704 elif host == 'le32-nacl':
705 # PNaCl's libcxx is new enough.
706 pass
620 elif not options.gcc: 707 elif not options.gcc:
Derek Schuff 2015/01/24 00:15:37 how about elif not options.gcc and host != 'le32-n
bradn 2015/01/25 07:42:36 Done.
621 tools[H('binutils_pnacl')]['dependencies'].append(H('libcxx')) 708 tools[H('binutils_pnacl')]['dependencies'].append(H('libcxx'))
622 tools[H('llvm')]['dependencies'].append(H('libcxx')) 709 tools[H('llvm')]['dependencies'].append(H('libcxx'))
623 return tools 710 return tools
624 711
625 712
626 def TargetLibCompiler(host, options): 713 def TargetLibCompiler(host, options):
627 def H(component_name): 714 def H(component_name):
628 return GSDJoin(component_name, host) 715 return GSDJoin(component_name, host)
629 compiler = { 716 compiler = {
630 # Because target_lib_compiler is not a memoized target, its name doesn't 717 # Because target_lib_compiler is not a memoized target, its name doesn't
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 os.path.join('%(output)s', 'REV'), 758 os.path.join('%(output)s', 'REV'),
672 GIT_BASE_URL, 759 GIT_BASE_URL,
673 GIT_REPOS, 760 GIT_REPOS,
674 revisions), 761 revisions),
675 ], 762 ],
676 } 763 }
677 } 764 }
678 return data 765 return data
679 766
680 767
681 def HostToolsDirectToNacl(host): 768 def HostToolsDirectToNacl(host, options):
Derek Schuff 2015/01/24 00:15:37 is this necessary?
bradn 2015/01/25 07:42:36 Nope. dropped
682 def H(component_name): 769 def H(component_name):
683 return GSDJoin(component_name, host) 770 return GSDJoin(component_name, host)
684 771
685 tools = {} 772 tools = {}
686 773
687 if TripleIsWindows(host): 774 if TripleIsWindows(host):
688 redirector_table = '' 775 redirector_table = ''
689 for tool, args in TOOL_X64_I686_REDIRECTS: 776 for tool, args in TOOL_X64_I686_REDIRECTS:
690 redirector_table += ' {L"/bin/i686-nacl-%s.exe",' % tool + \ 777 redirector_table += ' {L"/bin/i686-nacl-%s.exe",' % tool + \
691 ' L"/bin/x86_64-nacl-%s.exe",' % tool + \ 778 ' L"/bin/x86_64-nacl-%s.exe",' % tool + \
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 else: 1072 else:
986 upload_packages = GetUploadPackageTargets() 1073 upload_packages = GetUploadPackageTargets()
987 if pynacl.platform.IsWindows(): 1074 if pynacl.platform.IsWindows():
988 InstallMinGWHostCompiler() 1075 InstallMinGWHostCompiler()
989 1076
990 packages.update(HostToolsSources(GetGitSyncCmdsCallback(rev))) 1077 packages.update(HostToolsSources(GetGitSyncCmdsCallback(rev)))
991 if args.testsuite_sync: 1078 if args.testsuite_sync:
992 packages.update(TestsuiteSources(GetGitSyncCmdsCallback(rev))) 1079 packages.update(TestsuiteSources(GetGitSyncCmdsCallback(rev)))
993 1080
994 hosts = [pynacl.platform.PlatformTriple()] 1081 hosts = [pynacl.platform.PlatformTriple()]
1082 if pynacl.platform.IsLinux64():
1083 hosts.append('le32-nacl')
Derek Schuff 2015/01/24 00:15:37 won't this cause it to be built on the toolchain b
bradn 2015/01/25 07:42:36 Changed to a separate command line option as we di
995 if pynacl.platform.IsLinux() and BUILD_CROSS_MINGW: 1084 if pynacl.platform.IsLinux() and BUILD_CROSS_MINGW:
996 hosts.append(pynacl.platform.PlatformTriple('win', 'x86-32')) 1085 hosts.append(pynacl.platform.PlatformTriple('win', 'x86-32'))
997 for host in hosts: 1086 for host in hosts:
998 packages.update(HostLibs(host, args)) 1087 packages.update(HostLibs(host, args))
999 packages.update(HostTools(host, args)) 1088 packages.update(HostTools(host, args))
1000 packages.update(HostToolsDirectToNacl(host)) 1089 packages.update(HostToolsDirectToNacl(host, args))
Derek Schuff 2015/01/24 00:15:37 is the extra flag necessary? And, are you actually
bradn 2015/01/25 07:42:36 Nope, dropped.
1001 packages.update(TargetLibCompiler(pynacl.platform.PlatformTriple(), args)) 1090 packages.update(TargetLibCompiler(pynacl.platform.PlatformTriple(), args))
1002 # Don't build the target libs on Windows because of pathname issues. 1091 # 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). 1092 # 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 1093 # 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. 1094 # 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 1095 # 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. 1096 # 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 1097 # scons tests, skip running them if their dependencies haven't changed, like
1009 # build targets) 1098 # build targets)
1010 is_canonical = pynacl.platform.IsLinux64() 1099 is_canonical = pynacl.platform.IsLinux64()
(...skipping 17 matching lines...) Expand all
1028 'x86-32-%s' % pynacl.platform.GetOS(), unsandboxed_irt_canonical)) 1117 'x86-32-%s' % pynacl.platform.GetOS(), unsandboxed_irt_canonical))
1029 1118
1030 if args.build_sbtc: 1119 if args.build_sbtc:
1031 packages.update(pnacl_sandboxed_translator.SandboxedTranslators( 1120 packages.update(pnacl_sandboxed_translator.SandboxedTranslators(
1032 SANDBOXED_TRANSLATOR_ARCHES)) 1121 SANDBOXED_TRANSLATOR_ARCHES))
1033 1122
1034 tb = toolchain_main.PackageBuilder(packages, 1123 tb = toolchain_main.PackageBuilder(packages,
1035 upload_packages, 1124 upload_packages,
1036 leftover_args) 1125 leftover_args)
1037 tb.Main() 1126 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