• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env bash
2set -e
3
4NPROC=1
5
6# OS detection
7if [ "$(uname)" = "Linux" ]; then
8	NPROC=$(nproc)
9	CC=clang-9
10elif [ "$(uname)" = "Darwin" ]; then
11	NPROC=$(sysctl -n hw.ncpu)
12	CC=/usr/local/opt/llvm/bin/clang
13elif [ "$(uname)" = "FreeBSD" ]; then
14	NPROC=$(sysctl -n hw.ncpu)
15	CC=clang-devel
16else
17	echo "Error: $(uname) not supported, sorry!"
18	exit 1
19fi
20
21# Check if we have a compiler
22if ! [ -x "$(command -v $CC)" ]; then
23	echo "Error: $CC is not installed!" >&2
24	exit 1
25fi
26
27echo "OS :" $(uname)
28echo "CC :" $CC
29echo "NP :" $NPROC
30
31# Go to script directory
32SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
33cd "$SCRIPT_DIR"
34cd ".."
35
36pwd
37
38# Find and then delete all files under current directory (.) that:
39#  1. contains "cmake" (case-&insensitive) in its path (wholename)
40#  2. name is not CMakeLists.txt
41find . -iwholename '*cmake*' -not -name CMakeLists.txt -delete
42
43# Build with ASAN / MSAN
44cmake -Dsctp_build_fuzzer=1 -Dsctp_build_programs=0 -Dsctp_invariants=1 -Dsctp_sanitizer_address=1 -DCMAKE_LINKER="$CC" -DCMAKE_C_COMPILER="$CC" .
45#cmake -Dsctp_build_fuzzer=1 -Dsctp_build_programs=0 -Dsctp_invariants=1 -Dsctp_sanitizer_memory=1 -DCMAKE_LINKER="$CC" -DCMAKE_C_COMPILER="$CC" .
46
47make -j"$NPROC"
48