Index: tools/xsan_build |
diff --git a/tools/xsan_build b/tools/xsan_build |
new file mode 100755 |
index 0000000000000000000000000000000000000000..f4d82e9b9fdaf537e2737bed0dd6569501d9265b |
--- /dev/null |
+++ b/tools/xsan_build |
@@ -0,0 +1,34 @@ |
+#!/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/ninja...] |
+# |
+# 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 |
+ |
+sanitizer=$1 |
+shift |
+args="$@" |
+ |
+export CC="$(which clang)" |
+export CXX="$(which clang++)" |
+export LINK="$(which clang)" |
+ |
+if [[ -z "${CC}" ]] || [[ -z "${CXX}" ]] || [[ -z "${LINK}" ]]; then |
+ echo "Couldn't find Clang on this machine!" |
+ exit 1 |
+fi |
+ |
+export GYP_DEFINES="skia_sanitizer=$sanitizer ${GYP_DEFINES}" |
+ |
+./gyp_skia |
+if [[ $GYP_GENERATORS == "ninja" ]]; then |
+ ninja ${args} |
+else |
+ make ${args} |
+fi |