├── i686-unknown-linux-gnu ├── cargo-config └── Dockerfile ├── x86_64-unknown-linux-gnu ├── cargo-config └── Dockerfile ├── x86_64-unknown-linux-musl ├── cargo-config ├── docker-test.sh └── Dockerfile ├── support ├── install-rust.sh ├── android-accept-licenses.sh ├── android-install-ndk.sh └── android-install-sdk.sh ├── i686-pc-windows-gnu ├── cargo-config └── Dockerfile ├── x86_64-sun-solaris ├── cargo-config └── Dockerfile ├── mips-unknown-linux-gnu ├── cargo-config └── Dockerfile ├── sparcv9-sun-solaris ├── cargo-config └── Dockerfile ├── x86_64-pc-windows-gnu ├── cargo-config └── Dockerfile ├── arm-linux-androideabi ├── cargo-config └── Dockerfile ├── mipsel-unknown-linux-gnu ├── cargo-config └── Dockerfile ├── x86_64-rumprun-netbsd ├── cargo-config └── Dockerfile ├── x86_64-unknown-netbsd ├── cargo-config └── Dockerfile ├── aarch64-unknown-linux-gnu ├── cargo-config └── Dockerfile ├── arm-unknown-linux-gnueabi ├── cargo-config └── Dockerfile ├── powerpc-unknown-linux-gnu ├── cargo-config └── Dockerfile ├── x86_64-unknown-freebsd ├── cargo-config └── Dockerfile ├── arm-unknown-linux-gnueabihf ├── cargo-config └── Dockerfile ├── powerpc64-unknown-linux-gnu ├── cargo-config └── Dockerfile ├── armv7-unknown-linux-gnueabihf ├── cargo-config └── Dockerfile ├── powerpc64le-unknown-linux-gnu ├── cargo-config └── Dockerfile ├── prebuilt ├── rumprun │ └── Dockerfile ├── README.md ├── freebsd │ ├── Dockerfile │ └── build-toolchain.sh ├── freebsd11 │ ├── Dockerfile │ └── build-toolchain.sh └── netbsd │ ├── Dockerfile │ └── build-netbsd-toolchain.sh ├── test.sh ├── docker-test.sh ├── .travis.yml ├── LICENSE-MIT ├── README.md └── LICENSE-APACHE /i686-unknown-linux-gnu/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "i686-unknown-linux-gnu" 3 | -------------------------------------------------------------------------------- /x86_64-unknown-linux-gnu/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "x86_64-unknown-linux-gnu" 3 | -------------------------------------------------------------------------------- /x86_64-unknown-linux-musl/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "x86_64-unknown-linux-musl" 3 | -------------------------------------------------------------------------------- /support/install-rust.sh: -------------------------------------------------------------------------------- 1 | 2 | curl https://sh.rustup.rs | sh -s -- -y --default-toolchain=nightly 3 | rustup target add $1 4 | -------------------------------------------------------------------------------- /i686-pc-windows-gnu/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "i686-pc-windows-gnu" 3 | 4 | [target.i686-pc-windows-gnu] 5 | linker = "i686-w64-mingw32-gcc" 6 | -------------------------------------------------------------------------------- /x86_64-sun-solaris/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "x86_64-sun-solaris" 3 | 4 | [target.x86_64-sun-solaris] 5 | linker = "x86_64-sun-solaris2.10-gcc" 6 | -------------------------------------------------------------------------------- /mips-unknown-linux-gnu/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "mips-unknown-linux-gnu" 3 | 4 | [target.mips-unknown-linux-gnu] 5 | linker = "mips-linux-gnu-gcc" 6 | -------------------------------------------------------------------------------- /sparcv9-sun-solaris/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "sparcv9-sun-solaris" 3 | 4 | [target.sparcv9-sun-solaris] 5 | linker = "sparcv9-sun-solaris2.10-gcc" 6 | -------------------------------------------------------------------------------- /x86_64-pc-windows-gnu/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "x86_64-pc-windows-gnu" 3 | 4 | [target.x86_64-pc-windows-gnu] 5 | linker = "x86_64-w64-mingw32-gcc" 6 | -------------------------------------------------------------------------------- /arm-linux-androideabi/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "arm-linux-androideabi" 3 | 4 | [target.arm-linux-androideabi] 5 | linker = "arm-linux-androideabi-gcc" 6 | -------------------------------------------------------------------------------- /mipsel-unknown-linux-gnu/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "mipsel-unknown-linux-gnu" 3 | 4 | [target.mipsel-unknown-linux-gnu] 5 | linker = "mipsel-linux-gnu-gcc" 6 | -------------------------------------------------------------------------------- /x86_64-rumprun-netbsd/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "x86_64-rumprun-netbsd" 3 | 4 | [target.x86_64-rumprun-netbsd] 5 | linker = "x86_64-rumprun-netbsd-gcc" 6 | -------------------------------------------------------------------------------- /x86_64-unknown-netbsd/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "x86_64-unknown-netbsd" 3 | 4 | [target.x86_64-unknown-netbsd] 5 | linker = "x86_64--netbsd-gcc-sysroot" 6 | -------------------------------------------------------------------------------- /aarch64-unknown-linux-gnu/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "aarch64-unknown-linux-gnu" 3 | 4 | [target.aarch64-unknown-linux-gnu] 5 | linker = "aarch64-linux-gnu-gcc" 6 | -------------------------------------------------------------------------------- /arm-unknown-linux-gnueabi/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "arm-unknown-linux-gnueabi" 3 | 4 | [target.arm-unknown-linux-gnueabi] 5 | linker = "arm-linux-gnueabi-gcc" 6 | -------------------------------------------------------------------------------- /powerpc-unknown-linux-gnu/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "powerpc-unknown-linux-gnu" 3 | 4 | [target.powerpc-unknown-linux-gnu] 5 | linker = "powerpc-linux-gnu-gcc" 6 | -------------------------------------------------------------------------------- /x86_64-unknown-freebsd/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "x86_64-unknown-freebsd" 3 | 4 | [target.x86_64-unknown-freebsd] 5 | linker = "x86_64-unknown-freebsd10-gcc" 6 | -------------------------------------------------------------------------------- /arm-unknown-linux-gnueabihf/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "arm-unknown-linux-gnueabihf" 3 | 4 | [target.arm-unknown-linux-gnueabihf] 5 | linker = "arm-linux-gnueabihf-gcc" 6 | -------------------------------------------------------------------------------- /powerpc64-unknown-linux-gnu/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "powerpc64-unknown-linux-gnu" 3 | 4 | [target.powerpc64-unknown-linux-gnu] 5 | linker = "powerpc64-linux-gnu-gcc" 6 | -------------------------------------------------------------------------------- /armv7-unknown-linux-gnueabihf/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "armv7-unknown-linux-gnueabihf" 3 | 4 | [target.armv7-unknown-linux-gnueabihf] 5 | linker = "arm-linux-gnueabihf-gcc" 6 | -------------------------------------------------------------------------------- /powerpc64le-unknown-linux-gnu/cargo-config: -------------------------------------------------------------------------------- 1 | [build] 2 | target = "powerpc64le-unknown-linux-gnu" 3 | 4 | [target.powerpc64le-unknown-linux-gnu] 5 | linker = "powerpc64le-linux-gnu-gcc" 6 | -------------------------------------------------------------------------------- /x86_64-unknown-linux-musl/docker-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ex 4 | 5 | cargo new --bin foo 6 | (cd foo && cargo build) 7 | ldd foo/target/x86_64-unknown-linux-musl/debug/foo 2>&1 | grep 'not a dynamic' 8 | -------------------------------------------------------------------------------- /support/android-accept-licenses.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/expect -f 2 | 3 | set timeout 1800 4 | set cmd [lindex $argv 0] 5 | set licenses [lindex $argv 1] 6 | 7 | spawn {*}$cmd 8 | expect { 9 | "Do you accept the license '*'*" { 10 | exp_send "y\r" 11 | exp_continue 12 | } 13 | eof 14 | } 15 | -------------------------------------------------------------------------------- /support/android-install-ndk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ex 4 | 5 | curl -O http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin 6 | chmod +x android-ndk-r10e-linux-x86_64.bin 7 | ./android-ndk-r10e-linux-x86_64.bin > /dev/null 8 | 9 | bash android-ndk-r10e/build/tools/make-standalone-toolchain.sh "$@" 10 | 11 | rm -rf ./android-ndk-r10e-linux-x86_64.bin ./android-ndk-r10e 12 | -------------------------------------------------------------------------------- /i686-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get -y update 4 | RUN apt-get -y install curl file gcc-multilib 5 | 6 | ENV CARGO_HOME=/usr/local/cargo \ 7 | RUSTUP_HOME=/usr/local/rustup \ 8 | PATH=/usr/local/cargo/bin:$PATH 9 | COPY support/install-rust.sh /tmp/ 10 | RUN sh /tmp/install-rust.sh i686-unknown-linux-gnu 11 | COPY i686-unknown-linux-gnu/cargo-config /.cargo/config 12 | -------------------------------------------------------------------------------- /x86_64-sun-solaris/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM bgermann/port-prebuilt-solaris:2017-11-18 2 | 3 | RUN apt-get -y update && apt-get -y install curl gcc 4 | 5 | ENV CARGO_HOME=/usr/local/cargo \ 6 | RUSTUP_HOME=/usr/local/rustup \ 7 | PATH=/usr/local/cargo/bin:$PATH 8 | 9 | COPY support/install-rust.sh /tmp/ 10 | RUN sh /tmp/install-rust.sh x86_64-sun-solaris 11 | COPY x86_64-sun-solaris/cargo-config /.cargo/config 12 | -------------------------------------------------------------------------------- /sparcv9-sun-solaris/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM bgermann/port-prebuilt-solaris:2017-11-18 2 | 3 | RUN apt-get -y update && apt-get -y install curl gcc 4 | 5 | ENV CARGO_HOME=/usr/local/cargo \ 6 | RUSTUP_HOME=/usr/local/rustup \ 7 | PATH=/usr/local/cargo/bin:$PATH 8 | 9 | COPY support/install-rust.sh /tmp/ 10 | RUN sh /tmp/install-rust.sh sparcv9-sun-solaris 11 | COPY sparcv9-sun-solaris/cargo-config /.cargo/config 12 | -------------------------------------------------------------------------------- /mips-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get -y update 4 | RUN apt-get -y install curl file gcc gcc-mips-linux-gnu 5 | 6 | ENV CARGO_HOME=/usr/local/cargo \ 7 | RUSTUP_HOME=/usr/local/rustup \ 8 | PATH=/usr/local/cargo/bin:$PATH 9 | COPY support/install-rust.sh /tmp/ 10 | RUN sh /tmp/install-rust.sh mips-unknown-linux-gnu 11 | COPY mips-unknown-linux-gnu/cargo-config /.cargo/config 12 | -------------------------------------------------------------------------------- /x86_64-pc-windows-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get -y update 4 | RUN apt-get -y install curl file gcc gcc-mingw-w64-x86-64 5 | 6 | ENV CARGO_HOME=/usr/local/cargo \ 7 | RUSTUP_HOME=/usr/local/rustup \ 8 | PATH=/usr/local/cargo/bin:$PATH 9 | COPY support/install-rust.sh /tmp/ 10 | RUN sh /tmp/install-rust.sh x86_64-pc-windows-gnu 11 | COPY x86_64-pc-windows-gnu/cargo-config /.cargo/config 12 | -------------------------------------------------------------------------------- /x86_64-rumprun-netbsd/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alexcrichton/port-prebuilt-rumprun:2017-09-16 2 | 3 | RUN apt-get -y update && apt-get -y install curl gcc 4 | 5 | ENV CARGO_HOME=/usr/local/cargo \ 6 | RUSTUP_HOME=/usr/local/rustup \ 7 | PATH=/usr/local/cargo/bin:$PATH 8 | COPY support/install-rust.sh /tmp/ 9 | RUN sh /tmp/install-rust.sh x86_64-rumprun-netbsd 10 | COPY x86_64-rumprun-netbsd/cargo-config /.cargo/config 11 | -------------------------------------------------------------------------------- /x86_64-unknown-linux-musl/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get -y update 4 | RUN apt-get -y install curl file gcc musl-tools 5 | 6 | ENV CARGO_HOME=/usr/local/cargo \ 7 | RUSTUP_HOME=/usr/local/rustup \ 8 | PATH=/usr/local/cargo/bin:$PATH 9 | COPY support/install-rust.sh /tmp/ 10 | RUN sh /tmp/install-rust.sh x86_64-unknown-linux-musl 11 | COPY x86_64-unknown-linux-musl/cargo-config /.cargo/config 12 | -------------------------------------------------------------------------------- /x86_64-unknown-netbsd/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alexcrichton/port-prebuilt-netbsd:2017-09-16 2 | 3 | RUN apt-get -y update && apt-get -y install curl gcc 4 | 5 | ENV CARGO_HOME=/usr/local/cargo \ 6 | RUSTUP_HOME=/usr/local/rustup \ 7 | PATH=/usr/local/cargo/bin:$PATH 8 | COPY support/install-rust.sh /tmp/ 9 | RUN sh /tmp/install-rust.sh x86_64-unknown-netbsd 10 | COPY x86_64-unknown-netbsd/cargo-config /.cargo/config 11 | -------------------------------------------------------------------------------- /mipsel-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get -y update 4 | RUN apt-get -y install curl file gcc gcc-mipsel-linux-gnu 5 | 6 | ENV CARGO_HOME=/usr/local/cargo \ 7 | RUSTUP_HOME=/usr/local/rustup \ 8 | PATH=/usr/local/cargo/bin:$PATH 9 | COPY support/install-rust.sh /tmp/ 10 | RUN sh /tmp/install-rust.sh mipsel-unknown-linux-gnu 11 | COPY mipsel-unknown-linux-gnu/cargo-config /.cargo/config 12 | -------------------------------------------------------------------------------- /x86_64-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get -y update 4 | RUN apt-get -y install curl file gcc 5 | 6 | ENV CARGO_HOME=/usr/local/cargo \ 7 | RUSTUP_HOME=/usr/local/rustup \ 8 | PATH=/usr/local/cargo/bin:$PATH 9 | COPY support/install-rust.sh /tmp/ 10 | RUN curl https://sh.rustup.rs | sh -s -- -y --default-toolchain=nightly 11 | COPY x86_64-unknown-linux-gnu/cargo-config /.cargo/config 12 | -------------------------------------------------------------------------------- /aarch64-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get -y update 4 | RUN apt-get -y install curl file gcc gcc-aarch64-linux-gnu 5 | 6 | ENV CARGO_HOME=/usr/local/cargo \ 7 | RUSTUP_HOME=/usr/local/rustup \ 8 | PATH=/usr/local/cargo/bin:$PATH 9 | COPY support/install-rust.sh /tmp/ 10 | RUN sh /tmp/install-rust.sh aarch64-unknown-linux-gnu 11 | COPY aarch64-unknown-linux-gnu/cargo-config /.cargo/config 12 | -------------------------------------------------------------------------------- /powerpc-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get update 4 | RUN apt-get install -y curl file gcc gcc-powerpc-linux-gnu 5 | 6 | ENV CARGO_HOME=/usr/local/cargo \ 7 | RUSTUP_HOME=/usr/local/rustup \ 8 | PATH=/usr/local/cargo/bin:$PATH 9 | COPY support/install-rust.sh /tmp/ 10 | RUN sh /tmp/install-rust.sh powerpc-unknown-linux-gnu 11 | COPY powerpc-unknown-linux-gnu/cargo-config /.cargo/config 12 | -------------------------------------------------------------------------------- /x86_64-unknown-freebsd/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alexcrichton/port-prebuilt-freebsd:2017-09-16 2 | 3 | RUN apt-get -y update && apt-get -y install curl gcc 4 | 5 | ENV CARGO_HOME=/usr/local/cargo \ 6 | RUSTUP_HOME=/usr/local/rustup \ 7 | PATH=/usr/local/cargo/bin:$PATH 8 | 9 | COPY support/install-rust.sh /tmp/ 10 | RUN sh /tmp/install-rust.sh x86_64-unknown-freebsd 11 | COPY x86_64-unknown-freebsd/cargo-config /.cargo/config 12 | -------------------------------------------------------------------------------- /powerpc64le-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get update 4 | RUN apt-get install -y curl file gcc gcc-powerpc64le-linux-gnu 5 | 6 | ENV CARGO_HOME=/usr/local/cargo \ 7 | RUSTUP_HOME=/usr/local/rustup \ 8 | PATH=/usr/local/cargo/bin:$PATH 9 | COPY support/install-rust.sh /tmp/ 10 | RUN sh /tmp/install-rust.sh powerpc64le-unknown-linux-gnu 11 | COPY powerpc64le-unknown-linux-gnu/cargo-config /.cargo/config 12 | -------------------------------------------------------------------------------- /prebuilt/rumprun/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get update 4 | RUN apt-get install -y curl file g++ git make zlib1g-dev 5 | 6 | RUN git clone https://github.com/rumpkernel/rumprun 7 | WORKDIR /rumprun 8 | RUN git reset --hard 39a97f37a85e44c69b662f6b97b688fbe892603b 9 | RUN git submodule update --init 10 | RUN CC=cc ./build-rr.sh -d /usr/local hw 11 | WORKDIR / 12 | 13 | FROM ubuntu:16.04 14 | COPY --from=0 /usr/local /usr/local 15 | -------------------------------------------------------------------------------- /powerpc64-unknown-linux-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get update 4 | RUN apt-get install -y curl file gcc gcc-powerpc64-linux-gnu 5 | 6 | ENV CARGO_HOME=/usr/local/cargo \ 7 | RUSTUP_HOME=/usr/local/rustup \ 8 | PATH=/usr/local/cargo/bin:$PATH 9 | COPY support/install-rust.sh /tmp/ 10 | RUN sh /tmp/install-rust.sh powerpc64-unknown-linux-gnu 11 | COPY powerpc64-unknown-linux-gnu/cargo-config /.cargo/config 12 | ENV CC_powerpc64_unknown_linux_gnu=powerpc64-linux-gnu-gcc 13 | -------------------------------------------------------------------------------- /prebuilt/README.md: -------------------------------------------------------------------------------- 1 | # Prebuilt docker images 2 | 3 | Images in this directory take much longer (for whatever reason) to compile, so 4 | they're pushed up as intermediate artifacts. This allows us to test minor 5 | tweaks on Travis as well as facilitate downloads on smaller machines. 6 | 7 | All of these images are currently published under the tag: 8 | 9 | ``` 10 | alexcrichton/port-prebuilt-: 11 | ``` 12 | 13 | Where `` is the name of the image and `` is the date it was created. 14 | -------------------------------------------------------------------------------- /arm-unknown-linux-gnueabi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get -y update 4 | RUN apt-get -y install curl file gcc gcc-4.7-arm-linux-gnueabi 5 | 6 | RUN ln -nsf /usr/bin/arm-linux-gnueabi-gcc-4.7 \ 7 | /usr/bin/arm-linux-gnueabi-gcc 8 | 9 | ENV CARGO_HOME=/usr/local/cargo \ 10 | RUSTUP_HOME=/usr/local/rustup \ 11 | PATH=/usr/local/cargo/bin:$PATH 12 | COPY support/install-rust.sh /tmp/ 13 | RUN sh /tmp/install-rust.sh arm-unknown-linux-gnueabi 14 | COPY arm-unknown-linux-gnueabi/cargo-config /.cargo/config 15 | -------------------------------------------------------------------------------- /arm-unknown-linux-gnueabihf/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get -y update 4 | RUN apt-get -y install curl file gcc gcc-4.7-arm-linux-gnueabihf 5 | 6 | RUN ln -nsf /usr/bin/arm-linux-gnueabihf-gcc-4.7 \ 7 | /usr/bin/arm-linux-gnueabihf-gcc 8 | 9 | ENV CARGO_HOME=/usr/local/cargo \ 10 | RUSTUP_HOME=/usr/local/rustup \ 11 | PATH=/usr/local/cargo/bin:$PATH 12 | COPY support/install-rust.sh /tmp/ 13 | RUN sh /tmp/install-rust.sh arm-unknown-linux-gnueabihf 14 | COPY arm-unknown-linux-gnueabihf/cargo-config /.cargo/config 15 | -------------------------------------------------------------------------------- /armv7-unknown-linux-gnueabihf/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get -y update 4 | RUN apt-get -y install curl file gcc gcc-4.7-arm-linux-gnueabihf 5 | 6 | RUN ln -nsf /usr/bin/arm-linux-gnueabihf-gcc-4.7 \ 7 | /usr/bin/arm-linux-gnueabihf-gcc 8 | 9 | ENV CARGO_HOME=/usr/local/cargo \ 10 | RUSTUP_HOME=/usr/local/rustup \ 11 | PATH=/usr/local/cargo/bin:$PATH 12 | COPY support/install-rust.sh /tmp/ 13 | RUN sh /tmp/install-rust.sh armv7-unknown-linux-gnueabihf 14 | COPY armv7-unknown-linux-gnueabihf/cargo-config /.cargo/config 15 | -------------------------------------------------------------------------------- /prebuilt/freebsd/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get update && apt-get install -y --no-install-recommends \ 4 | g++ \ 5 | make \ 6 | curl \ 7 | ca-certificates \ 8 | bzip2 \ 9 | xz-utils \ 10 | wget \ 11 | pkg-config 12 | 13 | COPY build-toolchain.sh /tmp/ 14 | RUN /tmp/build-toolchain.sh 15 | 16 | FROM ubuntu:16.04 17 | COPY --from=0 /usr/local /usr/local 18 | ENV CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-gcc \ 19 | CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-g++ \ 20 | AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd10-ar \ 21 | -------------------------------------------------------------------------------- /prebuilt/freebsd11/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get update && apt-get install -y --no-install-recommends \ 4 | g++ \ 5 | make \ 6 | curl \ 7 | ca-certificates \ 8 | bzip2 \ 9 | xz-utils \ 10 | wget \ 11 | pkg-config 12 | 13 | COPY build-toolchain.sh /tmp/ 14 | RUN /tmp/build-toolchain.sh 15 | 16 | FROM ubuntu:16.04 17 | COPY --from=0 /usr/local /usr/local 18 | ENV CC_x86_64_unknown_freebsd=x86_64-unknown-freebsd11-gcc \ 19 | CXX_x86_64_unknown_freebsd=x86_64-unknown-freebsd11-g++ \ 20 | AR_x86_64_unknown_freebsd=x86_64-unknown-freebsd11-ar \ 21 | -------------------------------------------------------------------------------- /prebuilt/netbsd/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get update -y && apt-get install -y --no-install-recommends \ 4 | curl \ 5 | ca-certificates \ 6 | make \ 7 | wget \ 8 | bzip2 \ 9 | g++ \ 10 | xz-utils \ 11 | zlib1g-dev 12 | 13 | COPY build-netbsd-toolchain.sh /tmp/ 14 | RUN /tmp/build-netbsd-toolchain.sh 15 | 16 | FROM ubuntu:16.04 17 | COPY --from=0 /x-tools/ /x-tools 18 | ENV PATH=$PATH:/x-tools/x86_64-unknown-netbsd/bin \ 19 | AR_x86_64_unknown_netbsd=x86_64--netbsd-ar \ 20 | CC_x86_64_unknown_netbsd=x86_64--netbsd-gcc-sysroot \ 21 | CXX_x86_64_unknown_netbsd=x86_64--netbsd-g++-sysroot 22 | -------------------------------------------------------------------------------- /i686-pc-windows-gnu/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get -y update 4 | RUN apt-get -y install curl file gcc gcc-mingw-w64-i686 5 | 6 | ENV CARGO_HOME=/usr/local/cargo \ 7 | RUSTUP_HOME=/usr/local/rustup \ 8 | PATH=/usr/local/cargo/bin:$PATH 9 | COPY support/install-rust.sh /tmp/ 10 | RUN sh /tmp/install-rust.sh i686-pc-windows-gnu 11 | RUN curl https://static.rust-lang.org/dist/rust-mingw-nightly-i686-pc-windows-gnu.tar.gz \ 12 | | tar xzvf - -C /tmp 13 | RUN /tmp/rust-mingw-nightly-i686-pc-windows-gnu/install.sh --prefix=`rustc --print sysroot` 14 | 15 | COPY i686-pc-windows-gnu/cargo-config /.cargo/config 16 | -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ex 4 | 5 | runtest() { 6 | target=$1 7 | docker build -t port-of-rust-test -f $target/Dockerfile . 8 | docker run -e TARGET=$target -e USER=foo -i port-of-rust-test \ 9 | sh -s -- < ./docker-test.sh 10 | 11 | if [ -f $target/docker-test.sh ]; then 12 | docker run -e TARGET=$target -e USER=foo -i port-of-rust-test \ 13 | sh -s -- < $target/docker-test.sh 14 | fi 15 | } 16 | 17 | if [ -z "$1" ]; then 18 | echo "need a target to test" 19 | exit 1 20 | elif [ "$1" = "all" ]; then 21 | for d in */Dockerfile; do 22 | target=$(dirname $d) 23 | runtest $target 24 | done 25 | else 26 | runtest $1 27 | fi 28 | -------------------------------------------------------------------------------- /arm-linux-androideabi/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get -y update && apt-get -y install curl gcc file 4 | 5 | ENV PATH=$PATH:/android/ndk-arm/bin:/usr/local/cargo/bin \ 6 | CARGO_HOME=/usr/local/cargo \ 7 | RUSTUP_HOME=/usr/local/rustup 8 | 9 | COPY support/android-install-ndk.sh /tmp/ 10 | RUN sh /tmp/android-install-ndk.sh \ 11 | --platform=android-21 \ 12 | --toolchain=arm-linux-androideabi-clang3.6 \ 13 | --install-dir=/android/ndk-arm \ 14 | --ndk-dir=android-ndk-r10e \ 15 | --arch=arm 16 | 17 | COPY support/install-rust.sh /tmp/ 18 | RUN sh /tmp/install-rust.sh arm-linux-androideabi 19 | COPY arm-linux-androideabi/cargo-config /.cargo/config 20 | -------------------------------------------------------------------------------- /docker-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -ex 3 | 4 | cargo new testlib 5 | (cd testlib && cargo build) 6 | rm testlib/target/$TARGET/debug/libtestlib.rlib 7 | 8 | cargo new testbin --bin 9 | cat > testbin/Cargo.toml <<-EOF 10 | [project] 11 | name = "testbin" 12 | version = "0.1.0" 13 | authors = [] 14 | build = "build.rs" 15 | 16 | [build-dependencies] 17 | gcc = "0.3" 18 | EOF 19 | 20 | cat > testbin/build.rs <<-EOF 21 | extern crate gcc; 22 | 23 | fn main() { 24 | gcc::Build::new().file("foo.c").compile("libfoo.a"); 25 | } 26 | EOF 27 | 28 | cat > testbin/foo.c <<-EOF 29 | #include 30 | #include 31 | 32 | void foo() { 33 | } 34 | EOF 35 | 36 | cat > testbin/src/main.rs <<-EOF 37 | extern { 38 | fn foo(); 39 | } 40 | 41 | fn main() { 42 | unsafe { foo(); } 43 | } 44 | EOF 45 | 46 | (cd testbin && cargo build) 47 | file=testbin/target/$TARGET/debug/testbin 48 | if [ -f $file.exe ]; then 49 | rm $file.exe 50 | else 51 | rm $file 52 | fi 53 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: rust 2 | sudo: required 3 | dist: trusty 4 | services: 5 | - docker 6 | script: 7 | - ./test.sh $TARGET 8 | env: 9 | matrix: 10 | - TARGET=aarch64-unknown-linux-gnu 11 | - TARGET=arm-linux-androideabi 12 | - TARGET=arm-unknown-linux-gnueabi 13 | - TARGET=arm-unknown-linux-gnueabihf 14 | - TARGET=armv7-unknown-linux-gnueabihf 15 | - TARGET=i686-pc-windows-gnu 16 | - TARGET=i686-unknown-linux-gnu 17 | - TARGET=mips-unknown-linux-gnu 18 | - TARGET=mipsel-unknown-linux-gnu 19 | - TARGET=powerpc-unknown-linux-gnu 20 | - TARGET=powerpc64-unknown-linux-gnu 21 | - TARGET=powerpc64le-unknown-linux-gnu 22 | - TARGET=sparcv9-sun-solaris 23 | - TARGET=x86_64-pc-windows-gnu 24 | - TARGET=x86_64-rumprun-netbsd 25 | - TARGET=x86_64-sun-solaris 26 | - TARGET=x86_64-unknown-linux-gnu 27 | - TARGET=x86_64-unknown-linux-musl 28 | - TARGET=x86_64-unknown-freebsd 29 | - TARGET=x86_64-unknown-netbsd 30 | notifications: 31 | email: 32 | on_success: never 33 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Alex Crichton 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /support/android-install-sdk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -ex 4 | 5 | # Prep the SDK and emulator 6 | # 7 | # Note that the update process requires that we accept a bunch of licenses, and 8 | # we can't just pipe `yes` into it for some reason, so we take the same strategy 9 | # located in https://github.com/appunite/docker by just wrapping it in a script 10 | # which apparently magically accepts the licenses. 11 | 12 | mkdir sdk 13 | curl http://dl.google.com/android/android-sdk_r24.4-linux.tgz | \ 14 | tar xzf - -C sdk --strip-components=1 15 | 16 | filter="platform-tools,android-18,android-21" 17 | filter="$filter,sys-img-x86-android-18" 18 | filter="$filter,sys-img-x86_64-android-18" 19 | filter="$filter,sys-img-armeabi-v7a-android-18" 20 | filter="$filter,sys-img-x86-android-21" 21 | filter="$filter,sys-img-x86_64-android-21" 22 | filter="$filter,sys-img-armeabi-v7a-android-21" 23 | 24 | ./accept-licenses.sh "android - update sdk -a --no-ui --filter $filter" 25 | 26 | echo "no" | android create avd \ 27 | --name arm-18 \ 28 | --target android-18 \ 29 | --abi armeabi-v7a 30 | echo "no" | android create avd \ 31 | --name arm-21 \ 32 | --target android-21 \ 33 | --abi armeabi-v7a 34 | echo "no" | android create avd \ 35 | --name x86-21 \ 36 | --target android-21 \ 37 | --abi x86 38 | echo "no" | android create avd \ 39 | --name x86_64-21 \ 40 | --target android-21 \ 41 | --abi x86_64 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Port of Rust 2 | 3 | [![Build Status](https://travis-ci.org/alexcrichton/port-of-rust.svg?branch=master)](https://travis-ci.org/alexcrichton/port-of-rust) 4 | 5 | This repo contains a collection of docker containers intended for compiling Rust 6 | code for various platforms. Each container contains what should be the bare 7 | minimum for compiling Rust code on the target platform, including: 8 | 9 | * A Rust compiler 10 | * A Rust standard library for the target platform 11 | * A C compiler/linker for the target platform 12 | 13 | The tests for this repository run a smoke "build a cargo project" for each 14 | platform, so at least "Hello, World!" should be guaranteed to work! 15 | 16 | 17 | ### Building an image 18 | 19 | First, figure out the target you'd like. Let's say that's 20 | `arm-linux-androideabi`. Next, build the docker container like so: 21 | 22 | ``` 23 | docker build -f arm-linux-androideabi/Dockerfile . 24 | ``` 25 | 26 | And then you're ready to go! 27 | 28 | ### Platform Support 29 | 30 | Most of the platforms here are currently untested, which means that your mileage 31 | may vary when using them. Some concerns to keep in mind when cross compiling 32 | are: 33 | 34 | * For Linux targets, the glibc version on the machine you run a binary on must 35 | be at least the glibc version in each docker container. Currently not much 36 | effort is done to ensure these glibc versions are "old", but patches are 37 | welcome! 38 | * For most other targets, they're compiled against "some version" of the OS 39 | being run on, and it may not always be the case that this version is old 40 | enough for you to run on your target platform. For example the Android 41 | container has an API level 21 toolchain, where the binaries of the standard 42 | library currently support API level 18. 43 | * Various codegen options for cross-compiled linux architectures may not always 44 | work out. Patches to the standard library and this repository are of course 45 | welcome! 46 | 47 | If those are all taken care of, however, then the cross compilation experience 48 | should be relatively smooth! 49 | 50 | # License 51 | 52 | These docker images are primarily distributed under the terms of both the MIT 53 | license and the Apache License (Version 2.0), with portions covered by various 54 | BSD-like licenses. 55 | 56 | See LICENSE-APACHE, and LICENSE-MIT for details. 57 | -------------------------------------------------------------------------------- /prebuilt/netbsd/build-netbsd-toolchain.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2016 The Rust Project Developers. See the COPYRIGHT 3 | # file at the top-level directory of this distribution and at 4 | # http://rust-lang.org/COPYRIGHT. 5 | # 6 | # Licensed under the Apache License, Version 2.0 or the MIT license 8 | # , at your 9 | # option. This file may not be copied, modified, or distributed 10 | # except according to those terms. 11 | 12 | # ignore-tidy-linelength 13 | 14 | set -ex 15 | 16 | hide_output() { 17 | set +x 18 | on_err=" 19 | echo ERROR: An error was encountered with the build. 20 | cat /tmp/build.log 21 | exit 1 22 | " 23 | trap "$on_err" ERR 24 | bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & 25 | PING_LOOP_PID=$! 26 | $@ &> /tmp/build.log 27 | rm /tmp/build.log 28 | trap - ERR 29 | kill $PING_LOOP_PID 30 | set -x 31 | } 32 | 33 | mkdir netbsd 34 | cd netbsd 35 | 36 | mkdir -p /x-tools/x86_64-unknown-netbsd/sysroot 37 | 38 | URL=https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror 39 | 40 | # Originally from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-$BSD/source/sets/*.tgz 41 | curl $URL/2017-03-17-netbsd-src.tgz | tar xzf - 42 | curl $URL/2017-03-17-netbsd-gnusrc.tgz | tar xzf - 43 | curl $URL/2017-03-17-netbsd-sharesrc.tgz | tar xzf - 44 | curl $URL/2017-03-17-netbsd-syssrc.tgz | tar xzf - 45 | 46 | # Originally from ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-$BSD/amd64/binary/sets/*.tgz 47 | curl $URL/2017-03-17-netbsd-base.tgz | \ 48 | tar xzf - -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib ./lib 49 | curl $URL/2017-03-17-netbsd-comp.tgz | \ 50 | tar xzf - -C /x-tools/x86_64-unknown-netbsd/sysroot ./usr/include ./usr/lib 51 | 52 | cd usr/src 53 | 54 | # The options, in order, do the following 55 | # * this is an unpriviledged build 56 | # * output to a predictable location 57 | # * disable various uneeded stuff 58 | MKUNPRIVED=yes TOOLDIR=/x-tools/x86_64-unknown-netbsd \ 59 | MKSHARE=no MKDOC=no MKHTML=no MKINFO=no MKKMOD=no MKLINT=no MKMAN=no MKNLS=no MKPROFILE=no \ 60 | hide_output ./build.sh -j10 -m amd64 tools 61 | 62 | cd ../.. 63 | 64 | rm -rf usr 65 | 66 | cat > /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-gcc-sysroot <<'EOF' 67 | #!/bin/bash 68 | exec /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-gcc --sysroot=/x-tools/x86_64-unknown-netbsd/sysroot "$@" 69 | EOF 70 | 71 | cat > /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-g++-sysroot <<'EOF' 72 | #!/bin/bash 73 | exec /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-g++ --sysroot=/x-tools/x86_64-unknown-netbsd/sysroot "$@" 74 | EOF 75 | 76 | GCC_SHA1=`sha1sum -b /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-gcc | cut -d' ' -f1` 77 | GPP_SHA1=`sha1sum -b /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-g++ | cut -d' ' -f1` 78 | 79 | echo "# $GCC_SHA1" >> /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-gcc-sysroot 80 | echo "# $GPP_SHA1" >> /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-g++-sysroot 81 | 82 | chmod +x /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-gcc-sysroot 83 | chmod +x /x-tools/x86_64-unknown-netbsd/bin/x86_64--netbsd-g++-sysroot 84 | -------------------------------------------------------------------------------- /prebuilt/freebsd/build-toolchain.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2016 The Rust Project Developers. See the COPYRIGHT 3 | # file at the top-level directory of this distribution and at 4 | # http://rust-lang.org/COPYRIGHT. 5 | # 6 | # Licensed under the Apache License, Version 2.0 or the MIT license 8 | # , at your 9 | # option. This file may not be copied, modified, or distributed 10 | # except according to those terms. 11 | 12 | set -ex 13 | 14 | ARCH=x86_64 15 | BINUTILS=2.25.1 16 | GCC=6.4.0 17 | 18 | hide_output() { 19 | set +x 20 | on_err=" 21 | echo ERROR: An error was encountered with the build. 22 | cat /tmp/build.log 23 | exit 1 24 | " 25 | trap "$on_err" ERR 26 | bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & 27 | PING_LOOP_PID=$! 28 | $@ &> /tmp/build.log 29 | trap - ERR 30 | kill $PING_LOOP_PID 31 | set -x 32 | } 33 | 34 | cd /tmp 35 | mkdir binutils 36 | cd binutils 37 | 38 | # First up, build binutils 39 | curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf - 40 | mkdir binutils-build 41 | cd binutils-build 42 | hide_output ../binutils-$BINUTILS/configure \ 43 | --target=$ARCH-unknown-freebsd10 44 | hide_output make -j10 45 | hide_output make install 46 | cd ../.. 47 | rm -rf binutils 48 | 49 | # Next, download the FreeBSD libc and relevant header files 50 | 51 | mkdir freebsd 52 | case "$ARCH" in 53 | x86_64) 54 | URL=ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/10.2-RELEASE/base.txz 55 | ;; 56 | i686) 57 | URL=ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/10.2-RELEASE/base.txz 58 | ;; 59 | esac 60 | curl $URL | tar xJf - -C freebsd ./usr/include ./usr/lib ./lib 61 | 62 | dst=/usr/local/$ARCH-unknown-freebsd10 63 | 64 | cp -r freebsd/usr/include $dst/ 65 | cp freebsd/usr/lib/crt1.o $dst/lib 66 | cp freebsd/usr/lib/Scrt1.o $dst/lib 67 | cp freebsd/usr/lib/crti.o $dst/lib 68 | cp freebsd/usr/lib/crtn.o $dst/lib 69 | cp freebsd/usr/lib/libc.a $dst/lib 70 | cp freebsd/usr/lib/libutil.a $dst/lib 71 | cp freebsd/usr/lib/libutil_p.a $dst/lib 72 | cp freebsd/usr/lib/libm.a $dst/lib 73 | cp freebsd/usr/lib/librt.so.1 $dst/lib 74 | cp freebsd/usr/lib/libexecinfo.so.1 $dst/lib 75 | cp freebsd/lib/libc.so.7 $dst/lib 76 | cp freebsd/lib/libm.so.5 $dst/lib 77 | cp freebsd/lib/libutil.so.9 $dst/lib 78 | cp freebsd/lib/libthr.so.3 $dst/lib/libpthread.so 79 | 80 | ln -s libc.so.7 $dst/lib/libc.so 81 | ln -s libm.so.5 $dst/lib/libm.so 82 | ln -s librt.so.1 $dst/lib/librt.so 83 | ln -s libutil.so.9 $dst/lib/libutil.so 84 | ln -s libexecinfo.so.1 $dst/lib/libexecinfo.so 85 | rm -rf freebsd 86 | 87 | # Finally, download and build gcc to target FreeBSD 88 | mkdir gcc 89 | cd gcc 90 | curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.gz | tar xzf - 91 | cd gcc-$GCC 92 | ./contrib/download_prerequisites 93 | 94 | mkdir ../gcc-build 95 | cd ../gcc-build 96 | hide_output ../gcc-$GCC/configure \ 97 | --enable-languages=c,c++ \ 98 | --target=$ARCH-unknown-freebsd10 \ 99 | --disable-multilib \ 100 | --disable-nls \ 101 | --disable-libgomp \ 102 | --disable-libquadmath \ 103 | --disable-libssp \ 104 | --disable-libvtv \ 105 | --disable-libcilkrts \ 106 | --disable-libada \ 107 | --disable-libsanitizer \ 108 | --disable-libquadmath-support \ 109 | --disable-lto 110 | hide_output make -j10 111 | hide_output make install 112 | cd ../.. 113 | rm -rf gcc 114 | -------------------------------------------------------------------------------- /prebuilt/freebsd11/build-toolchain.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2016 The Rust Project Developers. See the COPYRIGHT 3 | # file at the top-level directory of this distribution and at 4 | # http://rust-lang.org/COPYRIGHT. 5 | # 6 | # Licensed under the Apache License, Version 2.0 or the MIT license 8 | # , at your 9 | # option. This file may not be copied, modified, or distributed 10 | # except according to those terms. 11 | 12 | set -ex 13 | 14 | ARCH=x86_64 15 | BINUTILS=2.25.1 16 | GCC=6.4.0 17 | 18 | hide_output() { 19 | set +x 20 | on_err=" 21 | echo ERROR: An error was encountered with the build. 22 | cat /tmp/build.log 23 | exit 1 24 | " 25 | trap "$on_err" ERR 26 | bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & 27 | PING_LOOP_PID=$! 28 | $@ &> /tmp/build.log 29 | trap - ERR 30 | kill $PING_LOOP_PID 31 | set -x 32 | } 33 | 34 | cd /tmp 35 | mkdir binutils 36 | cd binutils 37 | 38 | # First up, build binutils 39 | curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf - 40 | mkdir binutils-build 41 | cd binutils-build 42 | hide_output ../binutils-$BINUTILS/configure \ 43 | --target=$ARCH-unknown-freebsd11 44 | hide_output make -j10 45 | hide_output make install 46 | cd ../.. 47 | rm -rf binutils 48 | 49 | # Next, download the FreeBSD libc and relevant header files 50 | 51 | mkdir freebsd 52 | case "$ARCH" in 53 | x86_64) 54 | URL=ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/11.1-RELEASE/base.txz 55 | ;; 56 | i686) 57 | URL=ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/11.1-RELEASE/base.txz 58 | ;; 59 | esac 60 | curl $URL | tar xJf - -C freebsd ./usr/include ./usr/lib ./lib 61 | 62 | dst=/usr/local/$ARCH-unknown-freebsd11 63 | 64 | cp -r freebsd/usr/include $dst/ 65 | cp freebsd/usr/lib/crt1.o $dst/lib 66 | cp freebsd/usr/lib/Scrt1.o $dst/lib 67 | cp freebsd/usr/lib/crti.o $dst/lib 68 | cp freebsd/usr/lib/crtn.o $dst/lib 69 | cp freebsd/usr/lib/libc.a $dst/lib 70 | cp freebsd/usr/lib/libutil.a $dst/lib 71 | cp freebsd/usr/lib/libutil_p.a $dst/lib 72 | cp freebsd/usr/lib/libm.a $dst/lib 73 | cp freebsd/usr/lib/librt.so.1 $dst/lib 74 | cp freebsd/usr/lib/libexecinfo.so.1 $dst/lib 75 | cp freebsd/lib/libc.so.7 $dst/lib 76 | cp freebsd/lib/libm.so.5 $dst/lib 77 | cp freebsd/lib/libutil.so.9 $dst/lib 78 | cp freebsd/lib/libthr.so.3 $dst/lib/libpthread.so 79 | 80 | ln -s libc.so.7 $dst/lib/libc.so 81 | ln -s libm.so.5 $dst/lib/libm.so 82 | ln -s librt.so.1 $dst/lib/librt.so 83 | ln -s libutil.so.9 $dst/lib/libutil.so 84 | ln -s libexecinfo.so.1 $dst/lib/libexecinfo.so 85 | rm -rf freebsd 86 | 87 | # Finally, download and build gcc to target FreeBSD 88 | mkdir gcc 89 | cd gcc 90 | curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.gz | tar xzf - 91 | cd gcc-$GCC 92 | ./contrib/download_prerequisites 93 | 94 | mkdir ../gcc-build 95 | cd ../gcc-build 96 | hide_output ../gcc-$GCC/configure \ 97 | --enable-languages=c,c++ \ 98 | --target=$ARCH-unknown-freebsd11 \ 99 | --disable-multilib \ 100 | --disable-nls \ 101 | --disable-libgomp \ 102 | --disable-libquadmath \ 103 | --disable-libssp \ 104 | --disable-libvtv \ 105 | --disable-libcilkrts \ 106 | --disable-libada \ 107 | --disable-libsanitizer \ 108 | --disable-libquadmath-support \ 109 | --disable-lto 110 | hide_output make -j10 111 | hide_output make install 112 | cd ../.. 113 | rm -rf gcc 114 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------