about summary refs log tree commit diff
path: root/src/ci/docker/scripts
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-01-30 12:29:22 +0100
committerNikita Popov <nikita.ppv@gmail.com>2021-03-01 23:35:35 +0100
commit1e21b2cba8c96e4ab930d7aad473e08ddb483a78 (patch)
tree0e3ae994d9b102094dc75bc638a8c9fcda9bd9cb /src/ci/docker/scripts
parentff2111a9052560ef52028b1b9a7b5fb8ff1d031e (diff)
downloadrust-1e21b2cba8c96e4ab930d7aad473e08ddb483a78.tar.gz
rust-1e21b2cba8c96e4ab930d7aad473e08ddb483a78.zip
Build newer version of cmake in Docker images
LLVM requires CMake 3.13.4, which is only available as of Ubuntu 20.04.
On images using an older version, build it manually.
Diffstat (limited to 'src/ci/docker/scripts')
-rwxr-xr-xsrc/ci/docker/scripts/cmake.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/ci/docker/scripts/cmake.sh b/src/ci/docker/scripts/cmake.sh
new file mode 100755
index 00000000000..70096173403
--- /dev/null
+++ b/src/ci/docker/scripts/cmake.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+set -ex
+
+hide_output() {
+  set +x
+  on_err="
+echo ERROR: An error was encountered with the build.
+cat /tmp/build.log
+exit 1
+"
+  trap "$on_err" ERR
+  bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
+  PING_LOOP_PID=$!
+  "$@" &> /tmp/build.log
+  trap - ERR
+  kill $PING_LOOP_PID
+  rm /tmp/build.log
+  set -x
+}
+
+# LLVM 12 requires CMake 3.13.4 or higher.
+# This script is not necessary for images using Ubuntu 20.04 or newer.
+CMAKE=3.13.4
+curl -L https://github.com/Kitware/CMake/releases/download/v$CMAKE/cmake-$CMAKE.tar.gz | tar xzf -
+
+mkdir cmake-build
+cd cmake-build
+hide_output ../cmake-$CMAKE/configure
+hide_output make -j$(nproc)
+hide_output make install
+
+cd ..
+rm -rf cmake-build
+rm -rf cmake-$CMAKE