summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuhammad Omair Javaid <omair.javaid@linaro.org>2021-08-04 21:04:18 +0500
committerMuhammad Omair Javaid <omair.javaid@linaro.org>2021-08-04 22:01:07 +0500
commitbc8983efa3f186347ff5da317b501ead5e7a712d (patch)
treef180788ade272af495e2d63af2dff6f5620de4af
parent152ef428e4db70e15ddcdba95c984642eb9b8dbe (diff)
tcwg-llvm-release.sh: Set LLVM release compiler to clang 12.0
This patch introduces a new function in tcwg-llvm-common.sh which configures LLVM release compiler to latest clang release. This is currently set to clang 12.0.0. Change-Id: Idefcb99055b1edf1cbb78847245281efdaf4103f
-rwxr-xr-xtcwg-llvm-common.sh39
-rwxr-xr-xtcwg-llvm-release.sh2
2 files changed, 40 insertions, 1 deletions
diff --git a/tcwg-llvm-common.sh b/tcwg-llvm-common.sh
index f410efe6..07755c0e 100755
--- a/tcwg-llvm-common.sh
+++ b/tcwg-llvm-common.sh
@@ -75,6 +75,45 @@ set_compiler () {
fi
}
+# Set the llvm release compiler to clang 12.0.0
+set_llvm_release_compiler () {
+ local VAL="$1"
+ if [ "${CC+set}" = "set" ] || [ "${CXX+set}" = "set" ]; then
+ echo "ERROR: Duplicating CC/CXX setup"
+ exit 1
+ fi
+
+ if [ "$VAL" = "clang" ]; then
+ release_num=12.0.0
+ case "$(uname -m)" in
+ aarch64)
+ clang_ver=clang+llvm-${release_num}-aarch64-linux-gnu ;;
+ x86_64)
+ clang_ver=clang+llvm-${release_num}-x86_64-linux-gnu-ubuntu-16.04 ;;
+ *)
+ clang_ver=clang+llvm-12.0.0-armv7a-linux-gnueabihf ;;
+ esac
+ cd /usr/local \
+ && wget --progress=dot:giga https://github.com/llvm/llvm-project/releases/download/llvmorg-${release_num}/$clang_ver.tar.xz \
+ && tar xf $clang_ver.tar.xz \
+ && rm $clang_ver.tar.xz
+ release_path=/usr/local/${clang_ver}
+ export CC=$release_path/bin/clang
+ export CXX=$release_path/bin/clang++
+
+ # Starting with clang-11 we need clang's libs in ld.so's search path;
+ # otherwise we get failure to find libc++.so.
+ echo "$release_path/lib" > /etc/ld.so.conf.d/clang.conf
+ ldconfig
+ elif [ "$VAL" = "gcc" ]; then
+ export CC="gcc"
+ export CXX="g++"
+ else
+ echo "ERROR: Unknown compiler '$VAL'"
+ exit 1
+ fi
+}
+
# Find the closest git hash for the SVN revision
update_git() {
local BASE=$1
diff --git a/tcwg-llvm-release.sh b/tcwg-llvm-release.sh
index 0fa9405f..143cbe88 100755
--- a/tcwg-llvm-release.sh
+++ b/tcwg-llvm-release.sh
@@ -102,7 +102,7 @@ while [ "$#" -gt 0 ]; do
download_toolchain "$WORKSPACE" "$VAL"
shift ;;
--compiler)
- set_compiler "$VAL"
+ set_llvm_release_compiler "$VAL"
shift ;;
--toolchain-file)
if [ "$VAL" != "" ]; then