Skip to content

Commit 6e8575a

Browse files
author
Dane Springmeyer
committed
avoid using symlinks, just put global llvm/clang++ on PATH
1 parent 41ea256 commit 6e8575a

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

scripts/setup.sh

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,22 @@ function run() {
3131
# it access to build tools like clang++
3232
# 2) Allows us to short-circuit and use a global clang++ install if it
3333
# is available to save space for local builds.
34-
local clang_install_dir="$(pwd)/.toolchain/"
35-
mkdir -p ${clang_install_dir}
36-
GLOBAL_CLANG="${HOME}/.mason/mason_packages/${PLATFORM}-$(uname -m)/clang++/${MASON_LLVM_RELEASE}/bin/clang++"
37-
if [[ -f ${GLOBAL_CLANG} ]]; then
38-
echo "Detected '${GLOBAL_CLANG}', using it"
39-
mkdir -p ${clang_install_dir}/bin
40-
ln -sf ${GLOBAL_CLANG} ${clang_install_dir}/bin/clang++-3.9
41-
ln -sf ${GLOBAL_CLANG} ${clang_install_dir}/bin/clang++
34+
GLOBAL_CLANG="${HOME}/.mason/mason_packages/${PLATFORM}-$(uname -m)/clang++/${MASON_LLVM_RELEASE}"
35+
GLOBAL_LLVM="${HOME}/.mason/mason_packages/${PLATFORM}-$(uname -m)/llvm/${MASON_LLVM_RELEASE}"
36+
if [[ -d ${GLOBAL_LLVM} ]]; then
37+
echo "Detected '${GLOBAL_LLVM}/bin/clang++', using it"
38+
local llvm_toolchain=${GLOBAL_LLVM}
39+
elif [[ -d ${GLOBAL_CLANG} ]]; then
40+
echo "Detected '${GLOBAL_CLANG}/bin/clang++', using it"
41+
local llvm_toolchain=${GLOBAL_CLANG}
4242
else
4343
BINARY="${MASON_URL}/clang++/${MASON_LLVM_RELEASE}.tar.gz"
44-
echo "Did not detect global clang++ at '${GLOBAL_CLANG}'"
44+
echo "Did not detect global clang++ at '${GLOBAL_CLANG}' or ${GLOBAL_LLVM}"
4545
echo "Downloading ${BINARY}"
46+
local clang_install_dir="$(pwd)/.toolchain"
47+
mkdir -p ${clang_install_dir}
4648
curl -sSfL ${BINARY} | tar --gunzip --extract --strip-components=1 --directory=${clang_install_dir}
49+
local llvm_toolchain=${clang_install_dir}
4750
fi
4851

4952
#
@@ -65,12 +68,12 @@ function run() {
6568
# ENV SETTINGS
6669
#
6770

68-
echo "export PATH=${clang_install_dir}/bin:$(pwd)/.mason:$(pwd)/mason_packages/.link/bin:"'${PATH}' > ${config}
69-
echo "export CXX=${clang_install_dir}/bin/clang++" >> ${config}
71+
echo "export PATH=${llvm_toolchain}/bin:$(pwd)/.mason:$(pwd)/mason_packages/.link/bin:"'${PATH}' > ${config}
72+
echo "export CXX=${llvm_toolchain}/bin/clang++" >> ${config}
7073
echo "export MASON_RELEASE=${MASON_RELEASE}" >> ${config}
7174
echo "export MASON_LLVM_RELEASE=${MASON_LLVM_RELEASE}" >> ${config}
7275
# https://github.com/google/sanitizers/wiki/AddressSanitizerAsDso
73-
RT_BASE=$(pwd)/mason_packages/.link/lib/clang/${MASON_LLVM_RELEASE}/lib/$(uname | tr A-Z a-z)/libclang_rt
76+
RT_BASE=${llvm_toolchain}/lib/clang/${MASON_LLVM_RELEASE}/lib/$(uname | tr A-Z a-z)/libclang_rt
7477
if [[ $(uname -s) == 'Darwin' ]]; then
7578
RT_PRELOAD=${RT_BASE}.asan_osx_dynamic.dylib
7679
else

0 commit comments

Comments
 (0)