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.
This commit is contained in:
Nikita Popov 2021-01-30 12:29:22 +01:00
parent ff2111a905
commit 1e21b2cba8
26 changed files with 109 additions and 0 deletions

View File

@ -36,5 +36,8 @@ ENV SCRIPT python3 ../x.py --stage 2 test --host='' --target $TARGETS
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
COPY scripts/android-start-emulator.sh /scripts/
ENTRYPOINT ["/scripts/android-start-emulator.sh"]

View File

@ -24,6 +24,9 @@ USER root
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV PATH=$PATH:/x-tools/aarch64-unknown-linux-gnueabi/bin
ENV CC_aarch64_unknown_linux_gnu=aarch64-unknown-linux-gnueabi-gcc \

View File

@ -36,3 +36,6 @@ ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh

View File

@ -27,6 +27,9 @@ USER root
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabi/bin
ENV CC_arm_unknown_linux_gnueabi=arm-unknown-linux-gnueabi-gcc \

View File

@ -19,6 +19,9 @@ USER root
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV PATH=$PATH:/x-tools/arm-unknown-linux-gnueabihf/bin
ENV CC_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-gcc \

View File

@ -19,6 +19,9 @@ USER root
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV PATH=$PATH:/x-tools/armv7-unknown-linux-gnueabihf/bin
ENV CC_armv7_unknown_linux_gnueabihf=armv7-unknown-linux-gnueabihf-gcc \

View File

@ -30,6 +30,9 @@ RUN CC=gcc CFLAGS="-m32 -Wa,-mrelax-relocations=no" \
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV RUST_CONFIGURE_ARGS \
--musl-root-i586=/musl-i586 \
--musl-root-i686=/musl-i686 \

View File

@ -21,6 +21,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV HOSTS=mips-unknown-linux-gnu
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs

View File

@ -20,6 +20,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV HOSTS=mips64-unknown-linux-gnuabi64
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs

View File

@ -21,6 +21,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV HOSTS=mips64el-unknown-linux-gnuabi64
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs

View File

@ -20,6 +20,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV HOSTS=mipsel-unknown-linux-gnu
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs

View File

@ -25,6 +25,9 @@ USER root
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV PATH=$PATH:/x-tools/powerpc-unknown-linux-gnu/bin
ENV \

View File

@ -26,6 +26,9 @@ USER root
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV PATH=$PATH:/x-tools/powerpc64-unknown-linux-gnu/bin
ENV \

View File

@ -25,6 +25,9 @@ RUN ./build-powerpc64le-toolchain.sh
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV \
AR_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-ar \
CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \

View File

@ -19,6 +19,9 @@ USER root
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV PATH=$PATH:/x-tools/riscv64-unknown-linux-gnu/bin
ENV CC_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-gcc \

View File

@ -25,6 +25,9 @@ USER root
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV PATH=$PATH:/x-tools/s390x-ibm-linux-gnu/bin
ENV \

View File

@ -23,6 +23,9 @@ RUN /tmp/freebsd-toolchain.sh x86_64
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV \
AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd11-ar \
CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd11-clang \

View File

@ -22,6 +22,9 @@ RUN bash /tmp/illumos-toolchain.sh x86_64 gcc
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV \
AR_x86_64_unknown_illumos=x86_64-illumos-ar \
CC_x86_64_unknown_illumos=x86_64-illumos-gcc \

View File

@ -29,6 +29,9 @@ RUN CFLAGS="-Wa,-mrelax-relocations=no -Wa,--compress-debug-sections=none -Wl,--
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV HOSTS=x86_64-unknown-linux-musl
ENV RUST_CONFIGURE_ARGS \

View File

@ -9,6 +9,9 @@ RUN /tmp/build-netbsd-toolchain.sh
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV PATH=$PATH:/x-tools/x86_64-unknown-netbsd/bin
ENV \

View File

@ -20,6 +20,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
RUN mkdir -p /config
RUN echo "[rust]" > /config/nopt-std-config.toml
RUN echo "optimize = false" >> /config/nopt-std-config.toml

View File

@ -20,6 +20,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu
# Exclude some tests that are unlikely to be platform specific, to speed up
# this slow job.

View File

@ -42,5 +42,8 @@ RUN npm install browser-ui-test -g --unsafe-perm=true
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu
ENV RUST_CHECK_TARGET check-aux-and-gui

View File

@ -19,6 +19,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --set rust.ignore-git=false
ENV SCRIPT python3 ../x.py --stage 2 test distcheck
ENV DIST_SRC 1

View File

@ -18,6 +18,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh
COPY host-x86_64/x86_64-gnu-tools/checktools.sh /tmp/
ENV RUST_CONFIGURE_ARGS \

34
src/ci/docker/scripts/cmake.sh Executable file
View File

@ -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