💾 Archived View for gmi.noulin.net › gitRepositories › md4c › file › scripts › coverity.sh.gmi captured on 2024-08-18 at 18:50:23. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

md4c

Log

Files

Refs

README

LICENSE

coverity.sh (1488B)

     1 #!/bin/sh
     2 #
     3 # This scripts attempts to build the project via cov-build utility, and prepare
     4 # a package for uploading to the coverity scan service.
     5 #
     6 # (See http://scan.coverity.com for more info.)
     7 
     8 set -e
     9 
    10 # Check presence of coverity static analyzer.
    11 if ! which cov-build; then
    12     echo "Utility cov-build not found in PATH."
    13     exit 1
    14 fi
    15 
    16 # Choose a build system (ninja or GNU make).
    17 if which ninja; then
    18     BUILD_TOOL=ninja
    19     GENERATOR=Ninja
    20 elif which make; then
    21     BUILD_TOOL=make
    22     GENERATOR="MSYS Makefiles"
    23 else
    24     echo "No suitable build system found."
    25     exit 1
    26 fi
    27 
    28 # Choose a zip tool.
    29 if which 7za; then
    30     MKZIP="7za a -r -mx9"
    31 elif which 7z; then
    32     MKZIP="7z a -r -mx9"
    33 elif which zip; then
    34     MKZIP="zip -r"
    35 else
    36     echo "No suitable zip utility found"
    37     exit 1
    38 fi
    39 
    40 # Change dir to project root.
    41 cd `dirname "$0"`/..
    42 
    43 CWD=`pwd`
    44 ROOT_DIR="$CWD"
    45 BUILD_DIR="$CWD/coverity"
    46 OUTPUT="$CWD/cov-int.zip"
    47 
    48 # Sanity checks.
    49 if [ ! -x "$ROOT_DIR/scripts/coverity.sh" ]; then
    50     echo "There is some path mismatch."
    51     exit 1
    52 fi
    53 if [ -e "$BUILD_DIR" ]; then
    54     echo "Path $BUILD_DIR already exists. Delete it and retry."
    55     exit 1
    56 fi
    57 if [ -e "$OUTPUT" ]; then
    58     echo "Path $OUTPUT already exists. Delete it and retry."
    59     exit 1
    60 fi
    61 
    62 # Build the project with the Coverity analyzes enabled.
    63 mkdir -p "$BUILD_DIR"
    64 cd "$BUILD_DIR"
    65 cmake -G "$GENERATOR" "$ROOT_DIR"
    66 cov-build --dir cov-int "$BUILD_TOOL"
    67 $MKZIP "$OUTPUT" "cov-int"
    68 cd "$ROOT_DIR"
    69 rm -rf "$BUILD_DIR"
    70