summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2017-03-23 19:06:27 +0000
committerRenato Golin <renato.golin@linaro.org>2017-03-23 21:27:00 +0000
commitf08817d836dc81880a731dbcb6cf36ab085f5067 (patch)
treeca0a1fc2f58a42a84c03432f70a99e3681dd2962
parent44acb078e2011ebb06e0ed150c29dee0334c3a8b (diff)
tcwg-llvm-build.sh: Adding new toolchain parameter
This new parameter allows us to choose a toolchain to use to build LLVM. This can either be an upstream release (from llvm.org/releases) or internal ones stored in dev-01, so we can do stage 2 builds. A similar patch in configs is being submitted to cope with the new parameter. Change-Id: Ic8d440e21ea22ebd611d431d4b99b558b36bdee4
-rwxr-xr-xtcwg-llvm-build.sh40
1 files changed, 39 insertions, 1 deletions
diff --git a/tcwg-llvm-build.sh b/tcwg-llvm-build.sh
index 8b0076db..912f376e 100755
--- a/tcwg-llvm-build.sh
+++ b/tcwg-llvm-build.sh
@@ -16,7 +16,8 @@ SYN_BUILDDIR="--builddir=path/to/build"
SYN_INSTDIR="--instdir=path/to/install"
SYN_BUILDJOBS="--buildjobs=N (def. CPUS)"
SYN_LINKJOBS="--linkjobs=N (def. RAM+1)"
-SYNTAX="$0 $SYN_BUILD $SYN_ASSERTS $SYN_RELEASETYPE $SYN_SRCDIR $SYN_BUILDDIR $SYN_INSTDIR $SYN_LINKJOBS $SYN_BUILDJOBS"
+SYN_TOOLCHAIN="--toolchain=http://url/for/tarball"
+SYNTAX="$0 $SYN_BUILD $SYN_ASSERTS $SYN_RELEASETYPE $SYN_SRCDIR $SYN_BUILDDIR $SYN_INSTDIR $SYN_LINKJOBS $SYN_BUILDJOBS $STN_TOOLCHAIN"
# Environment Variables and default values
GEN="Unix Makefiles"
@@ -29,6 +30,7 @@ BUILDDIR=""
INSTDIR=""
BUILDJOBS=$CPUS
LINKJOBS=$(free -g | awk '/Mem/ {print $2}')
+TOOLCHAIN=""
# We don't want more link jobs than CPUs, even if there's plenty of RAM
if [ "$LINKJOBS" -ge "$CPUS" ]; then
LINKJOBS=$CPUS
@@ -113,6 +115,39 @@ while [ "$#" -gt 0 ]; do
exit 1
fi
shift ;;
+ --toolchain)
+ if [ "$VAL" != "" ]; then
+ file=$(basename "$VAL")
+ dir=$(echo "$file" | sed 's/\.tar.*//g')
+ # Download the toolchain
+ if [ ! -d "$WORKSPACE/$dir" ]; then
+ echo "No dir '$WORKSPACE/$dir'..."
+ if [ ! -f "$WORKSPACE/$file" ]; then
+ echo "No file '$WORKSPACE/$file'..."
+ echo "Downloading from '$VAL'"
+ wget -q "$VAL" -O "$WORKSPACE/$file"
+ fi
+ echo "Unpacking '$WORKSPACE/$file'"
+ tar xf "$WORKSPACE/$file" -C "$WORKSPACE"
+ fi
+ # Clang or GCC?
+ if [ -f "$WORKSPACE/$dir/bin/clang" ]; then
+ export CC="$WORKSPACE/$dir/bin/clang"
+ export CXX="$WORKSPACE/$dir/bin/clang++"
+ elif [ -f "$WORKSPACE/$dir/bin/gcc" ]; then
+ export CC="$WORKSPACE/$dir/bin/gcc"
+ export CXX="$WORKSPACE/$dir/bin/g++"
+ else
+ echo "ERROR: Toolchain '$VAL' has no known compiler in $dir/bin"
+ echo "Syntax: $SYN_TOOLCHAIN"
+ exit 1
+ fi
+ else
+ echo "ERROR: Toolchain '$VAL' not valid"
+ echo "Syntax: $SYN_LINKJOBS"
+ exit 1
+ fi
+ shift ;;
*)
echo "ERROR: Invalid argument '$1'"
echo "Syntax: $SYNTAX"
@@ -169,6 +204,9 @@ echo "BUILDDIR = $BUILDDIR"
echo "INSTDIR = $INSTDIR"
echo "BUILDJOBS = $BUILDJOBS"
echo "LINKJOBS = $LINKJOBS"
+echo "TOOLCHAIN = $TOOLCHAIN"
+echo "CC = $CC"
+echo "CXX = $CXX"
# Logs
LOGBASE="$SRCDIR/../tcwg-llvm"