#!/bin/bash
set -exuo pipefail

apt-get update
apt-get upgrade -yqq

build_command() {
  ./bootstrap
  ./configure CFLAGS="-ggdb -O0" \
  	    --enable-logging=verbose \
        --enable-converage \
  	    --disable-doc

  nump=$(grep processor /proc/cpuinfo | wc -l)
  make -j$(( $nump / 2 ))
}

if ! build_command; then
  cat build/meson-logs/meson-log.txt
  exit 1
fi
