FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
+ automake \
+ bison \
+ bzip2 \
+ ca-certificates \
+ cmake \
+ curl \
+ file \
+ flex \
g++ \
+ gawk \
+ gdb \
+ git \
+ gperf \
+ help2man \
+ libncurses-dev \
+ libtool-bin \
make \
- file \
- curl \
- ca-certificates \
+ patch \
python2.7 \
- git \
- cmake \
sudo \
- gdb \
- xz-utils \
- g++-powerpc64-linux-gnu \
- g++-powerpc64le-linux-gnu
+ texinfo \
+ wget \
+ xz-utils
ENV SCCACHE_DIGEST=7237e38e029342fa27b7ac25412cb9d52554008b12389727320bd533fd7f05b6a96d55485f305caf95e5c8f5f97c3313e10012ccad3e752aba2518f3522ba783
RUN curl -L https://api.pub.build.mozilla.org/tooltool/sha512/$SCCACHE_DIGEST | \
rm dumb-init_*.deb
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
+# Ubuntu 16.04 (this contianer) ships with make 4, but something in the
+# toolchains we build below chokes on that, so go back to make 3
+RUN curl https://ftp.gnu.org/gnu/make/make-3.81.tar.gz | tar xzf - && \
+ cd make-3.81 && \
+ ./configure --prefix=/usr && \
+ make && \
+ make install && \
+ cd .. && \
+ rm -rf make-3.81
+
+RUN curl http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2 | \
+ tar xjf - && \
+ cd crosstool-ng && \
+ ./configure --prefix=/usr/local && \
+ make -j$(nproc) && \
+ make install && \
+ cd .. && \
+ rm -rf crosstool-ng
+
+RUN groupadd -r rustbuild && useradd -m -r -g rustbuild rustbuild
+RUN mkdir /x-tools && chown rustbuild:rustbuild /x-tools
+USER rustbuild
+WORKDIR /tmp
+
+COPY patches/ /tmp/patches/
+COPY powerpc64-linux-gnu.config build-powerpc64-toolchain.sh /tmp/
+RUN ./build-powerpc64-toolchain.sh
+
+USER root
+
+RUN apt-get install -y --no-install-recommends rpm2cpio cpio
+COPY build-powerpc64le-toolchain.sh /tmp/
+RUN ./build-powerpc64le-toolchain.sh
+
+ENV PATH=$PATH:/x-tools/powerpc64-unknown-linux-gnu/bin
+
ENV \
- AR_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-ar \
- CC_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-gcc \
- CXX_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-g++
-
-ENV RUST_CONFIGURE_ARGS \
- --host=powerpc64-unknown-linux-gnu,powerpc64le-unknown-linux-gnu
-ENV SCRIPT \
- python2.7 ../x.py dist \
- --host powerpc64-unknown-linux-gnu \
- --target powerpc64-unknown-linux-gnu \
- --host powerpc64le-unknown-linux-gnu \
- --target powerpc64le-unknown-linux-gnu
+ AR_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-ar \
+ CC_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-gcc \
+ CXX_powerpc64_unknown_linux_gnu=powerpc64-unknown-linux-gnu-g++ \
+ AR_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-ar \
+ CC_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-gcc \
+ CXX_powerpc64le_unknown_linux_gnu=powerpc64le-linux-gnu-g++
+
+ENV HOSTS=powerpc64-unknown-linux-gnu
+ENV HOSTS=$HOSTS,powerpc64le-unknown-linux-gnu
+
+ENV RUST_CONFIGURE_ARGS --host=$HOSTS --enable-extended
+ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS