test-release.sh: build projects and runtimes lists with semicolons

While doing a test-release.sh run on FreeBSD, I ran into a sed error due
to the introduction of the GNU extension '\s' in commit 500587e23dfd.

Scanning for blanks (spaces and tabs) could be done in a more portable
fashion using the [[:blank:]] character class. But it is easier to avoid
the original problem, which is that the projects and runtime lists have
to be separated by semicolons, and cannot start with a semicolon.

Instead, use the shell's alternate value parameter expansion mechanism,
which makes it easy to append items to lists with separators in between,
and without any leading separator. This also avoids having to run sed on
the end result.

In addition, build any selected runtimes in the second phase, otherwise
the third phase can fail to find several symbols in compiler-rt, if that
has been built. This is because the host's compiler-rt is not guaranteed
to have those symbols.

Reviewed By: tstellar

Differential Revision: https://reviews.llvm.org/D145884
This commit is contained in:
Dimitry Andric 2023-03-12 19:53:12 +01:00
parent b1bd52cd0d
commit 9b17f5ee0e

View File

@ -261,43 +261,43 @@ if [ -z "$NumJobs" ]; then
fi fi
# Projects list # Projects list
projects="llvm clang" projects="llvm;clang"
if [ $do_clang_tools = "yes" ]; then if [ $do_clang_tools = "yes" ]; then
projects="$projects clang-tools-extra" projects="${projects:+$projects;}clang-tools-extra"
fi fi
runtimes="" runtimes=""
if [ $do_rt = "yes" ]; then if [ $do_rt = "yes" ]; then
runtimes="$runtimes compiler-rt" runtimes="${runtimes:+$runtimes;}compiler-rt"
fi fi
if [ $do_libs = "yes" ]; then if [ $do_libs = "yes" ]; then
runtimes="$runtimes libcxx" runtimes="${runtimes:+$runtimes;}libcxx"
if [ $do_libcxxabi = "yes" ]; then if [ $do_libcxxabi = "yes" ]; then
runtimes="$runtimes libcxxabi" runtimes="${runtimes:+$runtimes;}libcxxabi"
fi fi
if [ $do_libunwind = "yes" ]; then if [ $do_libunwind = "yes" ]; then
runtimes="$runtimes libunwind" runtimes="${runtimes:+$runtimes;}libunwind"
fi fi
fi fi
if [ $do_openmp = "yes" ]; then if [ $do_openmp = "yes" ]; then
projects="$projects openmp" projects="${projects:+$projects;}openmp"
fi fi
if [ $do_bolt = "yes" ]; then if [ $do_bolt = "yes" ]; then
projects="$projects bolt" projects="${projects:+$projects;}bolt"
fi fi
if [ $do_lld = "yes" ]; then if [ $do_lld = "yes" ]; then
projects="$projects lld" projects="${projects:+$projects;}lld"
fi fi
if [ $do_lldb = "yes" ]; then if [ $do_lldb = "yes" ]; then
projects="$projects lldb" projects="${projects:+$projects;}lldb"
fi fi
if [ $do_polly = "yes" ]; then if [ $do_polly = "yes" ]; then
projects="$projects polly" projects="${projects:+$projects;}polly"
fi fi
if [ $do_mlir = "yes" ]; then if [ $do_mlir = "yes" ]; then
projects="$projects mlir" projects="${projects:+$projects;}mlir"
fi fi
if [ $do_flang = "yes" ]; then if [ $do_flang = "yes" ]; then
projects="$projects flang" projects="${projects:+$projects;}flang"
fi fi
# Go to the build directory (may be different from CWD) # Go to the build directory (may be different from CWD)
@ -404,17 +404,23 @@ function configure_llvmCore() {
;; ;;
esac esac
if [ "$Phase" -eq "3" ]; then # During the first two phases, there is no need to build any of the projects
project_list=${projects// /;} # except clang, since these phases are only meant to produce a bootstrapped
# Leading spaces will result in ";<runtime name>". This causes a CMake # clang compiler, capable of building the third phase.
# error because the empty string before the first ';' is treated as an if [ "$Phase" -lt "3" ]; then
# unknown runtime name.
runtimes=$(echo $runtimes | sed -e 's/^\s*//')
runtime_list=${runtimes// /;}
else
project_list="clang" project_list="clang"
runtime_list="" else
project_list="$projects"
fi fi
# During the first phase, there is no need to build any of the runtimes,
# since this phase is only meant to get a clang compiler, capable of
# building itself and any selected runtimes in the second phase.
if [ "$Phase" -lt "2" ]; then
runtime_list=""
else
runtime_list="$runtimes"
fi
echo "# Using C compiler: $c_compiler" echo "# Using C compiler: $c_compiler"
echo "# Using C++ compiler: $cxx_compiler" echo "# Using C++ compiler: $cxx_compiler"