Bug 1237366 - Import rust-build docker source. r=ted

Import the contents of https://github.com/rillian/rust-build/
commit 120714dd661fc8979011d1edd717042ce66f98f7.
This commit is contained in:
Ralph Giles 2016-01-06 11:26:30 -08:00
parent 414fbb1d64
commit 134c774d20
5 changed files with 84 additions and 0 deletions

View File

@ -0,0 +1,28 @@
FROM quay.io/rillian/rust-buildbot
MAINTAINER Ralph Giles <giles@mozilla.com>
# Update base.
RUN yum upgrade -y
RUN yum clean all
# Install tooltool directly from github.
RUN mkdir /builds
ADD https://raw.githubusercontent.com/mozilla/build-tooltool/master/tooltool.py /build/tooltool.py
RUN chmod +rx /build/tooltool.py
# Add build scripts.
ADD checkout-sources.sh build.sh /build/
RUN chmod +x /build/*
# Create user for doing the build.
ENV USER worker
ENV HOME /home/${USER}
RUN useradd -d ${HOME} -m ${USER}
# Set up the user's tree
WORKDIR ${HOME}
# Invoke our build scripts by default, but allow other commands.
USER ${USER}
CMD /build/checkout-sources.sh && /build/build.sh

View File

@ -0,0 +1,2 @@
all: Dockerfile checkout-sources.sh build.sh
docker build -t rust-build .

View File

@ -0,0 +1,2 @@
This is a docker script for building rust toolchains for
use in Mozilla's build clusters.

View File

@ -0,0 +1,37 @@
#!/bin/bash -vex
set -x -e
: WORKSPACE ${WORKSPACE:=/home/worker}
CORES=$(nproc || grep -c ^processor /proc/cpuinfo || sysctl -n hw.ncpu)
set -v
# Configure and build rust.
OPTIONS="--enable-rpath --enable-llvm-static-stdcpp --disable-docs"
M32="i686-unknown-linux-gnu"
M64="x86_64-unknown-linux-gnu"
mkdir -p ${WORKSPACE}/rust-build
pushd ${WORKSPACE}/rust-build
mkdir -p ${M32}
pushd ${M32}
${WORKSPACE}/rust/configure --prefix=${PWD}/../rustc --build=${M32} ${OPTIONS}
make -j ${CORES}
popd
mkdir -p ${M64}
pushd ${M64}
${WORKSPACE}/rust/configure --prefix=${PWD}/../rustc --build=${M64} ${OPTIONS}
make -j ${CORES}
make install
popd
# Copy 32 bit stdlib into the install directory for cross support.
cp -r ${M32}/${M32}/stage2/lib/rustlib/${M32} rustc/lib/rustlib/
popd
# Package the toolchain for upload.
pushd ${WORKSPACE}/rust-build
tar cvJf rustc.tar.xz rustc/*
/build/tooltool.py add --visibility=public rustc.tar.xz
popd

View File

@ -0,0 +1,15 @@
#!/bin/bash -vex
set -x -e
# Inputs, with defaults
: RUST_REPOSITORY ${RUST_REPOSITORY:=https://github.com/rust-lang/rust}
: RUST_BRANCH ${RUST_BRANCH:=stable}
: WORKSPACE ${WORKSPACE:=/home/worker}
set -v
# Check out rust sources
git clone $RUST_REPOSITORY -b $RUST_BRANCH ${WORKSPACE}/rust