Commit 051b8a63 authored by Nico Weber's avatar Nico Weber

clang build scripts: Use smaller hermetic Xcode

We used to have a full hermetic Xcode. Now most Chromium bots use just
a small collection of Xcode binaries (listed in build/xcode_binaries.yaml)
and the SDK. This makes the clang build scripts use the new way, so that
Chromium can stop pulling the full Xcode install.

Instead of setting DEVELOPER_DIR and using xcrun, we now just set PATH
and pass an explicit -isysroot flag to clang.

(Having just the mac sdk around and not an iOS sdk causes problems with
https://reviews.llvm.org/D63674 but that's a problem with both full
and minimal Xcode, and the fix for that seems independent of this change.
This change here shouldn't make things worse.)

Bug: 985971
Change-Id: I6ff7653c49a0263e932b52ce487d6ada7b8e95e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1711224
Commit-Queue: Nico Weber <thakis@chromium.org>
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarHans Wennborg <hans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#679581}
parent 3d3af477
......@@ -53,6 +53,13 @@ BUG_REPORT_URL = ('https://crbug.com and run'
' tools/clang/scripts/process_crashreports.py'
' (only works inside Google) which will upload a report')
MAC_XCODE_ROOT = os.path.join(
CHROMIUM_DIR, 'build/mac_files/xcode_binaries/Contents/Developer')
MAC_XCODE_PATH = os.path.join(
MAC_XCODE_ROOT, 'Toolchains/XcodeDefault.xctoolchain/usr/bin')
MAC_XCODE_SYSROOT = os.path.join(
MAC_XCODE_ROOT, 'Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk')
def RunCommand(command, msvc_arch=None, env=None, fail_hard=True):
"""Run command and return success (True) or failure; or if fail_hard is
......@@ -246,13 +253,13 @@ def MaybeDownloadHostGcc(args):
def SetMacXcodePath():
"""Set DEVELOPER_DIR to the path to hermetic Xcode.app on Mac OS X."""
"""Add hermetic Xcode binaries to PATH on Mac OS X."""
if sys.platform != 'darwin':
return
xcode_path = os.path.join(CHROMIUM_DIR, 'build', 'mac_files', 'Xcode.app')
if os.path.exists(xcode_path):
os.environ['DEVELOPER_DIR'] = xcode_path
# xcode_binaries contains just a few binaries, not a full Xcode install --
# so setting DEVELOPER_DIR doesn't work. Just set PATH.
os.environ['PATH'] = MAC_XCODE_PATH + os.pathsep + os.environ.get('PATH', '')
def VerifyVersionOfBuiltClangMatchesVERSION():
......@@ -637,9 +644,7 @@ def main():
'-target', 'x86_64-unknown-unknown', '-O2', '-g', '-std=c++14',
'-fno-exceptions', '-fno-rtti', '-w', '-c', training_source]
if sys.platform == 'darwin':
train_cmd.extend(['-stdlib=libc++', '-isysroot',
subprocess.check_output(['xcrun',
'--show-sdk-path']).rstrip()])
train_cmd.extend(['-stdlib=libc++', '-isysroot', MAC_XCODE_SYSROOT])
RunCommand(train_cmd, msvc_arch='x64')
# Merge profiles.
......@@ -681,8 +686,7 @@ 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.
cflags = ['-isysroot', subprocess.check_output(
['xcrun', '--show-sdk-path']).rstrip()]
cflags = ['-isysroot', MAC_XCODE_SYSROOT]
cxxflags = ['-stdlib=libc++'] + cflags
ldflags += ['-stdlib=libc++']
deployment_target = '10.7'
......
......@@ -39,7 +39,7 @@ import zipfile
# Reverting problematic clang rolls is safe, though.
CLANG_REVISION = 'f7e52fbdb5a7af8ea0808e98458b497125a5eca1'
CLANG_SVN_REVISION = '365097'
CLANG_SUB_REVISION = 6
CLANG_SUB_REVISION = 7
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