-
Notifications
You must be signed in to change notification settings - Fork 377
/
Dockerfile.mips-unknown-linux-musl
48 lines (38 loc) · 1.59 KB
/
Dockerfile.mips-unknown-linux-musl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
FROM ubuntu:20.04 as cross-base
ENV DEBIAN_FRONTEND=noninteractive
COPY common.sh lib.sh /
RUN /common.sh
COPY cmake.sh /
RUN /cmake.sh
COPY xargo.sh /
RUN /xargo.sh
FROM cross-base as build
COPY qemu.sh /
RUN /qemu.sh mips
# this is a soft-float target for the mips32r2 architecture
# https://github.com/rust-lang/rust/blob/75d3027fb5ce1af6712e4503c9574802212101bd/compiler/rustc_target/src/spec/mips_unknown_linux_musl.rs#L7
COPY musl.sh /
RUN /musl.sh \
TARGET=mips-linux-muslsf \
"COMMON_CONFIG += -with-arch=mips32r2"
ENV CROSS_TOOLCHAIN_PREFIX=mips-linux-muslsf-
ENV CROSS_SYSROOT=/usr/local/mips-linux-muslsf
COPY musl-symlink.sh /
RUN /musl-symlink.sh $CROSS_SYSROOT mips-sf
COPY qemu-runner base-runner.sh /
COPY toolchain.cmake /opt/toolchain.cmake
ENV CROSS_TARGET_RUNNER="/qemu-runner mips"
ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="$CROSS_TARGET_RUNNER" \
AR_mips_unknown_linux_musl="$CROSS_TOOLCHAIN_PREFIX"ar \
CC_mips_unknown_linux_musl="$CROSS_TOOLCHAIN_PREFIX"gcc \
CXX_mips_unknown_linux_musl="$CROSS_TOOLCHAIN_PREFIX"g++ \
CMAKE_TOOLCHAIN_FILE_mips_unknown_linux_musl=/opt/toolchain.cmake \
BINDGEN_EXTRA_CLANG_ARGS_mips_unknown_linux_musl="--sysroot=$CROSS_SYSROOT" \
QEMU_LD_PREFIX="$CROSS_SYSROOT" \
RUST_TEST_THREADS=1 \
CROSS_CMAKE_SYSTEM_NAME=Linux \
CROSS_CMAKE_SYSTEM_PROCESSOR=mips \
CROSS_CMAKE_CRT=musl \
CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -fPIC"
RUN sed -e "s#@DEFAULT_QEMU_LD_PREFIX@#$QEMU_LD_PREFIX#g" -i /qemu-runner