• Home
  • Raw
  • Download

Lines Matching +full:ninja +full:- +full:win

3 # Use of this source code is governed by a BSD-style license that can be
27 # Do NOT CHANGE this if you don't know what you're doing -- see
40 PACKAGE_VERSION = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION)
48 LLVM_BOOTSTRAP_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-bootstrap')
50 'llvm-bootstrap-install')
52 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build',
55 COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, 'compiler-rt')
58 # compiler-rt is built as part of the regular LLVM build on Windows to get
59 # the 64-bit runtime, and out-of-tree elsewhere.
62 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt')
64 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'compiler-rt')
68 os.path.join(LLVM_DIR, '..', 'llvm-build-tools'))
70 os.path.join(LLVM_DIR, '..', 'llvm-build', 'cr_build_revision'))
75 # URL for pre-built binaries.
77 'https://commondatastorage.googleapis.com/chromium-browser-clang')
79 LLVM_REPO_URL='https://llvm.org/svn/llvm-project'
97 total_size = int(response.info().getheader('Content-Length').strip())
107 sys.stdout.write('.' * (num_dots - dots_printed))
120 num_retries -= 1
177 # Subversion can leave read-only files around.
209 # Popen(['/bin/sh', '-c', args[0], args[1], ...])"
215 # Windows follow-on args are passed to args[0] instead of the shell, don't
216 # do the single-string transformation there.
246 command = ['svn', 'checkout', '--force', url + '@' + CLANG_REVISION, dir]
270 Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR)
272 # clang needs a libc++ checkout, else -stdlib=libc++ won't find includes
281 OLD_SHIM_DIR = os.path.join(LLVM_DIR, 'tools', 'zzz-chrometools')
293 Note that the shim directory name intentionally has no - or _. The implicit
295 assert not any(i in os.path.basename(CHROME_TOOLS_SHIM_DIR) for i in '-_')
314 svn_ver = 'svn-1.6.6-win'
327 zip_name = 'cmake-3.12.1-win32-x86.zip'
328 dir_name = ['cmake-3.12.1-win32-x86', 'bin']
330 zip_name = 'cmake-3.12.1-Darwin-x86_64.tar.gz'
331 dir_name = ['cmake-3.12.1-Darwin-x86_64', 'CMake.app', 'Contents', 'bin']
333 zip_name = 'cmake-3.12.1-Linux-x86_64.tar.gz'
334 dir_name = ['cmake-3.12.1-Linux-x86_64', 'bin']
343 """Download some GNU win tools and add them to PATH."""
351 print 'GNU Win tools already up to date.'
353 zip_name = 'gnuwin-%s.zip' % GNUWIN_VERSION
363 """Get the location of the current SDK. Sets dia_dll as a side-effect."""
400 # This script always wants to use the 64-bit msdia*.dll.
406 """Checks that `clang --version` outputs VERSION. If this fails, VERSION
407 in this file is out-of-date and needs to be updated (possibly in an
411 # TODO: Parse `clang-cl /?` output for built clang's version and check that
412 # to check the binary we're actually shipping? But clang-cl.exe is just
415 version_out = subprocess.check_output([clang, '--version'])
416 version_out = re.match(r'clang version ([0-9.]+)', version_out).group(1)
425 return CDS_URL + '/Win/'
433 cds_file = "clang-%s.tgz" % PACKAGE_VERSION
442 print 'Use --force-local-build if you want to build locally.'
448 # Read target_os from .gclient so we know which non-native runtimes we need.
471 if 'win' in target_os:
480 print 'The Android NDK is needed to build a Clang whose -fsanitize=address'
482 print 'https://www.chromium.org/developers/how-tos/android-build-instructions'
483 print 'for how to install the NDK, or pass --without-android.'
513 base_cmake_args = ['-GNinja',
514 '-DCMAKE_BUILD_TYPE=Release',
515 '-DLLVM_ENABLE_ASSERTIONS=ON',
516 '-DLLVM_ENABLE_TERMINFO=OFF',
518 '-DLLVM_USE_CRT_RELEASE=MT',
522 # libxml2 is required by the Win manifest merging tool used in cross-builds.
523 base_cmake_args.append('-DLLVM_ENABLE_LIBXML2=FORCE_ON')
530 '-DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64',
531 '-DCMAKE_INSTALL_PREFIX=' + LLVM_BOOTSTRAP_INSTALL_DIR,
532 '-DCMAKE_C_FLAGS=' + ' '.join(cflags),
533 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags),
535 if cc is not None: bootstrap_args.append('-DCMAKE_C_COMPILER=' + cc)
536 if cxx is not None: bootstrap_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
539 RunCommand(['ninja'], msvc_arch='x64')
543 RunCommand(['ninja', 'check-all'], msvc_arch='x64')
544 RunCommand(['ninja', 'install'], msvc_arch='x64')
547 cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe')
548 cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe')
567 # Xcode's clang automatically sets a sysroot, self-built clangs don't.
568 cflags = ['-isysroot', subprocess.check_output(
569 ['xcrun', '--show-sdk-path']).rstrip()]
570 cxxflags = ['-stdlib=libc++'] + cflags
571 ldflags += ['-stdlib=libc++']
582 cflags += ['-DLLVM_FORCE_HEAD_REVISION']
583 cxxflags += ['-DLLVM_FORCE_HEAD_REVISION']
587 # Also disable stack cookies (/GS-) for performance.
589 cflags += ['/Zi', '/GS-']
590 cxxflags += ['/Zi', '/GS-']
600 tools_with_threading = [ 'lld', 'llvm-cov', 'llvm-profdata' ]
610 '-DCMAKE_C_FLAGS=' + ' '.join(cflags),
611 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags),
612 '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(ldflags),
613 '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(ldflags),
614 '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(ldflags)]
616 threads_enabled_cmake_args.append('-DCMAKE_C_COMPILER=' + cc)
618 threads_enabled_cmake_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
626 # GNU ar and ranlib don't understand bitcode files, but llvm-ar and
627 # llvm-ranlib do, so use them.
628 ar = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'llvm-ar')
629 ranlib = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'llvm-ranlib')
631 '-DCMAKE_AR=' + ar,
632 '-DCMAKE_RANLIB=' + ranlib,
633 '-DLLVM_ENABLE_LTO=thin',
634 '-DLLVM_USE_LINKER=lld']
639 RunCommand(['ninja'] + tools_with_threading, msvc_arch='x64')
646 # compiler-rt can build with clang-cl on Windows (http://llvm.org/PR23698)
648 if cc is not None: cc_args.append('-DCMAKE_C_COMPILER=' + cc)
649 if cxx is not None: cc_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
653 '-DLLVM_ENABLE_THREADS=OFF',
654 '-DCMAKE_C_FLAGS=' + ' '.join(cflags),
655 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags),
656 '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(ldflags),
657 '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(ldflags),
658 '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(ldflags),
659 '-DCMAKE_INSTALL_PREFIX=' + LLVM_BUILD_DIR,
660 '-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'),
661 '-DCHROMIUM_TOOLS=%s' % ';'.join(chrome_tools)]
668 RunCommand(['ninja'], msvc_arch='x64')
672 CopyFile(os.path.join(THREADS_ENABLED_BUILD_DIR, 'bin', 'lld-link.exe'),
683 RunCommand(['ninja', 'cr-install'], msvc_arch='x64')
687 # Do an out-of-tree build of compiler-rt.
688 # On Windows, this is used to get the 32-bit ASan run-time.
690 # On Mac and Linux, this is used to get the regular 64-bit run-time.
696 # TODO(thakis): Add this once compiler-rt can build with clang-cl (see
699 # The bootstrap compiler produces 64-bit binaries by default.
700 #cflags += ['-m32']
701 #cxxflags += ['-m32']
703 '-DLLVM_ENABLE_THREADS=OFF',
704 '-DCMAKE_C_FLAGS=' + ' '.join(cflags),
705 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags)]
707 compiler_rt_args += ['-DCOMPILER_RT_ENABLE_IOS=ON']
709 compiler_rt_args += ['-DLLVM_CONFIG_PATH=' +
710 os.path.join(LLVM_BUILD_DIR, 'bin', 'llvm-config'),
711 '-DSANITIZER_MIN_OSX_VERSION="10.7"']
712 # compiler-rt is part of the llvm checkout on Windows but a stand-alone
718 RunCommand(['ninja', 'compiler-rt'], msvc_arch='x86')
720 RunCommand(['ninja', 'fuzzer'])
734 # TODO(thakis): This too is due to compiler-rt being part of the checkout
757 subprocess.call(['install_name_tool', '-id',
766 LLVM_BUILD_DIR, 'android-toolchain-' + target_arch)
770 '--api=' + api_level,
771 '--force',
772 '--install-dir=%s' % toolchain_dir,
773 '--stl=libc++',
774 '--arch=' + {
780 # Build compiler-rt runtimes needed for Android in a separate build tree.
781 build_dir = os.path.join(LLVM_BUILD_DIR, 'android-' + target_arch)
790 target_triple += '-linux-android' + api_level
791 cflags = ['--target=%s' % target_triple,
792 '--sysroot=%s/sysroot' % toolchain_dir,
793 '-B%s' % toolchain_dir]
795 '-DLLVM_ENABLE_THREADS=OFF',
796 '-DCMAKE_C_COMPILER=' + os.path.join(LLVM_BUILD_DIR, 'bin/clang'),
797 '-DCMAKE_CXX_COMPILER=' + os.path.join(LLVM_BUILD_DIR, 'bin/clang++'),
798 '-DLLVM_CONFIG_PATH=' + os.path.join(LLVM_BUILD_DIR, 'bin/llvm-config'),
799 '-DCMAKE_C_FLAGS=' + ' '.join(cflags),
800 '-DCMAKE_CXX_FLAGS=' + ' '.join(cflags),
801 '-DSANITIZER_CXX_ABI=none',
802 '-DSANITIZER_CXX_ABI_LIBRARY=' + abi_libs,
803 '-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-u__cxa_demangle',
804 '-DANDROID=1']
807 RunCommand(['ninja', 'asan', 'ubsan', 'profile'])
810 asan_lib_path_format = 'lib/linux/libclang_rt.asan-{0}-android.so'
813 'lib/linux/libclang_rt.ubsan_standalone-{0}-android.so',
814 'lib/linux/libclang_rt.profile-{0}-android.a',
830 RunCommand(['ninja', 'cr-check-all'], msvc_arch='x64')
835 RunCommand(['ninja', 'check-all'], msvc_arch='x64')
844 parser.add_argument('--bootstrap', action='store_true',
846 # TODO(phajdan.jr): remove --if-needed after fixing callers. It's no-op.
847 parser.add_argument('--if-needed', action='store_true',
849 parser.add_argument('--force-local-build', action='store_true',
851 parser.add_argument('--gcc-toolchain', help='set the version for which gcc '
852 'version be used for building; --gcc-toolchain=/opt/foo '
854 parser.add_argument('--lto-lld', action='store_true',
856 parser.add_argument('--llvm-force-head-revision', action='store_true',
859 parser.add_argument('--print-revision', action='store_true',
861 parser.add_argument('--print-clang-version', action='store_true',
863 parser.add_argument('--run-tests', action='store_true',
865 parser.add_argument('--skip-build', action='store_true',
867 parser.add_argument('--skip-checkout', action='store_true',
869 parser.add_argument('--extra-tools', nargs='*', default=[],
871 parser.add_argument('--use-system-cmake', action='store_true',
874 parser.add_argument('--verify-version',
875 help='verify that clang has the passed-in version')
876 parser.add_argument('--without-android', action='store_false',
883 print '--lto-lld requires --bootstrap'
886 print '--lto-lld is only effective on Linux. Ignoring the option.'
900 print 'VERSION is %s but --verify-version argument was %s, exiting.' % (
918 # Do this only after --print-revision has been handled, else we'll get
926 PACKAGE_VERSION = CLANG_REVISION + '-0'