Skip to content

Commit 17f5aa5

Browse files
heiheryangxiaojuan-loongson
authored andcommitted
ci: Add support for dist-loongarch64-linux
Co-Authored-By: YANG Xiaojuan <[email protected]>
1 parent f728959 commit 17f5aa5

File tree

7 files changed

+85
-1
lines changed

7 files changed

+85
-1
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ jobs:
206206
- name: dist-i686-linux
207207
os: ubuntu-20.04-xl
208208
env: {}
209+
- name: dist-loongarch64-linux
210+
os: ubuntu-20.04-8core-32gb
211+
env: {}
209212
- name: dist-mips-linux
210213
os: ubuntu-20.04-xl
211214
env: {}

src/ci/docker/README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,23 @@ For targets: `i586-unknown-linux-gnu`
250250
(\*) Compressed debug is enabled by default for gas (assembly) on Linux/x86 targets,
251251
but that makes our `compiler_builtins` incompatible with binutils < 2.32.
252252
253-
### `mips-linux-gnu.config`
253+
### `loongarch64-linux-gnu.defconfig`
254+
255+
For targets: `loongarch64-unknown-linux-gnu`
256+
257+
- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
258+
- Path and misc options > Use a mirror = ENABLE
259+
- Path and misc options > Base URL = https://ci-mirrors.rust-lang.org/rustc
260+
- Target options > Target Architecture = loongarch
261+
- Target options > Bitness = 64-bit
262+
- Operating System > Target OS = linux
263+
- Operating System > Linux kernel version = 5.19.16
264+
- Binary utilities > Version of binutils = 2.40
265+
- C-library > glibc version = 2.36
266+
- C compiler > gcc version = 12.2.0
267+
- C compiler > C++ = ENABLE -- to cross compile LLVM
268+
269+
### `mips-linux-gnu.defconfig`
254270
255271
For targets: `mips-unknown-linux-gnu`
256272
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM ubuntu:22.04
2+
3+
COPY scripts/cross-apt-packages.sh /scripts/
4+
RUN sh /scripts/cross-apt-packages.sh
5+
6+
# The latest released version does not support LoongArch.
7+
COPY scripts/crosstool-ng-git.sh /scripts/
8+
RUN sh /scripts/crosstool-ng-git.sh
9+
10+
COPY scripts/rustbuild-setup.sh /scripts/
11+
RUN sh /scripts/rustbuild-setup.sh
12+
WORKDIR /tmp
13+
14+
COPY scripts/crosstool-ng-build.sh /scripts/
15+
COPY host-x86_64/dist-loongarch64-linux/loongarch64-unknown-linux-gnu.defconfig /tmp/crosstool.defconfig
16+
RUN /scripts/crosstool-ng-build.sh
17+
18+
COPY scripts/sccache.sh /scripts/
19+
RUN sh /scripts/sccache.sh
20+
21+
ENV PATH=$PATH:/x-tools/loongarch64-unknown-linux-gnu/bin
22+
23+
ENV CC_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-gcc \
24+
AR_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-ar \
25+
CXX_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-g++
26+
27+
ENV HOSTS=loongarch64-unknown-linux-gnu
28+
29+
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
30+
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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_GLIBC_V_2_36=y
13+
CT_CC_GCC_ENABLE_DEFAULT_PIE=y
14+
CT_CC_LANG_CXX=y

src/ci/docker/scripts/cross-apt-packages.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install
2222
patch \
2323
pkg-config \
2424
python3 \
25+
rsync \
2526
sudo \
2627
texinfo \
2728
unzip \
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
set -ex
3+
4+
URL=https://github.com/crosstool-ng/crosstool-ng
5+
REV=943364711a650d9b9e84c1b42c91cc0265b6ab5c
6+
7+
mkdir crosstool-ng
8+
cd crosstool-ng
9+
git init
10+
git fetch --depth=1 ${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

src/ci/github-actions/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ jobs:
354354
- name: dist-i686-linux
355355
<<: *job-linux-xl
356356

357+
- name: dist-loongarch64-linux
358+
<<: *job-linux-8c
359+
357360
- name: dist-mips-linux
358361
<<: *job-linux-xl
359362

0 commit comments

Comments
 (0)