1#!/bin/bash 2set -ex 3 4hide_output() { 5 set +x 6 on_err=" 7echo ERROR: An error was encountered with the build. 8cat /tmp/build.log 9exit 1 10" 11 trap "$on_err" ERR 12 bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & 13 PING_LOOP_PID=$! 14 "$@" &> /tmp/build.log 15 trap - ERR 16 kill $PING_LOOP_PID 17 rm /tmp/build.log 18 set -x 19} 20 21# LLVM 12 requires CMake 3.13.4 or higher. 22# This script is not necessary for images using Ubuntu 20.04 or newer. 23CMAKE=3.13.4 24curl -L https://github.com/Kitware/CMake/releases/download/v$CMAKE/cmake-$CMAKE.tar.gz | tar xzf - 25 26mkdir cmake-build 27cd cmake-build 28hide_output ../cmake-$CMAKE/configure 29hide_output make -j$(nproc) 30hide_output make install 31 32cd .. 33rm -rf cmake-build 34rm -rf cmake-$CMAKE 35