2013-10-08 15:16:36 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Build Skia with one of Clang's many sanitizers.
|
|
|
|
#
|
2014-04-24 18:16:13 +00:00
|
|
|
# $ tools/xsan_build {address,thread,undefined,etc.} [any other flags to pass to make...]
|
2013-10-08 15:16:36 +00:00
|
|
|
#
|
|
|
|
# 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
|
2016-02-03 17:21:44 +00:00
|
|
|
set -x
|
2013-10-08 15:16:36 +00:00
|
|
|
|
2016-02-12 20:15:23 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
echo "Building Clang"
|
|
|
|
pushd $here/../third_party/externals/llvm
|
|
|
|
mkdir -p out/
|
|
|
|
cd out/
|
|
|
|
$here/../third_party/externals/cmake/bin/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++
|
2016-02-03 17:21:44 +00:00
|
|
|
$CC --version
|
2013-10-08 15:16:36 +00:00
|
|
|
|
2016-02-03 17:21:44 +00:00
|
|
|
if [[ "$1" == "memory" ]]; then
|
|
|
|
export GYP_DEFINES="skia_gpu=0 skia_no_fontconfig=1 skia_freetype_static=1 ${GYP_DEFINES}"
|
2013-10-08 15:16:36 +00:00
|
|
|
fi
|
2016-02-03 17:21:44 +00:00
|
|
|
export GYP_DEFINES="skia_sanitizer=$1 ${GYP_DEFINES}"
|
2013-10-08 15:16:36 +00:00
|
|
|
|
2016-02-03 17:21:44 +00:00
|
|
|
shift
|
|
|
|
make $@
|