-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathDockerfile.mips
More file actions
42 lines (34 loc) · 2.28 KB
/
Dockerfile.mips
File metadata and controls
42 lines (34 loc) · 2.28 KB
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
# Rust stable does not ship pre-built std for MIPS; use cross-rs image which has it
FROM ghcr.io/cross-rs/mips-unknown-linux-gnu:latest
# Wrappers that append -latomic when linking (so it comes after libcrypto.a; CMake puts our flags first)
RUN printf '#!/bin/sh\nif echo "$*" | grep -q " -c "; then exec mips-linux-gnu-gcc "$@"; else exec mips-linux-gnu-gcc "$@" -latomic; fi\n' > /usr/local/bin/mips-linux-gnu-gcc-wrapper && chmod +x /usr/local/bin/mips-linux-gnu-gcc-wrapper \
&& printf '#!/bin/sh\nif echo "$*" | grep -q " -c "; then exec mips-linux-gnu-g++ "$@"; else exec mips-linux-gnu-g++ "$@" -latomic; fi\n' > /usr/local/bin/mips-linux-gnu-g++-wrapper && chmod +x /usr/local/bin/mips-linux-gnu-g++-wrapper
ENV CC=/usr/local/bin/mips-linux-gnu-gcc-wrapper \
CXX=/usr/local/bin/mips-linux-gnu-g++-wrapper \
AR=mips-linux-gnu-ar \
LDFLAGS="-latomic" \
CMAKE_EXE_LINKER_FLAGS="-latomic" \
CMAKE_SHARED_LINKER_FLAGS="-latomic" \
RUST_TARGET=mips-unknown-linux-gnu
ENV PATH="/root/.cargo/bin:$PATH" \
RUSTUP_TOOLCHAIN=nightly
# Build OpenSSL for target so picoquic (CMake) can find it
ENV OPENSSL_ROOT_DIR=/usr/local/openssl-mips
RUN apt-get update && apt-get install -y --no-install-recommends wget ca-certificates perl make \
&& wget -q https://www.openssl.org/source/openssl-3.0.13.tar.gz \
&& tar xzf openssl-3.0.13.tar.gz && cd openssl-3.0.13 \
&& ./Configure linux-mips32 --cross-compile-prefix= \
--prefix=/usr/local/openssl-mips --openssldir=/usr/local/openssl-mips \
no-shared no-tests \
&& make -j$(nproc) && make install_sw \
&& cd .. && rm -rf openssl-3.0.13 openssl-3.0.13.tar.gz \
&& apt-get purge -y wget && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
# cross-rs image has no Rust; nightly + rust-src for -Z build-std (no pre-built std for MIPS)
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly \
&& . /root/.cargo/env && rustup component add rust-src \
&& apt-get purge -y curl && apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
COPY build-docker.sh /workspace/build-docker.sh
RUN chmod +x /workspace/build-docker.sh
CMD ["/workspace/build-docker.sh"]