Skip to content

Commit

Permalink
Auto merge of rust-lang#68037 - msizanoen1:riscv-ci, r=alexcrichton
Browse files Browse the repository at this point in the history
Distribution CI for riscv64gc-unknown-linux-gnu

This modifies `dist-various-1` to build the standard library for RISC-V GNU/Linux.

r? @alexcrichton
  • Loading branch information
bors committed Jan 18, 2020
2 parents fb4ac14 + 451c97b commit 1b117d7
Show file tree
Hide file tree
Showing 4 changed files with 977 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/ci/docker/dist-various-1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,24 @@ FROM ubuntu:16.04

RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
automake \
bison \
bzip2 \
flex \
help2man \
libtool-bin \
texinfo \
unzip \
wget \
xz-utils \
libncurses-dev \
gawk \
make \
file \
curl \
ca-certificates \
python2.7 \
python3 \
git \
cmake \
sudo \
Expand Down Expand Up @@ -35,6 +48,18 @@ RUN add-apt-repository ppa:team-gcc-arm-embedded/ppa && \
apt-get update && \
apt-get install -y --no-install-recommends gcc-arm-embedded

COPY scripts/rustbuild-setup.sh dist-various-1/build-riscv-toolchain.sh dist-various-1/riscv64-unknown-linux-gnu.config dist-various-1/crosstool-ng.sh /build/
RUN ./crosstool-ng.sh

# Crosstool-ng will refuse to build as root
RUN sh ./rustbuild-setup.sh
USER rustbuild

RUN ./build-riscv-toolchain.sh

USER root
ENV PATH=/x-tools/riscv64-unknown-linux-gnu/bin:$PATH

COPY dist-various-1/build-rumprun.sh /build
RUN ./build-rumprun.sh

Expand Down Expand Up @@ -129,6 +154,7 @@ ENV TARGETS=$TARGETS,riscv32imc-unknown-none-elf
ENV TARGETS=$TARGETS,riscv32imac-unknown-none-elf
ENV TARGETS=$TARGETS,riscv64imac-unknown-none-elf
ENV TARGETS=$TARGETS,riscv64gc-unknown-none-elf
ENV TARGETS=$TARGETS,riscv64gc-unknown-linux-gnu
ENV TARGETS=$TARGETS,armebv7r-none-eabi
ENV TARGETS=$TARGETS,armebv7r-none-eabihf
ENV TARGETS=$TARGETS,armv7r-none-eabi
Expand All @@ -147,6 +173,9 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
CC_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc \
AR_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-ar \
CXX_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++ \
CC_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-gcc \
AR_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-ar \
CXX_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-g++ \
CC_riscv32i_unknown_none_elf=false \
CC_riscv32imc_unknown_none_elf=false \
CC_riscv32imac_unknown_none_elf=false \
Expand Down
27 changes: 27 additions & 0 deletions src/ci/docker/dist-various-1/build-riscv-toolchain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env 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
rm /tmp/build.log
trap - ERR
kill $PING_LOOP_PID
set -x
}

mkdir -p /tmp/build-riscv
cp riscv64-unknown-linux-gnu.config /tmp/build-riscv/.config
cd /tmp/build-riscv
hide_output ct-ng build
cd ..
rm -rf build-riscv
13 changes: 13 additions & 0 deletions src/ci/docker/dist-various-1/crosstool-ng.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -ex

# Mirrored from https://github.com/crosstool-ng/crosstool-ng/archive/crosstool-ng-1.24.0.tar.gz
url="https://ci-mirrors.rust-lang.org/rustc/crosstool-ng-1.24.0.tar.gz"
curl -Lf $url | tar xzf -
cd crosstool-ng-crosstool-ng-1.24.0
./bootstrap
./configure --prefix=/usr/local
make -j$(nproc)
make install
cd ..
rm -rf crosstool-ng-crosstool-ng-1.24.0
Loading

0 comments on commit 1b117d7

Please sign in to comment.