blob: b569a7be9f9ab801f7c5c19cecfb080bc8cf6dfd (
plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!/bin/bash
# Build Skia with one of Clang's many sanitizers.
#
# $ tools/xsan_build {address,thread,undefined,etc.} [any other flags to pass to make...]
#
# This script assumes the use of Clang >=3.2.
#
# For more information, see:
# http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
set -e
set -x
here=$(cd `dirname $0`; echo `pwd`)
cores=48
echo "Bootstrapping CMake"
pushd $here/../third_party/externals/cmake
./bootstrap --parallel=$cores
make -j $cores cmake
popd
cmake=$here/../third_party/externals/cmake/bin/cmake
echo "Building Clang"
pushd $here/../third_party/externals/llvm
mkdir -p out/
cd out/
rm -f CMakeCache.txt # Force CMake to re-configure, in case DEPS has changed.
$cmake -DCMAKE_BUILD_TYPE=Release -G Ninja ..
ninja
popd
export CC=$here/../third_party/externals/llvm/out/bin/clang
export CXX=$here/../third_party/externals/llvm/out/bin/clang++
$CC --version
if [[ "$1" == "memory" ]]; then
echo "Building libc++ with MSAN"
pushd $here/../third_party/externals/llvm
mkdir -p msan_out/
cd msan_out/
rm -f CMakeCache.txt # Force CMake to re-configure, in case DEPS has changed.
$cmake -DLLVM_USE_SANITIZER=MemoryWithOrigins -DCMAKE_BUILD_TYPE=Release -G Ninja ..
ninja cxx cxxabi # No need to build all of LLVM+Clang with MSAN, just libc++.
popd
msan_out=$here/../third_party/externals/llvm/msan_out
export GYP_DEFINES="skia_gpu=0 skia_no_fontconfig=1 skia_freetype_static=1 ${GYP_DEFINES}"
export CXXFLAGS="-stdlib=libc++ -I$msan_out/include ${CXX_FLAGS}"
export LDFLAGS="-stdlib=libc++ -L$msan_out/lib -Wl,-rpath,$msan_out/lib ${LDFLAGS}"
fi
export GYP_DEFINES="skia_sanitizer=$1 ${GYP_DEFINES}"
shift
make $@
|