aboutsummaryrefslogtreecommitdiffstats
path: root/utils/llvm-build
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2014-12-01 14:51:49 -0800
committerStephen Hines <srhines@google.com>2014-12-02 16:08:10 -0800
commit37ed9c199ca639565f6ce88105f9e39e898d82d0 (patch)
tree8fb36d3910e3ee4c4e1b7422f4f017108efc52f5 /utils/llvm-build
parentd2327b22152ced7bc46dc629fc908959e8a52d03 (diff)
downloadexternal_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.zip
external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.gz
external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.bz2
Update aosp/master LLVM for rebase to r222494.
Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
Diffstat (limited to 'utils/llvm-build')
-rw-r--r--utils/llvm-build/llvmbuild/main.py47
1 files changed, 34 insertions, 13 deletions
diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py
index 37aa5d8..353741f 100644
--- a/utils/llvm-build/llvmbuild/main.py
+++ b/utils/llvm-build/llvmbuild/main.py
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+import filecmp
import os
import sys
@@ -41,7 +42,7 @@ def mk_quote_string_for_target(value):
"""
mk_quote_string_for_target(target_name) -> str
- Return a quoted form of the given target_name suitable for including in a
+ Return a quoted form of the given target_name suitable for including in a
Makefile as a target name.
"""
@@ -340,7 +341,7 @@ subdirectories = %s
# Compute the llvm-config "component name". For historical reasons,
# this is lowercased based on the library name.
llvmconfig_component_name = c.get_llvmconfig_component_name()
-
+
# Get the library name, or None for LibraryGroups.
if c.type_name == 'Library' or c.type_name == 'OptionalLibrary':
library_name = c.get_prefixed_library_name()
@@ -382,7 +383,7 @@ subdirectories = %s
# Write out the library table.
make_install_dir(os.path.dirname(output_path))
- f = open(output_path, 'w')
+ f = open(output_path+'.new', 'w')
f.write("""\
//===- llvm-build generated file --------------------------------*- C++ -*-===//
//
@@ -420,6 +421,14 @@ subdirectories = %s
f.write('};\n')
f.close()
+ if not os.path.isfile(output_path):
+ os.rename(output_path+'.new', output_path)
+ elif filecmp.cmp(output_path, output_path+'.new'):
+ os.remove(output_path+'.new')
+ else:
+ os.remove(output_path)
+ os.rename(output_path+'.new', output_path)
+
def get_required_libraries_for_component(self, ci, traverse_groups = False):
"""
get_required_libraries_for_component(component_info) -> iter
@@ -430,14 +439,14 @@ subdirectories = %s
traversed to include their required libraries.
"""
- assert ci.type_name in ('Library', 'LibraryGroup', 'TargetGroup')
+ assert ci.type_name in ('Library', 'OptionalLibrary', 'LibraryGroup', 'TargetGroup')
for name in ci.required_libraries:
# Get the dependency info.
dep = self.component_info_map[name]
# If it is a library, yield it.
- if dep.type_name == 'Library':
+ if dep.type_name == 'Library' or dep.type_name == 'OptionalLibrary':
yield dep
continue
@@ -492,7 +501,7 @@ subdirectories = %s
if (path.startswith(self.source_root) and os.path.exists(path)):
yield path
- def write_cmake_fragment(self, output_path):
+ def write_cmake_fragment(self, output_path, enabled_optional_components):
"""
write_cmake_fragment(output_path) -> None
@@ -561,8 +570,13 @@ configure_file(\"%s\"
# names to required libraries, in a way that is easily accessed from CMake.
""")
for ci in self.ordered_component_infos:
- # We only write the information for libraries currently.
- if ci.type_name != 'Library':
+ # Skip optional components which are not enabled.
+ if ci.type_name == 'OptionalLibrary' \
+ and ci.name not in enabled_optional_components:
+ continue
+
+ # We only write the information for certain components currently.
+ if ci.type_name not in ('Library', 'OptionalLibrary'):
continue
f.write("""\
@@ -573,7 +587,7 @@ set_property(GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_%s %s)\n""" % (
f.close()
- def write_cmake_exports_fragment(self, output_path):
+ def write_cmake_exports_fragment(self, output_path, enabled_optional_components):
"""
write_cmake_exports_fragment(output_path) -> None
@@ -595,8 +609,13 @@ set_property(GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_%s %s)\n""" % (
# dependencies of libraries imported from LLVM.
""")
for ci in self.ordered_component_infos:
+ # Skip optional components which are not enabled.
+ if ci.type_name == 'OptionalLibrary' \
+ and ci.name not in enabled_optional_components:
+ continue
+
# We only write the information for libraries currently.
- if ci.type_name != 'Library':
+ if ci.type_name not in ('Library', 'OptionalLibrary'):
continue
# Skip disabled targets.
@@ -783,7 +802,7 @@ def add_magic_target_components(parser, project, opts):
# If we have a native target with a JIT, use that for the engine. Otherwise,
# use the interpreter.
if native_target and native_target.enabled and native_target.has_jit:
- engine_group.required_libraries.append('JIT')
+ engine_group.required_libraries.append('MCJIT')
engine_group.required_libraries.append(native_group.name)
else:
engine_group.required_libraries.append('Interpreter')
@@ -905,9 +924,11 @@ given by --build-root) at the same SUBPATH""",
# Write out the cmake fragment, if requested.
if opts.write_cmake_fragment:
- project_info.write_cmake_fragment(opts.write_cmake_fragment)
+ project_info.write_cmake_fragment(opts.write_cmake_fragment,
+ opts.optional_components)
if opts.write_cmake_exports_fragment:
- project_info.write_cmake_exports_fragment(opts.write_cmake_exports_fragment)
+ project_info.write_cmake_exports_fragment(opts.write_cmake_exports_fragment,
+ opts.optional_components)
# Configure target definition files, if requested.
if opts.configure_target_def_files: