summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Xcode/package-clang-resource-headers.py
diff options
context:
space:
mode:
authorShoaib Meenai <smeenai@fb.com>2019-03-04 21:19:53 +0000
committerShoaib Meenai <smeenai@fb.com>2019-03-04 21:19:53 +0000
commit5be71faf4bfd6b80555be6e96e60b63dea5e245e (patch)
tree931ad7c1d2bbef6ae01209f42f728b4d2bc5424f /lldb/scripts/Xcode/package-clang-resource-headers.py
parent0632e12f8927a13345cec0f823212fbd881fe889 (diff)
downloadbcm5719-llvm-5be71faf4bfd6b80555be6e96e60b63dea5e245e.tar.gz
bcm5719-llvm-5be71faf4bfd6b80555be6e96e60b63dea5e245e.zip
[build] Rename clang-headers to clang-resource-headers
Summary: The current install-clang-headers target installs clang's resource directory headers. This is different from the install-llvm-headers target, which installs LLVM's API headers. We want to introduce the corresponding target to clang, and the natural name for that new target would be install-clang-headers. Rename the existing target to install-clang-resource-headers to free up the install-clang-headers name for the new target, following the discussion on cfe-dev [1]. I didn't find any bots on zorg referencing install-clang-headers. I'll send out another PSA to cfe-dev to accompany this rename. [1] http://lists.llvm.org/pipermail/cfe-dev/2019-February/061365.html Reviewers: beanz, phosek, tstellar, rnk, dim, serge-sans-paille Subscribers: mgorny, javed.absar, jdoerfert, #sanitizers, openmp-commits, lldb-commits, cfe-commits, llvm-commits Tags: #clang, #sanitizers, #lldb, #openmp, #llvm Differential Revision: https://reviews.llvm.org/D58791 llvm-svn: 355340
Diffstat (limited to 'lldb/scripts/Xcode/package-clang-resource-headers.py')
-rw-r--r--lldb/scripts/Xcode/package-clang-resource-headers.py85
1 files changed, 85 insertions, 0 deletions
diff --git a/lldb/scripts/Xcode/package-clang-resource-headers.py b/lldb/scripts/Xcode/package-clang-resource-headers.py
new file mode 100644
index 00000000000..ed29d3c58da
--- /dev/null
+++ b/lldb/scripts/Xcode/package-clang-resource-headers.py
@@ -0,0 +1,85 @@
+#! /usr/bin/env python
+
+# package-clang-resource-headers.py
+#
+# The Clang module loader depends on built-in headers for the Clang compiler.
+# We grab these from the Clang build and move them into the LLDB module.
+
+# TARGET_DIR is where the lldb framework/shared library gets put.
+# LLVM_BUILD_DIR is where LLVM and Clang got built
+# LLVM_BUILD_DIR/lib/clang should exist and contain headers
+
+import os
+import re
+import shutil
+import sys
+
+import lldbbuild
+
+if len(sys.argv) != 3:
+ print "usage: " + sys.argv[0] + " TARGET_DIR LLVM_BUILD_DIR"
+ sys.exit(1)
+
+target_dir = sys.argv[1]
+llvm_build_dir = lldbbuild.expected_package_build_path_for("llvm")
+
+if not os.path.isdir(target_dir):
+ print target_dir + " doesn't exist"
+ sys.exit(1)
+
+if not os.path.isdir(llvm_build_dir):
+ llvm_build_dir = re.sub("-macosx-", "-iphoneos-", llvm_build_dir)
+
+if not os.path.isdir(llvm_build_dir):
+ llvm_build_dir = re.sub("-iphoneos-", "-appletvos-", llvm_build_dir)
+
+if not os.path.isdir(llvm_build_dir):
+ llvm_build_dir = re.sub("-appletvos-", "-watchos-", llvm_build_dir)
+
+if not os.path.isdir(llvm_build_dir):
+ llvm_build_dir = re.sub("-watchos-", "-bridgeos-", llvm_build_dir)
+
+if not os.path.isdir(llvm_build_dir):
+ print llvm_build_dir + " doesn't exist"
+ sys.exit(1)
+
+resources = os.path.join(target_dir, "LLDB.framework", "Resources")
+
+if not os.path.isdir(resources):
+ print resources + " must exist"
+ sys.exit(1)
+
+clang_dir = os.path.join(llvm_build_dir, "lib", "clang")
+
+if not os.path.isdir(clang_dir):
+ print clang_dir + " must exist"
+ sys.exit(1)
+
+version_dir = None
+
+for subdir in os.listdir(clang_dir):
+ if (re.match("^[0-9]+(\.[0-9]+)*$", subdir)):
+ version_dir = os.path.join(clang_dir, subdir)
+ break
+
+if version_dir is None:
+ print "Couldn't find a subdirectory of the form #(.#)... in " + clang_dir
+ sys.exit(1)
+
+if not os.path.isdir(version_dir):
+ print version_dir + " is not a directory"
+ sys.exit(1)
+
+# Just checking... we're actually going to copy all of version_dir
+include_dir = os.path.join(version_dir, "include")
+
+if not os.path.isdir(include_dir):
+ print version_dir + " is not a directory"
+ sys.exit(1)
+
+clang_resources = os.path.join(resources, "Clang")
+
+if os.path.isdir(clang_resources):
+ shutil.rmtree(clang_resources)
+
+shutil.copytree(version_dir, clang_resources)
OpenPOWER on IntegriCloud