summaryrefslogtreecommitdiff
path: root/tcwg-llvm-common.sh
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2017-05-12 12:41:57 +0100
committerRenato Golin <renato.golin@linaro.org>2017-05-12 12:58:35 +0000
commit2e125142f39db30aeb5e5a3ec065b23ba1758c6b (patch)
treeb1b990d197367e4f2d2e25d3a0db8c4eb113213d /tcwg-llvm-common.sh
parent4a4333cff0ec42eabf5e54b3ab223f8dc4c8c59f (diff)
tcwg-llvm-*: Add compiler option, setting CC/CXX
In addition to an external toolchain, we also want to control which system compiler is to be used. If an option is passed, that will be the set into CC/CXX and used by the scripts in the same way an external toolchain would. Change-Id: I25366c6c3c725ead1667d7b8828b1100e5e925d3
Diffstat (limited to 'tcwg-llvm-common.sh')
-rwxr-xr-xtcwg-llvm-common.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tcwg-llvm-common.sh b/tcwg-llvm-common.sh
index 6ec362e1..7eaec6db 100755
--- a/tcwg-llvm-common.sh
+++ b/tcwg-llvm-common.sh
@@ -13,7 +13,13 @@ download_toolchain() {
echo "WARNING: No toolchain specified, using the system one"
return 0
fi
+ if [ "${CC+set}" = "set" ] || [ "${CXX+set}" = "set" ]; then
+ echo "ERROR: Duplicating CC/CXX setup"
+ exit 1
+ fi
# Basename/dir
+ local FILE
+ local DIR
FILE=$(basename "$TOOLCHAIN")
DIR=${FILE//\.tar.*//}
# Download the toolchain
@@ -49,6 +55,25 @@ download_toolchain() {
fi
}
+# Set the compiler based on the name (clang/gcc)
+set_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
+ export CC="clang"
+ export CXX="clang++"
+ 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