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

Unified Diff: tools/clang/scripts/update.py

Issue 2893973003: not working update.py to build fuchsia builtins
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/scripts/update.py
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py
index 64c520700d6fb4ba016fe52a1ceff21bec9b49c2..dcf4e6f28bfd4d1027ad4ed17ed6137436aa4739 100755
--- a/tools/clang/scripts/update.py
+++ b/tools/clang/scripts/update.py
@@ -73,6 +73,7 @@ BFD_PLUGINS_DIR = os.path.join(BINUTILS_LIB_DIR, 'bfd-plugins')
VERSION = '5.0.0'
ANDROID_NDK_DIR = os.path.join(
CHROMIUM_DIR, 'third_party', 'android_tools', 'ndk')
+FUCHSIA_SDK_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'fuchsia-sdk')
# URL for pre-built binaries.
CDS_URL = os.environ.get('CDS_CLANG_BUCKET_OVERRIDE',
@@ -448,6 +449,12 @@ def UpdateClang(args):
print 'for how to install the NDK, or pass --without-android.'
return 1
+ if args.with_fuchsia and not os.path.exists(FUCHSIA_SDK_DIR):
+ print 'Fuchsia SDK not found at ' + FUCHSIA_SDK_DIR
+ print 'Either install it there by including target_os=[\'fuchsia\'] in '
+ print '.gclient and rerunning gclient runhooks, or pass --without-fuchsia.'
+ return 1
+
DownloadHostGcc(args)
AddCMakeToPath()
AddGnuWinToPath()
@@ -459,7 +466,7 @@ def UpdateClang(args):
if sys.platform != 'darwin':
Checkout('LLD', LLVM_REPO_URL + '/lld/trunk', LLD_DIR)
elif os.path.exists(LLD_DIR):
- # In case someone sends a tryjob that temporary adds lld to the checkout,
+ # In case someone sends a tryjob that temporarily adds lld to the checkout,
# make sure it's not around on future builds.
RmTree(LLD_DIR)
Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR)
@@ -696,7 +703,7 @@ def UpdateClang(args):
# Do a clobbered build due to cmake changes.
if os.path.isdir(COMPILER_RT_BUILD_DIR):
RmTree(COMPILER_RT_BUILD_DIR)
- os.makedirs(COMPILER_RT_BUILD_DIR)
+ EnsureDirExists(COMPILER_RT_BUILD_DIR)
os.chdir(COMPILER_RT_BUILD_DIR)
# TODO(thakis): Add this once compiler-rt can build with clang-cl (see
# above).
@@ -825,6 +832,32 @@ def UpdateClang(args):
if runtime in files:
shutil.copy(os.path.join(root, runtime), asan_rt_lib_dst_dir)
+ if args.with_fuchsia:
+ # TODO(fuchsia): There's no aarch64 sysroot in the SDK yet.
+ for target_arch in ('x86_64',):
+ build_dir = os.path.join(LLVM_BUILD_DIR, 'fuchsia-' + target_arch)
+ if not os.path.exists(build_dir):
+ os.mkdir(os.path.join(build_dir))
+ os.chdir(build_dir)
+ sysroot = '%s/sysroot/%s-fuchsia' % (FUCHSIA_SDK_DIR, target_arch)
+ cflags = ['--target=%s-fuchsia' % target_arch,
+ '--sysroot=' + sysroot]
+ fuchsia_args = base_cmake_args + [
+ '-DLLVM_ENABLE_THREADS=OFF',
+ '-DCMAKE_C_COMPILER=' + os.path.join(LLVM_BUILD_DIR, 'bin/clang'),
+ '-DCMAKE_CXX_COMPILER=' + os.path.join(LLVM_BUILD_DIR, 'bin/clang'),
+ '-DCMAKE_C_COMPILER_WORKS=ON',
+ '-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON',
+ '-DCMAKE_C_COMPILER_TARGET=%s-fuchsia-none' % target_arch,
+ '-DCMAKE_CXX_COMPILER_WORKS=ON',
+ '-DLLVM_CONFIG_PATH=' + os.path.join(LLVM_BUILD_DIR, 'bin/llvm-config'),
+ '-DCMAKE_C_FLAGS=' + ' '.join(cflags),
+ '-DCMAKE_CXX_FLAGS=' + ' '.join(cflags)]
+
+ RmCmakeCache('.')
+ RunCommand(['cmake'] + fuchsia_args + [COMPILER_RT_DIR])
+ RunCommand(['ninja', 'builtins'])
+
# Run tests.
if args.run_tests or use_head_revision:
os.chdir(LLVM_BUILD_DIR)
@@ -847,7 +880,7 @@ def main():
parser.add_argument('--if-needed', action='store_true',
help="run only if the script thinks clang is needed")
parser.add_argument('--force-local-build', action='store_true',
- help="don't try to download prebuild binaries")
+ help="don't try to download prebuilt binaries")
parser.add_argument('--gcc-toolchain', help='set the version for which gcc '
'version be used for building; --gcc-toolchain=/opt/foo '
'picks /opt/foo/bin/gcc')
@@ -868,6 +901,10 @@ def main():
help='don\'t build Android ASan runtime (linux only)',
dest='with_android',
default=sys.platform.startswith('linux'))
+ parser.add_argument('--without-fuchsia', action='store_false',
+ help='don\'t build Fuchsia runtime (linux only)',
+ dest='with_fuchsia',
+ default=sys.platform.startswith('linux'))
args = parser.parse_args()
if args.lto_gold_plugin and not args.bootstrap:
« 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