| 1 | #!/bin/bash |
| 2 | # |
| 3 | # This script must be run through meson |
| 4 | # |
| 5 | # Checks for the presence of clang static analyzer and/or cppcheck and runs them if present. |
| 6 | # |
| 7 | |
| 8 | set -e +x |
| 9 | |
| 10 | if [ -z ${MESON_SOURCE_ROOT+x} ]; then |
| 11 | echo "Missing MESON_SOURCE_ROOT"; |
| 12 | exit 1; |
| 13 | fi |
| 14 | |
| 15 | perl -pe "s{\@SOURCEDIR\@}{${MESON_SOURCE_ROOT}}g" ${MESON_SOURCE_ROOT}/common/configs/cppcheck-suppressions.in.txt > ${MESON_SOURCE_ROOT}/common/configs/cppcheck-suppressions.txt |
| 16 | |
| 17 | if hash scan-build 2>/dev/null; then |
| 18 | ninja -C ${MESON_BUILD_ROOT} scan-build |
| 19 | else |
| 20 | echo "scan-build not found, not running." |
| 21 | fi |
| 22 | |
| 23 | if hash cppcheck 2>/dev/null; then |
| 24 | ninja -C ${MESON_BUILD_ROOT} cppcheck |
| 25 | else |
| 26 | echo "cppcheck not found, not running." |
| 27 | fi |