ci: Add support for dist-loongarch64-musl · rust-lang/rust@03d73fa (original) (raw)

File tree

5 files changed

lines changed

5 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -271,6 +271,22 @@ For targets: `loongarch64-unknown-linux-gnu`
271 271 - C compiler > gcc version = 13.2.0
272 272 - C compiler > C++ = ENABLE -- to cross compile LLVM
273 273
274 +### `loongarch64-linux-musl.defconfig`
275 +
276 +For targets: `loongarch64-unknown-linux-musl`
277 +
278 +- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
279 +- Path and misc options > Use a mirror = ENABLE
280 +- Path and misc options > Base URL = https://ci-mirrors.rust-lang.org/rustc
281 +- Target options > Target Architecture = loongarch
282 +- Target options > Bitness = 64-bit
283 +- Operating System > Target OS = linux
284 +- Operating System > Linux kernel version = 5.19.16
285 +- Binary utilities > Version of binutils = 2.41
286 +- C-library > musl version = 1.2.5
287 +- C compiler > gcc version = 13.2.0
288 +- C compiler > C++ = ENABLE -- to cross compile LLVM
289 +
274 290 ### `mips-linux-gnu.defconfig`
275 291
276 292 For targets: `mips-unknown-linux-gnu`
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
1 +FROM ubuntu:22.04
2 +
3 +COPY scripts/cross-apt-packages.sh /scripts/
4 +RUN sh /scripts/cross-apt-packages.sh
5 +
6 +COPY scripts/crosstool-ng-git.sh /scripts/
7 +RUN sh /scripts/crosstool-ng-git.sh
8 +
9 +COPY scripts/rustbuild-setup.sh /scripts/
10 +RUN sh /scripts/rustbuild-setup.sh
11 +WORKDIR /tmp
12 +
13 +COPY scripts/crosstool-ng-build.sh /scripts/
14 +COPY host-x86_64/dist-loongarch64-musl/loongarch64-unknown-linux-musl.defconfig /tmp/crosstool.defconfig
15 +RUN /scripts/crosstool-ng-build.sh
16 +
17 +COPY scripts/sccache.sh /scripts/
18 +RUN sh /scripts/sccache.sh
19 +
20 +ENV PATH=$PATH:/x-tools/loongarch64-unknown-linux-musl/bin
21 +
22 +ENV CC_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-gcc \
23 + AR_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-ar \
24 + CXX_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-g++
25 +
26 +ENV HOSTS=loongarch64-unknown-linux-musl
27 +
28 +ENV RUST_CONFIGURE_ARGS \
29 + --enable-extended \
30 + --enable-lld \
31 + --disable-docs \
32 + --set target.loongarch64-unknown-linux-musl.crt-static=false \
33 + --musl-root-loongarch64=/x-tools/loongarch64-unknown-linux-musl/loongarch64-unknown-linux-musl/sysroot/usr
34 +
35 +ENV SCRIPT python3 ../x.py dist --host HOSTS−−targetHOSTS --target HOSTStargetHOSTS
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
1 +CT_CONFIG_VERSION="4"
2 +CT_EXPERIMENTAL=y
3 +CT_PREFIX_DIR="/x-tools/${CT_TARGET}"
4 +CT_USE_MIRROR=y
5 +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc"
6 +CT_ARCH_LOONGARCH=y
7 +# CT_DEMULTILIB is not set
8 +CT_ARCH_USE_MMU=y
9 +CT_ARCH_ARCH="loongarch64"
10 +CT_KERNEL_LINUX=y
11 +CT_LINUX_V_5_19=y
12 +CT_LIBC_MUSL=y
13 +CT_CC_GCC_ENABLE_DEFAULT_PIE=y
14 +CT_CC_LANG_CXX=y
15 +CT_GETTEXT_NEEDED=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
1 +#!/bin/sh
2 +set -ex
3 +
4 +URL=https://github.com/crosstool-ng/crosstool-ng
5 +REV=c64500d94be92ed1bcdfdef911048a14e216a5e1
6 +
7 +mkdir crosstool-ng
8 +cd crosstool-ng
9 +git init
10 +git fetch --depth=1 URL{URL} URL{REV}
11 +git reset --hard FETCH_HEAD
12 +./bootstrap
13 +./configure --prefix=/usr/local
14 +make -j$(nproc)
15 +make install
16 +cd ..
17 +rm -rf crosstool-ng
Original file line number Diff line number Diff line change
@@ -144,6 +144,9 @@ auto:
144 144 - image: dist-loongarch64-linux
145 145 <<: *job-linux-4c
146 146
147 + - image: dist-loongarch64-musl
148 +<<: *job-linux-4c
149 +
147 150 - image: dist-ohos
148 151 <<: *job-linux-4c
149 152