blob: f4d82e9b9fdaf537e2737bed0dd6569501d9265b [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#
5# $ tools/xsan_build {address,thread,undefined,etc.} [any other flags to pass to make/ninja...]
6#
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++)"
20export LINK="$(which clang)"
21
22if [[ -z "${CC}" ]] || [[ -z "${CXX}" ]] || [[ -z "${LINK}" ]]; then
23 echo "Couldn't find Clang on this machine!"
24 exit 1
25fi
26
27export GYP_DEFINES="skia_sanitizer=$sanitizer ${GYP_DEFINES}"
28
29./gyp_skia
30if [[ $GYP_GENERATORS == "ninja" ]]; then
31 ninja ${args}
32else
33 make ${args}
34fi