]> git.lizzy.rs Git - rust.git/blob - src/ci/docker/scripts/cmake.sh
Rollup merge of #94948 - jhpratt:rustc_deprecated, r=Dylan-DPC
[rust.git] / src / ci / docker / scripts / cmake.sh
1 #!/bin/bash
2 set -ex
3
4 hide_output() {
5   set +x
6   on_err="
7 echo ERROR: An error was encountered with the build.
8 cat /tmp/cmake_build.log
9 exit 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/cmake_build.log
15   trap - ERR
16   kill $PING_LOOP_PID
17   rm /tmp/cmake_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.
23 CMAKE=3.13.4
24 curl -L https://github.com/Kitware/CMake/releases/download/v$CMAKE/cmake-$CMAKE.tar.gz | tar xzf -
25
26 mkdir cmake-build
27 cd cmake-build
28 hide_output ../cmake-$CMAKE/configure
29 hide_output make -j$(nproc)
30 hide_output make install
31
32 cd ..
33 rm -rf cmake-build
34 rm -rf cmake-$CMAKE