blob: f3c4d746a01e8c01bce6fb633ef397e233354fc9 [file] [log] [blame]
mtklein@google.com9f3b0e42013-10-08 15:16:36 +00001#!/bin/bash
2
3# Build Skia with one of Clang's many sanitizers.
4#
commit-bot@chromium.org7eb529f2014-04-24 18:16:13 +00005# $ tools/xsan_build {address,thread,undefined,etc.} [any other flags to pass to make...]
mtklein@google.com9f3b0e42013-10-08 15:16:36 +00006#
7# This script assumes the use of Clang >=3.2.
8#
9# For more information, see:
10# http://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
11
12set -e
13
14sanitizer=$1
15shift
16args="$@"
17
18export CC="$(which clang)"
19export CXX="$(which clang++)"
mtklein@google.com9f3b0e42013-10-08 15:16:36 +000020
commit-bot@chromium.org7eb529f2014-04-24 18:16:13 +000021if [[ -z "${CC}" ]] || [[ -z "${CXX}" ]]; then
mtklein@google.com9f3b0e42013-10-08 15:16:36 +000022 echo "Couldn't find Clang on this machine!"
23 exit 1
24fi
25
commit-bot@chromium.org7eb529f2014-04-24 18:16:13 +000026echo "CC=$CC"
27echo "CXX=$CXX"
28$CC --version
mtklein@google.com9f3b0e42013-10-08 15:16:36 +000029
commit-bot@chromium.org7eb529f2014-04-24 18:16:13 +000030export GYP_DEFINES="skia_sanitizer=$sanitizer ${GYP_DEFINES}"
31make ${args}