Home | History | Annotate | Download | only in tools
      1 #!/bin/bash
      2 
      3 # Build Skia with Address Sanitizer.
      4 #
      5 # Address Sanitizer is available in LLVM (and Clang) 3.1 and above, as well as
      6 # GCC 4.8.  For now, this script assumes the use of Clang 3.2 or newer, which
      7 # uses different flag syntax from 3.1.
      8 #
      9 # For more information, see:
     10 # https://code.google.com/p/address-sanitizer/wiki/AddressSanitizer
     11 
     12 makeVars="$@"
     13 
     14 export CC="$(which clang)"
     15 export CXX="$(which clang++)"
     16 export LINK="$(which clang)"
     17 
     18 noClang="Couldn't find Clang on this machine!"
     19 if [[ -z "${CC}" ]]; then
     20   echo "${noClang}"
     21   exit 1
     22 fi
     23 if [[ -z "${CXX}" ]]; then
     24   echo "${noClang}"
     25   exit 1
     26 fi
     27 if [[ -z "${LINK}" ]]; then
     28   echo "${noClang}"
     29   exit 1
     30 fi
     31 
     32 export GYP_DEFINES="skia_asan_build=1 ${GYP_DEFINES}"
     33 
     34 python gyp_skia
     35 if [[ "$?" != "0" ]]; then
     36   exit 1
     37 fi
     38 
     39 make ${makeVars}
     40 if [[ "$?" != "0" ]]; then
     41   exit 1
     42 fi