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

Side by Side Diff: toolchain_build/toolchain_build_pnacl.py

Issue 1586243003: [PNaCl Toolchain] Use static libc++ from Chrome toolchain on Mac (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: address comments Created 4 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 | Annotate | Revision Log
« 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 BUILD_CROSS_MINGW = False 86 BUILD_CROSS_MINGW = False
87 # Path to the mingw cross-compiler libs on Ubuntu 87 # Path to the mingw cross-compiler libs on Ubuntu
88 CROSS_MINGW_LIBPATH = '/usr/lib/gcc/i686-w64-mingw32/4.6' 88 CROSS_MINGW_LIBPATH = '/usr/lib/gcc/i686-w64-mingw32/4.6'
89 # Path and version of the native mingw compiler to be installed on Windows hosts 89 # Path and version of the native mingw compiler to be installed on Windows hosts
90 MINGW_PATH = os.path.join(NACL_DIR, 'mingw32') 90 MINGW_PATH = os.path.join(NACL_DIR, 'mingw32')
91 MINGW_VERSION = 'i686-w64-mingw32-4.8.1' 91 MINGW_VERSION = 'i686-w64-mingw32-4.8.1'
92 92
93 CHROME_CLANG = os.path.join(os.path.dirname(NACL_DIR), 'third_party', 93 CHROME_CLANG = os.path.join(os.path.dirname(NACL_DIR), 'third_party',
94 'llvm-build', 'Release+Asserts', 'bin', 'clang') 94 'llvm-build', 'Release+Asserts', 'bin', 'clang')
95 CHROME_CLANGXX = CHROME_CLANG + '++' 95 CHROME_CLANGXX = CHROME_CLANG + '++'
96 CHROME_LIBCXX_STATIC = os.path.join(os.path.dirname(NACL_DIR), 'third_party',
97 'libc++-static')
96 98
97 # Required SDK version and target version for Mac builds. 99 # Required SDK version and target version for Mac builds.
98 # See MAC_SDK_FLAGS, below. 100 # See MAC_SDK_FLAGS, below.
99 MAC_SDK_MIN = '10.10' 101 MAC_SDK_MIN = '10.10'
100 MAC_DEPLOYMENT_TARGET = '10.6' 102 MAC_DEPLOYMENT_TARGET = '10.6'
101 103
102 # Redirectors are small shims acting like sym links with optional arguments. 104 # Redirectors are small shims acting like sym links with optional arguments.
103 # For mac/linux we simply use a shell script which create small redirector 105 # For mac/linux we simply use a shell script which create small redirector
104 # shell scripts. For windows we compile an executable which redirects to 106 # shell scripts. For windows we compile an executable which redirects to
105 # the target using a compiled in table. 107 # the target using a compiled in table.
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 result['CXXFLAGS'] += ['-stdlib=libc++'] 280 result['CXXFLAGS'] += ['-stdlib=libc++']
279 if TripleIsLinux(host): 281 if TripleIsLinux(host):
280 # Use our own libc++ on Linux. 282 # Use our own libc++ on Linux.
281 # TODO(dschuff): Get the Chrome clang maintainers to build libc++ for 283 # TODO(dschuff): Get the Chrome clang maintainers to build libc++ for
282 # Linux too and use that. 284 # Linux too and use that.
283 result['CXXFLAGS'] += ['-I%(' + FlavoredName('abs_libcxx', host, opts) + 285 result['CXXFLAGS'] += ['-I%(' + FlavoredName('abs_libcxx', host, opts) +
284 ')s/include/c++/v1'] 286 ')s/include/c++/v1']
285 result['LDFLAGS'] += ['-L%(' + FlavoredName('abs_libcxx', 287 result['LDFLAGS'] += ['-L%(' + FlavoredName('abs_libcxx',
286 host, opts) + ')s/lib'] 288 host, opts) + ')s/lib']
287 deps.append(FlavoredName('libcxx', host, opts)) 289 deps.append(FlavoredName('libcxx', host, opts))
290 elif TripleIsMac(host):
291 result['LDFLAGS'] += ['-L' + CHROME_LIBCXX_STATIC]
288 292
289 result['CFLAGS'] += extra_cc_flags 293 result['CFLAGS'] += extra_cc_flags
290 result['CXXFLAGS'] += extra_cc_flags 294 result['CXXFLAGS'] += extra_cc_flags
291 295
292 return result, deps 296 return result, deps
293 297
294 298
295 def ConfigureHostArchFlags(host, extra_cflags, options, extra_configure=None, 299 def ConfigureHostArchFlags(host, extra_cflags, options, extra_configure=None,
296 use_afl_fuzz=False): 300 use_afl_fuzz=False):
297 """Return flags passed to LLVM and binutils configure for compilers and 301 """Return flags passed to LLVM and binutils configure for compilers and
(...skipping 25 matching lines...) Expand all
323 configure_args.append('--build=' + host) 327 configure_args.append('--build=' + host)
324 elif is_cross: 328 elif is_cross:
325 configure_args.append('--host=' + host) 329 configure_args.append('--host=' + host)
326 330
327 extra_cxx_args = list(extra_cc_args) 331 extra_cxx_args = list(extra_cc_args)
328 332
329 hashables = [] 333 hashables = []
330 334
331 if not options.gcc: 335 if not options.gcc:
332 cc, cxx, ar, ranlib = CompilersForHost(host) 336 cc, cxx, ar, ranlib = CompilersForHost(host)
333 hashables += [cc, cxx, ar, ranlib] 337 hashables += [cc, cxx, ar, ranlib, CHROME_LIBCXX_STATIC]
334 338
335 # Introduce afl-fuzz compiler wrappers if needed. 339 # Introduce afl-fuzz compiler wrappers if needed.
336 if use_afl_fuzz: 340 if use_afl_fuzz:
337 cc, cxx = AflFuzzCompilers(options.afl_fuzz_dir) 341 cc, cxx = AflFuzzCompilers(options.afl_fuzz_dir)
338 342
339 if ProgramPath('ccache'): 343 if ProgramPath('ccache'):
340 # Set CCACHE_CPP2 envvar, to avoid an error due to a strange 344 # Set CCACHE_CPP2 envvar, to avoid an error due to a strange
341 # ccache/clang++ interaction. Specifically, errors about 345 # ccache/clang++ interaction. Specifically, errors about
342 # "argument unused during compilation". 346 # "argument unused during compilation".
343 os.environ['CCACHE_CPP2'] = 'yes' 347 os.environ['CCACHE_CPP2'] = 'yes'
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 400
397 Returns the tuple (flags, inputs, deps) where 'flags' is a list of 401 Returns the tuple (flags, inputs, deps) where 'flags' is a list of
398 arguments to cmake, 'inputs' is a dict of extra inputs to be hashed, 402 arguments to cmake, 'inputs' is a dict of extra inputs to be hashed,
399 and 'deps' is a list of extra dependencies for a component using these flags. 403 and 'deps' is a list of extra dependencies for a component using these flags.
400 """ 404 """
401 cmake_flags = [] 405 cmake_flags = []
402 if options.afl_fuzz_dir: 406 if options.afl_fuzz_dir:
403 cc, cxx = AflFuzzCompilers(options.afl_fuzz_dir) 407 cc, cxx = AflFuzzCompilers(options.afl_fuzz_dir)
404 else: 408 else:
405 cc, cxx, _, _ = CompilersForHost(host) 409 cc, cxx, _, _ = CompilersForHost(host)
406 hashables = [cc, cxx] 410 hashables = [cc, cxx, CHROME_LIBCXX_STATIC]
407 411
408 cmake_flags.extend(['-DCMAKE_C_COMPILER='+cc, '-DCMAKE_CXX_COMPILER='+cxx]) 412 cmake_flags.extend(['-DCMAKE_C_COMPILER='+cc, '-DCMAKE_CXX_COMPILER='+cxx])
409 if ProgramPath('ccache'): 413 if ProgramPath('ccache'):
410 cmake_flags.extend(['-DSYSTEM_HAS_CCACHE=ON']) 414 cmake_flags.extend(['-DSYSTEM_HAS_CCACHE=ON'])
411 415
412 # There seems to be a bug in chrome clang where it exposes the msan interface 416 # There seems to be a bug in chrome clang where it exposes the msan interface
413 # (even when compiling without msan) but then does not link with an 417 # (even when compiling without msan) but then does not link with an
414 # msan-enabled compiler_rt, leaving references to __msan_allocated_memory 418 # msan-enabled compiler_rt, leaving references to __msan_allocated_memory
415 # undefined. 419 # undefined.
416 cmake_flags.append('-DHAVE_SANITIZER_MSAN_INTERFACE_H=FALSE') 420 cmake_flags.append('-DHAVE_SANITIZER_MSAN_INTERFACE_H=FALSE')
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 SANDBOXED_TRANSLATOR_ARCHES)) 1358 SANDBOXED_TRANSLATOR_ARCHES))
1355 1359
1356 tb = toolchain_main.PackageBuilder(packages, 1360 tb = toolchain_main.PackageBuilder(packages,
1357 upload_packages, 1361 upload_packages,
1358 leftover_args) 1362 leftover_args)
1359 return tb.Main() 1363 return tb.Main()
1360 1364
1361 1365
1362 if __name__ == '__main__': 1366 if __name__ == '__main__':
1363 sys.exit(main()) 1367 sys.exit(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