Commit 65f66f75 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

clang build script: scale back xcode stuff a bit

Hopefully still enough to have an arm64 compiler-rt while keeping the
rest of the script mostly as it was before
https://chromium-review.googlesource.com/c/chromium/src/+/2269512

Bug: 1098899
Change-Id: I67385083126d2d1e75599b0bd201e8bc9894809b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274590Reviewed-by: default avatarHans Wennborg <hans@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784023}
parent f67f4bab
......@@ -455,33 +455,8 @@ def main():
# enough GCC to build Clang.
MaybeDownloadHostGcc(args)
# mac/arm64 needs MacOSX11.0.sdk. System Xcode (+ SDK) on the chrome bots
# is something much older.
# Options:
# - temporarily set system Xcode to Xcode 12 beta while running this script,
# (cf build/swarming_xcode_install.py, but it looks unused)
# - use Xcode 12 beta for everything on tot bots, only need to fuzz with
# scripts/slave/recipes/chromium_upload_clang.py then (but now the
# chrome/ios build will use the 11.0 SDK too and we'd be on the hook for
# keeping it green -- if it's currently green, who knows)
# - pass flags to cmake to try to coax it into using Xcode 12 beta for the
# LLVM build without it being system Xcode.
#
# The last option seems best, so let's go with that. We need to pass
# -isysroot to the 11.0 SDK and -B to the /usr/bin so that the new ld64 is
# used.
if sys.platform == 'darwin':
isysroot = subprocess.check_output(['xcrun', '--show-sdk-path']).rstrip()
if sys.platform == 'darwin' and args.bootstrap:
sys.path.insert(1, os.path.join(CHROMIUM_DIR, 'build'))
import mac_toolchain
LLVM_XCODE = os.path.join(THIRD_PARTY_DIR, 'llvm-xcode')
mac_toolchain.InstallXcodeBinaries('xcode_12_beta', LLVM_XCODE)
isysroot = os.path.join(LLVM_XCODE, 'Contents', 'Developer', 'Platforms',
'MacOSX.platform', 'Developer', 'SDKs',
'MacOSX11.0.sdk')
xcode_bin = os.path.join(LLVM_XCODE, 'Contents', 'Developer', 'Toolchains',
'XcodeDefault.xctoolchain', 'usr', 'bin')
global CLANG_REVISION, PACKAGE_VERSION
if args.llvm_force_head_revision:
......@@ -748,7 +723,6 @@ def main():
'-target', 'x86_64-unknown-unknown', '-O2', '-g', '-std=c++14',
'-fno-exceptions', '-fno-rtti', '-w', '-c', training_source]
if sys.platform == 'darwin':
# TODO(thakis): Try switching tihs back to `xcrun --show-sdk-path`.
train_cmd.extend(['-stdlib=libc++', '-isysroot', isysroot])
RunCommand(train_cmd, msvc_arch='x64')
......@@ -778,14 +752,42 @@ def main():
'-DDARWIN_iossim_ARCHS=i386;x86_64',
])
if args.bootstrap:
# mac/arm64 needs MacOSX11.0.sdk. System Xcode (+ SDK) on the chrome bots
# is something much older.
# Options:
# - temporarily set system Xcode to Xcode 12 beta while running this
# script, (cf build/swarming_xcode_install.py, but it looks unused)
# - use Xcode 12 beta for everything on tot bots, only need to fuzz with
# scripts/slave/recipes/chromium_upload_clang.py then (but now the
# chrome/ios build will use the 11.0 SDK too and we'd be on the hook for
# keeping it green -- if it's currently green, who knows)
# - pass flags to cmake to try to coax it into using Xcode 12 beta for the
# LLVM build without it being system Xcode.
#
# The last option seems best, so let's go with that. We need to pass
# -isysroot to the 11.0 SDK and -B to the /usr/bin so that the new ld64 is
# used.
# The compiler-rt build overrides -isysroot flags set via cflags, and we
# only need to use the 11 SDK for the compiler-rt build. So set only
# DARWIN_macosx_CACHED_SYSROOT to the 11.0 SDK and use the regular SDK
# for the rest of the build. (The new ld is used for all links.)
sys.path.insert(1, os.path.join(CHROMIUM_DIR, 'build'))
import mac_toolchain
LLVM_XCODE = os.path.join(THIRD_PARTY_DIR, 'llvm-xcode')
mac_toolchain.InstallXcodeBinaries('xcode_12_beta', LLVM_XCODE)
isysroot_11 = os.path.join(LLVM_XCODE, 'Contents', 'Developer',
'Platforms', 'MacOSX.platform', 'Developer',
'SDKs', 'MacOSX11.0.sdk')
xcode_bin = os.path.join(LLVM_XCODE, 'Contents', 'Developer',
'Toolchains', 'XcodeDefault.xctoolchain', 'usr',
'bin')
# Include an arm64 slice for libclang_rt.osx.a. This requires using
# MacOSX11.0.sdk (via -isysroot, via DARWIN_macosx_CACHED_SYSROOT) and
# the new ld, via -B
compiler_rt_args.extend([
# We don't need 32-bit intel support for macOS, we only ship 64-bit.
# XXX probably only add arm64 for bootstrap builds
'-DDARWIN_osx_ARCHS=arm64;x86_64',
'-DDARWIN_macosx_CACHED_SYSROOT=' + isysroot,
'-DDARWIN_macosx_CACHED_SYSROOT=' + isysroot_11,
])
ldflags += ['-B', xcode_bin]
else:
......@@ -802,7 +804,6 @@ def main():
if sys.platform == 'darwin' and args.bootstrap:
# When building on 10.9, /usr/include usually doesn't exist, and while
# Xcode's clang automatically sets a sysroot, self-built clangs don't.
# TODO(thakis): Try changing this back to `xcrun --show-sdk-path`.
cflags = ['-isysroot', isysroot]
cxxflags = ['-stdlib=libc++'] + cflags
ldflags += ['-stdlib=libc++']
......
......@@ -39,7 +39,7 @@ import zipfile
# Reverting problematic clang rolls is safe, though.
CLANG_REVISION = 'fb1aa286c1400ad7'
CLANG_SVN_REVISION = 'n358615'
CLANG_SUB_REVISION = 2
CLANG_SUB_REVISION = 3
PACKAGE_VERSION = '%s-%s-%s' % (CLANG_SVN_REVISION, CLANG_REVISION[:8],
CLANG_SUB_REVISION)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment