mtklein@google.com | 9f3b0e4 | 2013-10-08 15:16:36 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Build Skia with one of Clang's many sanitizers. |
| 4 | # |
commit-bot@chromium.org | 7eb529f | 2014-04-24 18:16:13 +0000 | [diff] [blame] | 5 | # $ tools/xsan_build {address,thread,undefined,etc.} [any other flags to pass to make...] |
mtklein@google.com | 9f3b0e4 | 2013-10-08 15:16:36 +0000 | [diff] [blame] | 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 | |
| 12 | set -e |
| 13 | |
| 14 | sanitizer=$1 |
| 15 | shift |
| 16 | args="$@" |
| 17 | |
| 18 | export CC="$(which clang)" |
| 19 | export CXX="$(which clang++)" |
mtklein@google.com | 9f3b0e4 | 2013-10-08 15:16:36 +0000 | [diff] [blame] | 20 | |
commit-bot@chromium.org | 7eb529f | 2014-04-24 18:16:13 +0000 | [diff] [blame] | 21 | if [[ -z "${CC}" ]] || [[ -z "${CXX}" ]]; then |
mtklein@google.com | 9f3b0e4 | 2013-10-08 15:16:36 +0000 | [diff] [blame] | 22 | echo "Couldn't find Clang on this machine!" |
| 23 | exit 1 |
| 24 | fi |
| 25 | |
commit-bot@chromium.org | 7eb529f | 2014-04-24 18:16:13 +0000 | [diff] [blame] | 26 | echo "CC=$CC" |
| 27 | echo "CXX=$CXX" |
| 28 | $CC --version |
mtklein@google.com | 9f3b0e4 | 2013-10-08 15:16:36 +0000 | [diff] [blame] | 29 | |
commit-bot@chromium.org | 7eb529f | 2014-04-24 18:16:13 +0000 | [diff] [blame] | 30 | export GYP_DEFINES="skia_sanitizer=$sanitizer ${GYP_DEFINES}" |
| 31 | make ${args} |