@@ -22,37 +22,36 @@ if ! [ "$#" -ge 3 ]; then
2222 exit 2
2323fi ;
2424
25+ repo_dir=" $( git rev-parse --show-toplevel) "
26+ build_dir=" ${repo_dir} /build"
27+ dist_dir=" ${build_dir} /dist"
28+
2529# # Take configuration from arguments
2630# This is the name for the tar file.
2731toolchain_name=" ${1} "
2832# This is the CMake build type (e.g. Release, Debug, RelWithDebInfo)
2933build_type=" ${2} "
3034# This is the expected target triple (so we can set a default)
3135toolchain_target=" ${3} "
32- # This is the directory where we want the toolchain to added to
33- toolchain_dest=" ${4} "
3436# -march option default value
35- march=" ${5 } "
37+ march=" ${4 } "
3638# -mabi option default value
37- mabi=" ${6 } "
39+ mabi=" ${5 } "
3840# -mcmodel option default value
39- mcmodel=" ${7 } "
41+ mcmodel=" ${6 } "
4042# Remaining cflags for build configurations
41- toolchain_cflags=(" ${@: 8} " )
42-
43- build_top_dir=" ${PWD} "
43+ toolchain_cflags=(" ${@: 7} " )
4444
4545# For *_VERSION variables
4646# shellcheck source=sw-versions.sh
47- source " ${build_top_dir } /sw-versions.sh"
47+ source " ${repo_dir } /sw-versions.sh"
4848
4949tag_name=" ${RELEASE_TAG:- HEAD} "
5050
51- mkdir -p " ${build_top_dir} /build"
52- cd " ${build_top_dir} /build"
53-
51+ mkdir -p " $build_dir "
52+ cd " $build_dir "
5453
55- llvm_dir=" ${build_top_dir} /build /llvm-project"
54+ llvm_dir=" ${build_dir} /llvm-project"
5655if [ ! -d " $llvm_dir " ]; then
5756 git clone " $LLVM_URL " " $llvm_dir " \
5857 --branch " $LLVM_BRANCH " \
@@ -69,7 +68,7 @@ clang_links_to_create+=";${toolchain_target}-clang;${toolchain_target}-clang++"
6968lld_links_to_create=" ld.lld;ld64.lld"
7069lld_links_to_create+=" ;${toolchain_target} -ld.lld;${toolchain_target} -ld64.lld"
7170
72- llvm_build_dir=" ${build_top_dir} /build/ llvm-build"
71+ llvm_build_dir=" ${build_dir} / llvm-project/ build"
7372
7473# Delete old build artifacts (if they exist)
7574rm -rf " ${llvm_build_dir} "
@@ -109,7 +108,7 @@ llvm_distribution_components+=";${llvm_tools}"
109108cmake " ${llvm_dir} /llvm" \
110109 -Wno-dev \
111110 -DCMAKE_BUILD_TYPE=" ${build_type} " \
112- -DCMAKE_INSTALL_PREFIX=" ${toolchain_dest } " \
111+ -DCMAKE_INSTALL_PREFIX=" ${dist_dir } " \
113112 -DLLVM_TARGETS_TO_BUILD=" RISCV" \
114113 -DLLVM_ENABLE_PROJECTS=" clang;lld;clang-tools-extra" \
115114 -DLLVM_ENABLE_BACKTRACES=Off \
@@ -130,22 +129,22 @@ cmake --build "${llvm_build_dir}" \
130129 --parallel $(( $(nproc) + 2 )) \
131130 --target install-distribution
132131
133- cd " ${build_top_dir } "
132+ cd " ${repo_dir } "
134133
135134# Copy LLVM licenses into toolchain
136- mkdir -p " ${toolchain_dest } /share/licenses/llvm"
137- cp " ${llvm_dir} /llvm/LICENSE.TXT" " ${toolchain_dest } /share/licenses/llvm"
135+ mkdir -p " ${dist_dir } /share/licenses/llvm"
136+ cp " ${llvm_dir} /llvm/LICENSE.TXT" " ${dist_dir } /share/licenses/llvm"
138137
139- ls -l " ${toolchain_dest } "
138+ ls -l " ${dist_dir } "
140139
141140# Write out build info
142141set +o pipefail # head causes pipe failures, so we have to switch off pipefail while we use it.
143142ct_ng_version_string=" $( (set +o pipefail; ct-ng version | head -n1) ) "
144- clang_version_string=" $( " ${toolchain_dest } /bin/clang" --version | head -n1) "
143+ clang_version_string=" $( " ${dist_dir } /bin/clang" --version | head -n1) "
145144build_date=" $( date -u) "
146145set -o pipefail
147146
148- tee " ${toolchain_dest } /buildinfo" << BUILDINFO
147+ tee " ${dist_dir } /buildinfo" << BUILDINFO
149148Report toolchain bugs to [email protected] (include this file) 150149
151150lowRISC toolchain config: ${toolchain_name}
@@ -165,7 +164,7 @@ C Flags:
165164Built at ${build_date} on $( hostname)
166165BUILDINFO
167166
168- tee " ${toolchain_dest } /buildinfo.json" << BUILDINFO_JSON
167+ tee " ${dist_dir } /buildinfo.json" << BUILDINFO_JSON
169168{
170169 "toolchain_config": "${toolchain_name} ",
171170 "kind": "combined",
0 commit comments