forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_clang.sh
executable file
·30 lines (21 loc) · 1.01 KB
/
setup_clang.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
BAZELRC_FILE="$(bazel info workspace)/clang.bazelrc"
LLVM_PREFIX=$1
if [[ ! -e "${LLVM_PREFIX}/bin/llvm-config" ]]; then
echo "Error: cannot find llvm-config in ${LLVM_PREFIX}."
exit 1
fi
export PATH="$(${LLVM_PREFIX}/bin/llvm-config --bindir):${PATH}"
RT_LIBRARY_PATH="$(dirname $(find $(llvm-config --libdir) -name libclang_rt.ubsan_standalone_cxx-x86_64.a | head -1))"
echo "# Generated file, do not edit. If you want to disable clang, just delete this file.
build:clang --action_env=PATH=${PATH}
build:clang --action_env=CC=clang
build:clang --action_env=CXX=clang++
build:clang --action_env=LD_LIBRARY_PATH=$(llvm-config --libdir)
build:clang --test_env=LD_LIBRARY_PATH=$(llvm-config --libdir)
build:clang-asan --copt=-fsanitize=vptr,function
build:clang-asan --linkopt=-fsanitize=vptr,function
build:clang-asan --linkopt=-L${RT_LIBRARY_PATH}
build:clang-asan --linkopt=-l:libclang_rt.ubsan_standalone-x86_64.a
build:clang-asan --linkopt=-l:libclang_rt.ubsan_standalone_cxx-x86_64.a
" > ${BAZELRC_FILE}