From 9348f137df816356e728cb33f5362540a6ca0576 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Sat, 16 Nov 2024 21:22:10 +0800 Subject: [PATCH] ci: add support for loongarch64-unknown-linux-musl --- .github/workflows/full_ci.yml | 1 + .../loongarch64-unknown-linux-musl/Dockerfile | 14 ++++++++++++++ ci/install-musl-cross.sh | 10 ++++++++++ 3 files changed, 25 insertions(+) create mode 100644 ci/docker/loongarch64-unknown-linux-musl/Dockerfile create mode 100644 ci/install-musl-cross.sh diff --git a/.github/workflows/full_ci.yml b/.github/workflows/full_ci.yml index 27037fea55248..3d60b36c61a55 100644 --- a/.github/workflows/full_ci.yml +++ b/.github/workflows/full_ci.yml @@ -165,6 +165,7 @@ jobs: - i686-linux-android - i686-unknown-linux-musl - loongarch64-unknown-linux-gnu + - loongarch64-unknown-linux-musl - powerpc-unknown-linux-gnu - powerpc64-unknown-linux-gnu - powerpc64le-unknown-linux-gnu diff --git a/ci/docker/loongarch64-unknown-linux-musl/Dockerfile b/ci/docker/loongarch64-unknown-linux-musl/Dockerfile new file mode 100644 index 0000000000000..c1219c034c81f --- /dev/null +++ b/ci/docker/loongarch64-unknown-linux-musl/Dockerfile @@ -0,0 +1,14 @@ +FROM ubuntu:24.04 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates curl gcc git libc6-dev make qemu-user xz-utils + +COPY install-musl-cross.sh / +RUN sh /install-musl-cross.sh loongarch64-unknown-linux-musl + +ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=loongarch64-unknown-linux-musl-gcc \ + CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_RUNNER="qemu-loongarch64" \ + CC_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-gcc \ + CFLAGS_loongarch64_unknown_linux_musl="-mabi=lp64d -fPIC" \ + QEMU_LD_PREFIX=/loongarch64-unknown-linux-musl/loongarch64-unknown-linux-musl/sysroot \ + PATH=$PATH:/loongarch64-unknown-linux-musl/bin:/rust/bin diff --git a/ci/install-musl-cross.sh b/ci/install-musl-cross.sh new file mode 100644 index 0000000000000..38381dc9bd6bf --- /dev/null +++ b/ci/install-musl-cross.sh @@ -0,0 +1,10 @@ +#!/bin/sh +# +# Install musl cross toolchain + +set -ex + +MUSL_CROSS_VER=20241103 +MUSL_CROSS_URL=https://github.com/musl-cross/musl-cross/releases/download/$MUSL_CROSS_VER/$1.tar.xz + +curl -L --retry 5 "$MUSL_CROSS_URL" | tar -xJf - -C /