|
| 1 | +FROM ubuntu:20.04 as cross-base |
| 2 | +ENV DEBIAN_FRONTEND=noninteractive |
| 3 | + |
| 4 | +COPY common.sh lib.sh / |
| 5 | +RUN /common.sh |
| 6 | + |
| 7 | +COPY cmake.sh / |
| 8 | +RUN /cmake.sh |
| 9 | + |
| 10 | +COPY xargo.sh / |
| 11 | +RUN /xargo.sh |
| 12 | + |
| 13 | +FROM cross-base as build |
| 14 | + |
| 15 | +ARG VERBOSE |
| 16 | +COPY crosstool-ng.sh / |
| 17 | +COPY crosstool-config/loongarch64-unknown-linux-musl.config / |
| 18 | +RUN /crosstool-ng.sh loongarch64-unknown-linux-musl.config 5 ed12fa68402f58e171a6f79500f73f4781fdc9e5 |
| 19 | + |
| 20 | +ENV PATH /x-tools/loongarch64-unknown-linux-musl/bin/:$PATH |
| 21 | + |
| 22 | +COPY deny-debian-packages.sh / |
| 23 | +RUN TARGET_ARCH=loong64 /deny-debian-packages.sh |
| 24 | + |
| 25 | +COPY qemu.sh / |
| 26 | +RUN /qemu.sh loongarch64 |
| 27 | + |
| 28 | +COPY qemu-runner base-runner.sh / |
| 29 | +COPY toolchain.cmake /opt/toolchain.cmake |
| 30 | + |
| 31 | +ENV CROSS_TOOLCHAIN_PREFIX=loongarch64-unknown-linux-musl- |
| 32 | +ENV CROSS_SYSROOT=/x-tools/loongarch64-unknown-linux-musl/loongarch64-unknown-linux-musl/sysroot/ |
| 33 | +ENV CROSS_TARGET_RUNNER="/qemu-runner loongarch64" |
| 34 | +ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \ |
| 35 | + CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_RUNNER="$CROSS_TARGET_RUNNER" \ |
| 36 | + AR_loongarch64_unknown_linux_musl="$CROSS_TOOLCHAIN_PREFIX"ar \ |
| 37 | + CC_loongarch64_unknown_linux_musl="$CROSS_TOOLCHAIN_PREFIX"gcc \ |
| 38 | + CXX_loongarch64_unknown_linux_musl="$CROSS_TOOLCHAIN_PREFIX"g++ \ |
| 39 | + CMAKE_TOOLCHAIN_FILE_loongarch64_unknown_linux_musl=/opt/toolchain.cmake \ |
| 40 | + BINDGEN_EXTRA_CLANG_ARGS_loongarch64_unknown_linux_musl="--sysroot=$CROSS_SYSROOT" \ |
| 41 | + QEMU_LD_PREFIX="$CROSS_SYSROOT" \ |
| 42 | + RUST_TEST_THREADS=1 \ |
| 43 | + CROSS_CMAKE_SYSTEM_NAME=Linux \ |
| 44 | + CROSS_CMAKE_SYSTEM_PROCESSOR=loongarch64 \ |
| 45 | + CROSS_CMAKE_CRT=musl \ |
| 46 | + CROSS_CMAKE_OBJECT_FLAGS="-ffunction-sections -fdata-sections -fPIC" |
| 47 | + |
| 48 | +RUN sed -e "s#@DEFAULT_QEMU_LD_PREFIX@#$QEMU_LD_PREFIX#g" -i /qemu-runner |
0 commit comments