diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/ci/docker/host-x86_64/dist-various-2 | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/ci/docker/host-x86_64/dist-various-2')
6 files changed, 371 insertions, 0 deletions
diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile new file mode 100644 index 000000000..6f9980dbc --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile @@ -0,0 +1,126 @@ +FROM ubuntu:20.04 + +COPY scripts/cross-apt-packages.sh /scripts/ +RUN sh /scripts/cross-apt-packages.sh + +# Enable source repositories, which are disabled by default on Ubuntu >= 18.04 +RUN sed -i 's/^# deb-src/deb-src/' /etc/apt/sources.list + +RUN apt-get update && apt-get build-dep -y clang llvm && apt-get install -y --no-install-recommends \ + build-essential \ +# gcc-multilib can not be installed together with gcc-arm-linux-gnueabi + g++-8-multilib \ + libedit-dev \ + libgmp-dev \ + libisl-dev \ + libmpc-dev \ + libmpfr-dev \ + libtinfo5 \ + ninja-build \ + nodejs \ + python3-dev \ + software-properties-common \ + unzip \ + # Needed for apt-key to work: + dirmngr \ + gpg-agent \ + g++-8-arm-linux-gnueabi + +RUN apt-key adv --batch --yes --keyserver keyserver.ubuntu.com --recv-keys 74DA7924C5513486 +RUN add-apt-repository -y 'deb https://apt.dilos.org/dilos dilos2 main' + +ENV \ + AR_x86_64_fuchsia=x86_64-fuchsia-ar \ + CC_x86_64_fuchsia=x86_64-fuchsia-clang \ + CXX_x86_64_fuchsia=x86_64-fuchsia-clang++ \ + AR_aarch64_fuchsia=aarch64-fuchsia-ar \ + CC_aarch64_fuchsia=aarch64-fuchsia-clang \ + CXX_aarch64_fuchsia=aarch64-fuchsia-clang++ \ + AR_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-ar \ + CC_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-gcc \ + CXX_sparcv9_sun_solaris=sparcv9-sun-solaris2.10-g++ \ + AR_x86_64_pc_solaris=x86_64-pc-solaris2.10-ar \ + CC_x86_64_pc_solaris=x86_64-pc-solaris2.10-gcc \ + CXX_x86_64_pc_solaris=x86_64-pc-solaris2.10-g++ \ + AR_x86_64_sun_solaris=x86_64-sun-solaris2.10-ar \ + CC_x86_64_sun_solaris=x86_64-sun-solaris2.10-gcc \ + CXX_x86_64_sun_solaris=x86_64-sun-solaris2.10-g++ \ + CC_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-gcc-8 \ + CXX_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-g++-8 \ + AR_x86_64_fortanix_unknown_sgx=ar \ + CC_x86_64_fortanix_unknown_sgx=clang-11 \ + CFLAGS_x86_64_fortanix_unknown_sgx="-D__ELF__ -isystem/usr/include/x86_64-linux-gnu -mlvi-hardening -mllvm -x86-experimental-lvi-inline-asm-hardening" \ + CXX_x86_64_fortanix_unknown_sgx=clang++-11 \ + CXXFLAGS_x86_64_fortanix_unknown_sgx="-D__ELF__ -isystem/usr/include/x86_64-linux-gnu -mlvi-hardening -mllvm -x86-experimental-lvi-inline-asm-hardening" \ + AR_i686_unknown_freebsd=i686-unknown-freebsd12-ar \ + CC_i686_unknown_freebsd=i686-unknown-freebsd12-clang \ + CXX_i686_unknown_freebsd=i686-unknown-freebsd12-clang++ \ + CC=gcc-8 \ + CXX=g++-8 + +WORKDIR /build +COPY scripts/musl.sh /build +RUN env \ + CC=arm-linux-gnueabi-gcc-8 CFLAGS="-march=armv7-a" \ + CXX=arm-linux-gnueabi-g++-8 CXXFLAGS="-march=armv7-a" \ + bash musl.sh armv7 && \ + rm -rf /build/* + +WORKDIR /tmp +COPY host-x86_64/dist-various-2/shared.sh /tmp/ +COPY host-x86_64/dist-various-2/build-fuchsia-toolchain.sh /tmp/ +RUN /tmp/build-fuchsia-toolchain.sh +COPY host-x86_64/dist-various-2/build-solaris-toolchain.sh /tmp/ +RUN /tmp/build-solaris-toolchain.sh x86_64 amd64 solaris-i386 pc +# Build deprecated target 'x86_64-sun-solaris2.10' until removed +RUN /tmp/build-solaris-toolchain.sh x86_64 amd64 solaris-i386 sun +RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc sun +COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/ +RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh + +COPY host-x86_64/dist-various-2/build-wasi-toolchain.sh /tmp/ +RUN /tmp/build-wasi-toolchain.sh + +COPY scripts/freebsd-toolchain.sh /tmp/ +RUN /tmp/freebsd-toolchain.sh i686 + +COPY scripts/sccache.sh /scripts/ +RUN sh /scripts/sccache.sh + +ENV CARGO_TARGET_X86_64_FUCHSIA_AR /usr/local/bin/llvm-ar +ENV CARGO_TARGET_X86_64_FUCHSIA_RUSTFLAGS \ +-C link-arg=--sysroot=/usr/local/x86_64-fuchsia \ +-C link-arg=-L/usr/local/x86_64-fuchsia/lib \ +-C link-arg=-L/usr/local/lib/x86_64-fuchsia/lib +ENV CARGO_TARGET_AARCH64_FUCHSIA_AR /usr/local/bin/llvm-ar +ENV CARGO_TARGET_AARCH64_FUCHSIA_RUSTFLAGS \ +-C link-arg=--sysroot=/usr/local/aarch64-fuchsia \ +-C link-arg=-L/usr/local/aarch64-fuchsia/lib \ +-C link-arg=-L/usr/local/lib/aarch64-fuchsia/lib + +ENV TARGETS=x86_64-fuchsia +ENV TARGETS=$TARGETS,aarch64-fuchsia +ENV TARGETS=$TARGETS,wasm32-unknown-unknown +ENV TARGETS=$TARGETS,wasm32-wasi +ENV TARGETS=$TARGETS,sparcv9-sun-solaris +ENV TARGETS=$TARGETS,x86_64-pc-solaris +ENV TARGETS=$TARGETS,x86_64-sun-solaris +ENV TARGETS=$TARGETS,x86_64-unknown-linux-gnux32 +ENV TARGETS=$TARGETS,x86_64-fortanix-unknown-sgx +ENV TARGETS=$TARGETS,nvptx64-nvidia-cuda +ENV TARGETS=$TARGETS,armv7-unknown-linux-gnueabi +ENV TARGETS=$TARGETS,armv7-unknown-linux-musleabi +ENV TARGETS=$TARGETS,i686-unknown-freebsd +ENV TARGETS=$TARGETS,x86_64-unknown-none + +# As per https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1300211 +# we need asm in the search path for gcc-8 (for gnux32) but not in the search path of the +# cross compilers. +# Luckily one of the folders is /usr/local/include so symlink /usr/include/asm-generic there +RUN ln -s /usr/include/asm-generic /usr/local/include/asm + +ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --disable-docs \ + --set target.wasm32-wasi.wasi-root=/wasm32-wasi \ + --musl-root-armv7=/musl-armv7 + +ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS diff --git a/src/ci/docker/host-x86_64/dist-various-2/build-fuchsia-toolchain.sh b/src/ci/docker/host-x86_64/dist-various-2/build-fuchsia-toolchain.sh new file mode 100755 index 000000000..73acdf5be --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-various-2/build-fuchsia-toolchain.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +set -ex +source shared.sh + +ZIRCON=e9a26dbc70d631029f8ee9763103910b7e3a2fe1 + +mkdir -p zircon +pushd zircon > /dev/null + +# Download sources +git init +git remote add origin https://github.com/rust-lang-nursery/mirror-google-fuchsia-zircon +git fetch --depth=1 origin $ZIRCON +git reset --hard FETCH_HEAD + +# Download toolchain +./scripts/download-toolchain +chmod -R a+rx prebuilt/downloads/clang+llvm-x86_64-linux +cp -a prebuilt/downloads/clang+llvm-x86_64-linux/. /usr/local + +build() { + local arch="$1" + + case "${arch}" in + x86_64) tgt="zircon-pc-x86-64" ;; + aarch64) tgt="zircon-qemu-arm64" ;; + esac + + hide_output make -j$(getconf _NPROCESSORS_ONLN) $tgt + dst=/usr/local/${arch}-fuchsia + mkdir -p $dst + cp -a build-${tgt}/sysroot/include $dst/ + cp -a build-${tgt}/sysroot/lib $dst/ +} + +# Build sysroot +for arch in x86_64 aarch64; do + build ${arch} +done + +popd > /dev/null +rm -rf zircon + +for arch in x86_64 aarch64; do + for tool in clang clang++; do + cat >/usr/local/bin/${arch}-fuchsia-${tool} <<EOF +#!/bin/sh +${tool} --target=${arch}-fuchsia --sysroot=/usr/local/${arch}-fuchsia "\$@" +EOF + chmod +x /usr/local/bin/${arch}-fuchsia-${tool} + done + ln -s /usr/local/bin/llvm-ar /usr/local/bin/${arch}-fuchsia-ar +done diff --git a/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh b/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh new file mode 100755 index 000000000..cf784a66a --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh @@ -0,0 +1,113 @@ +#!/usr/bin/env bash + +set -ex +source shared.sh + +ARCH=$1 +LIB_ARCH=$2 +APT_ARCH=$3 +MANUFACTURER=$4 +BINUTILS=2.28.1 +GCC=6.5.0 + +TARGET=${ARCH}-${MANUFACTURER}-solaris2.10 + +# First up, build binutils +mkdir binutils +cd binutils + +curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.xz | tar xJf - +mkdir binutils-build +cd binutils-build +hide_output ../binutils-$BINUTILS/configure --target=$TARGET +hide_output make -j10 +hide_output make install + +cd ../.. +rm -rf binutils + +# Next, download and install the relevant solaris packages +mkdir solaris +cd solaris + +dpkg --add-architecture $APT_ARCH +apt-get update +apt-get download $(apt-cache depends --recurse --no-replaces \ + libc:$APT_ARCH \ + liblgrp-dev:$APT_ARCH \ + liblgrp:$APT_ARCH \ + libm-dev:$APT_ARCH \ + libpthread:$APT_ARCH \ + libresolv:$APT_ARCH \ + librt:$APT_ARCH \ + libsendfile-dev:$APT_ARCH \ + libsendfile:$APT_ARCH \ + libsocket:$APT_ARCH \ + system-crt:$APT_ARCH \ + system-header:$APT_ARCH \ + | grep "^\w") + +for deb in *$APT_ARCH.deb; do + dpkg -x $deb . +done + +# The -dev packages are not available from the apt repository we're using. +# However, those packages are just symlinks from *.so to *.so.<version>. +# This makes all those symlinks. +for lib in $(find -name '*.so.*'); do + target=${lib%.so.*}.so + [ -e $target ] || ln -s ${lib##*/} $target +done + +# Remove Solaris 11 functions that are optionally used by libbacktrace. +# This is for Solaris 10 compatibility. +rm usr/include/link.h +patch -p0 << 'EOF' +--- usr/include/string.h ++++ usr/include/string10.h +@@ -93 +92,0 @@ +-extern size_t strnlen(const char *, size_t); +EOF + +mkdir /usr/local/$TARGET/usr +mv usr/include /usr/local/$TARGET/usr/include +mv usr/lib/$LIB_ARCH/* /usr/local/$TARGET/lib +mv lib/$LIB_ARCH/* /usr/local/$TARGET/lib + +ln -s usr/include /usr/local/$TARGET/sys-include +ln -s usr/include /usr/local/$TARGET/include + +cd .. +rm -rf solaris + +# Finally, download and build gcc to target solaris +mkdir gcc +cd gcc + +curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.xz | tar xJf - +cd gcc-$GCC + +mkdir ../gcc-build +cd ../gcc-build +hide_output ../gcc-$GCC/configure \ + --enable-languages=c,c++ \ + --target=$TARGET \ + --with-gnu-as \ + --with-gnu-ld \ + --disable-multilib \ + --disable-nls \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libvtv \ + --disable-libcilkrts \ + --disable-libada \ + --disable-libsanitizer \ + --disable-libquadmath-support \ + --disable-lto + +hide_output make -j10 +hide_output make install + +cd ../.. +rm -rf gcc diff --git a/src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh b/src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh new file mode 100755 index 000000000..36c94458d --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -ex + +# Originally from https://github.com/llvm/llvm-project/releases/download/llvmorg-14.0.0/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz +curl https://ci-mirrors.rust-lang.org/rustc/2022-05-10-clang%2Bllvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz | \ + tar xJf - +bin="$PWD/clang+llvm-14.0.0-x86_64-linux-gnu-ubuntu-18.04/bin" + +git clone https://github.com/WebAssembly/wasi-libc + +cd wasi-libc +git reset --hard 9886d3d6200fcc3726329966860fc058707406cd +make -j$(nproc) \ + CC="$bin/clang" \ + NM="$bin/llvm-nm" \ + AR="$bin/llvm-ar" \ + INSTALL_DIR=/wasm32-wasi \ + install + +cd .. +rm -rf wasi-libc +rm -rf clang+llvm* diff --git a/src/ci/docker/host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh b/src/ci/docker/host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh new file mode 100755 index 000000000..eabff8728 --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -eu +source shared.sh + +target="x86_64-fortanix-unknown-sgx" + +install_prereq() { + curl https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add - + add-apt-repository -y 'deb https://apt.llvm.org/focal/ llvm-toolchain-focal-11 main' + apt-get update + apt-get install -y --no-install-recommends \ + build-essential \ + ca-certificates \ + cmake \ + git \ + clang-11 +} + +hide_output install_prereq diff --git a/src/ci/docker/host-x86_64/dist-various-2/shared.sh b/src/ci/docker/host-x86_64/dist-various-2/shared.sh new file mode 100644 index 000000000..291f26bda --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-various-2/shared.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +hide_output() { + { set +x; } 2>/dev/null + 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 + set -x +} + +# Copied from ../../shared.sh +function retry { + echo "Attempting with retry:" "$@" + local n=1 + local max=5 + while true; do + "$@" && break || { + if [[ $n -lt $max ]]; then + sleep $n # don't retry immediately + ((n++)) + echo "Command failed. Attempt $n/$max:" + else + echo "The command has failed after $n attempts." + return 1 + fi + } + done +} |