From 87501b6ed8aa344b664bb5ebfe391bc1ccce246f Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Wed, 3 Jul 2024 23:10:13 +0800 Subject: [PATCH 1/2] Add loongarch64-unknown-linux-musl support --- .github/workflows/ci.yaml | 42 +++++++++---------- .../linux-builds-template.yaml | 37 ++++++++-------- ci/cloudfront-invalidation.txt | 2 + .../loongarch64-unknown-linux-musl/Dockerfile | 4 ++ ci/fetch-rust-docker.bash | 1 + doc/user-guide/src/installation/other.md | 2 + src/dist/mod.rs | 5 +++ 7 files changed, 54 insertions(+), 39 deletions(-) create mode 100644 ci/docker/loongarch64-unknown-linux-musl/Dockerfile diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a1f6593e2a..30c707c519 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -608,9 +608,9 @@ jobs: - x86_64-unknown-linux-gnu - armv7-unknown-linux-gnueabihf - aarch64-linux-android - - aarch64-unknown-linux-gnu # skip-pr - - powerpc64-unknown-linux-gnu # skip-pr - - x86_64-unknown-linux-musl # skip-pr + - aarch64-unknown-linux-gnu # skip-pr + - powerpc64-unknown-linux-gnu # skip-pr + - x86_64-unknown-linux-musl # skip-pr include: - target: x86_64-unknown-linux-gnu run_tests: YES @@ -757,24 +757,24 @@ jobs: - x86_64-unknown-linux-gnu - armv7-unknown-linux-gnueabihf - aarch64-linux-android - - aarch64-unknown-linux-gnu # skip-pr - - aarch64-unknown-linux-musl # skip-pr skip-master - - powerpc64-unknown-linux-gnu # skip-pr - - x86_64-unknown-linux-musl # skip-pr - - i686-unknown-linux-gnu # skip-pr skip-master - - arm-unknown-linux-gnueabi # skip-pr skip-master - - arm-unknown-linux-gnueabihf # skip-pr skip-master - - x86_64-unknown-freebsd # skip-pr skip-master - - x86_64-unknown-netbsd # skip-pr skip-master - - x86_64-unknown-illumos # skip-pr skip-master - - powerpc-unknown-linux-gnu # skip-pr skip-master - - powerpc64le-unknown-linux-gnu # skip-pr skip-master - - s390x-unknown-linux-gnu # skip-pr skip-master - - arm-linux-androideabi # skip-pr skip-master - - armv7-linux-androideabi # skip-pr skip-master - - x86_64-linux-android # skip-pr skip-master - - riscv64gc-unknown-linux-gnu # skip-pr skip-master - - loongarch64-unknown-linux-gnu # skip-pr skip-master + - aarch64-unknown-linux-gnu # skip-pr + - aarch64-unknown-linux-musl # skip-pr skip-master + - powerpc64-unknown-linux-gnu # skip-pr + - x86_64-unknown-linux-musl # skip-pr + - i686-unknown-linux-gnu # skip-pr skip-master + - arm-unknown-linux-gnueabi # skip-pr skip-master + - arm-unknown-linux-gnueabihf # skip-pr skip-master + - x86_64-unknown-freebsd # skip-pr skip-master + - x86_64-unknown-netbsd # skip-pr skip-master + - x86_64-unknown-illumos # skip-pr skip-master + - powerpc-unknown-linux-gnu # skip-pr skip-master + - powerpc64le-unknown-linux-gnu # skip-pr skip-master + - s390x-unknown-linux-gnu # skip-pr skip-master + - arm-linux-androideabi # skip-pr skip-master + - armv7-linux-androideabi # skip-pr skip-master + - x86_64-linux-android # skip-pr skip-master + - riscv64gc-unknown-linux-gnu # skip-pr skip-master + - loongarch64-unknown-linux-gnu # skip-pr skip-master include: - target: x86_64-unknown-linux-gnu run_tests: YES diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index 561dcaa273..19423356a6 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -19,24 +19,25 @@ jobs: # skip-master skip-pr skip-stable - x86_64-unknown-linux-gnu - armv7-unknown-linux-gnueabihf - aarch64-linux-android - - aarch64-unknown-linux-gnu # skip-pr - - aarch64-unknown-linux-musl # skip-pr skip-master - - powerpc64-unknown-linux-gnu # skip-pr - - x86_64-unknown-linux-musl # skip-pr - - i686-unknown-linux-gnu # skip-pr skip-master - - arm-unknown-linux-gnueabi # skip-pr skip-master - - arm-unknown-linux-gnueabihf # skip-pr skip-master - - x86_64-unknown-freebsd # skip-pr skip-master - - x86_64-unknown-netbsd # skip-pr skip-master - - x86_64-unknown-illumos # skip-pr skip-master - - powerpc-unknown-linux-gnu # skip-pr skip-master - - powerpc64le-unknown-linux-gnu # skip-pr skip-master - - s390x-unknown-linux-gnu # skip-pr skip-master - - arm-linux-androideabi # skip-pr skip-master - - armv7-linux-androideabi # skip-pr skip-master - - x86_64-linux-android # skip-pr skip-master - - riscv64gc-unknown-linux-gnu # skip-pr skip-master - - loongarch64-unknown-linux-gnu # skip-pr skip-master + - aarch64-unknown-linux-gnu # skip-pr + - aarch64-unknown-linux-musl # skip-pr skip-master + - powerpc64-unknown-linux-gnu # skip-pr + - x86_64-unknown-linux-musl # skip-pr + - i686-unknown-linux-gnu # skip-pr skip-master + - arm-unknown-linux-gnueabi # skip-pr skip-master + - arm-unknown-linux-gnueabihf # skip-pr skip-master + - x86_64-unknown-freebsd # skip-pr skip-master + - x86_64-unknown-netbsd # skip-pr skip-master + - x86_64-unknown-illumos # skip-pr skip-master + - powerpc-unknown-linux-gnu # skip-pr skip-master + - powerpc64le-unknown-linux-gnu # skip-pr skip-master + - s390x-unknown-linux-gnu # skip-pr skip-master + - arm-linux-androideabi # skip-pr skip-master + - armv7-linux-androideabi # skip-pr skip-master + - x86_64-linux-android # skip-pr skip-master + - riscv64gc-unknown-linux-gnu # skip-pr skip-master + - loongarch64-unknown-linux-gnu # skip-pr skip-master + - loongarch64-unknown-linux-musl # skip-pr skip-master skip-stable include: - target: x86_64-unknown-linux-gnu run_tests: YES diff --git a/ci/cloudfront-invalidation.txt b/ci/cloudfront-invalidation.txt index c37f5056a0..0238bd1e41 100644 --- a/ci/cloudfront-invalidation.txt +++ b/ci/cloudfront-invalidation.txt @@ -33,6 +33,8 @@ rustup/dist/i686-unknown-linux-gnu/rustup-init rustup/dist/i686-unknown-linux-gnu/rustup-init.sha256 rustup/dist/loongarch64-unknown-linux-gnu/rustup-init rustup/dist/loongarch64-unknown-linux-gnu/rustup-init.sha256 +rustup/dist/loongarch64-unknown-linux-musl/rustup-init +rustup/dist/loongarch64-unknown-linux-musl/rustup-init.sha256 rustup/dist/mips-unknown-linux-gnu/rustup-init rustup/dist/mips-unknown-linux-gnu/rustup-init.sha256 rustup/dist/mips64-unknown-linux-gnuabi64/rustup-init diff --git a/ci/docker/loongarch64-unknown-linux-musl/Dockerfile b/ci/docker/loongarch64-unknown-linux-musl/Dockerfile new file mode 100644 index 0000000000..8044679f53 --- /dev/null +++ b/ci/docker/loongarch64-unknown-linux-musl/Dockerfile @@ -0,0 +1,4 @@ +FROM rust-loongarch64-unknown-linux-musl + +ENV CC_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-gcc \ + CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=loongarch64-unknown-linux-musl-gcc diff --git a/ci/fetch-rust-docker.bash b/ci/fetch-rust-docker.bash index 23fbabfe76..e739d2e095 100644 --- a/ci/fetch-rust-docker.bash +++ b/ci/fetch-rust-docker.bash @@ -42,6 +42,7 @@ case "$TARGET" in x86_64-unknown-netbsd) image=dist-x86_64-netbsd ;; riscv64gc-unknown-linux-gnu) image=dist-riscv64-linux ;; loongarch64-unknown-linux-gnu) image=dist-loongarch64-linux ;; + loongarch64-unknown-linux-musl) image=dist-loongarch64-musl ;; *) exit ;; esac diff --git a/doc/user-guide/src/installation/other.md b/doc/user-guide/src/installation/other.md index dce210f376..f51421200d 100644 --- a/doc/user-guide/src/installation/other.md +++ b/doc/user-guide/src/installation/other.md @@ -104,6 +104,8 @@ You can manually download `rustup-init` for a given target from - [sha256 file](https://static.rust-lang.org/rustup/dist/i686-unknown-linux-gnu/rustup-init.sha256) - [loongarch64-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/loongarch64-unknown-linux-gnu/rustup-init) - [sha256 file](https://static.rust-lang.org/rustup/dist/loongarch64-unknown-linux-gnu/rustup-init.sha256) +- [loongarch64-unknown-linux-musl](https://static.rust-lang.org/rustup/dist/loongarch64-unknown-linux-musl/rustup-init) + - [sha256 file](https://static.rust-lang.org/rustup/dist/loongarch64-unknown-linux-musl/rustup-init.sha256) - [mips-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/mips-unknown-linux-gnu/rustup-init) - [sha256 file](https://static.rust-lang.org/rustup/dist/mips-unknown-linux-gnu/rustup-init.sha256) - [mips64-unknown-linux-gnuabi64](https://static.rust-lang.org/rustup/dist/mips64-unknown-linux-gnuabi64/rustup-init) diff --git a/src/dist/mod.rs b/src/dist/mod.rs index 53eaf8bf03..17d5542c16 100644 --- a/src/dist/mod.rs +++ b/src/dist/mod.rs @@ -247,6 +247,10 @@ const TRIPLE_X86_64_UNKNOWN_LINUX: &str = "x86_64-unknown-linux-musl"; const TRIPLE_AARCH64_UNKNOWN_LINUX: &str = "aarch64-unknown-linux-gnu"; #[cfg(all(not(windows), target_env = "musl"))] const TRIPLE_AARCH64_UNKNOWN_LINUX: &str = "aarch64-unknown-linux-musl"; +#[cfg(all(not(windows), not(target_env = "musl")))] +const TRIPLE_LOONGARCH64_UNKNOWN_LINUX: &str = "loongarch64-unknown-linux-gnu"; +#[cfg(all(not(windows), target_env = "musl"))] +const TRIPLE_LOONGARCH64_UNKNOWN_LINUX: &str = "loongarch64-unknown-linux-musl"; // MIPS platforms don't indicate endianness in uname, however binaries only // run on boxes with the same endianness, as expected. @@ -503,6 +507,7 @@ impl TargetTriple { } else { TRIPLE_AARCH64_UNKNOWN_LINUX }), + (b"Linux", b"loongarch64") => Some(TRIPLE_LOONGARCH64_UNKNOWN_LINUX), (b"Darwin", b"x86_64") => Some("x86_64-apple-darwin"), (b"Darwin", b"i686") => Some("i686-apple-darwin"), (b"FreeBSD", b"x86_64") => Some("x86_64-unknown-freebsd"), From f2b0ab76b0e86fbe76984b1572826cfa434a29bb Mon Sep 17 00:00:00 2001 From: rami3l Date: Fri, 5 Jul 2024 11:21:06 +0800 Subject: [PATCH 2/2] docs(ci): simplify the target policy in the README --- ci/actions-templates/README.md | 64 ++++++++-------------------------- 1 file changed, 14 insertions(+), 50 deletions(-) diff --git a/ci/actions-templates/README.md b/ci/actions-templates/README.md index 7f211b800d..7eabe13c4f 100644 --- a/ci/actions-templates/README.md +++ b/ci/actions-templates/README.md @@ -27,56 +27,20 @@ to S3 so that we can then make a release of rustup. ## Targets we need to build -We build for all the Tier one targets and a non-trivial number of the tier two -targets of Rust. We do not even attempt tier three builds. - -We don't run the tests on all the targets because many are cross-built. If we -cross-build we don't run the tests. All the builds which aren't mac or windows -are built on an x86_64 system because that's the easiest way to get a performant -system. - -| Target | Cross | Tier | On PR? | On master? | -| ----------------------------- | ---------- | ----- | ------ | ---------- | -| x86_64-unknown-linux-gnu | No | One | Yes | Yes | -| armv7-unknown-linux-gnueabihf | Yes | Two | Yes | Yes | -| aarch64-linux-android | Yes | Two | Yes | Yes | -| aarch64-unknown-linux-gnu | Yes | Two | No | Yes | -| aarch64-unknown-linux-musl | Yes | Two | No | Yes | -| powerpc64-unknown-linux-gnu | Yes | Two | No | Yes | -| x86_64-unknown-linux-musl | Yes | Two | No | Yes | -| i686-unknown-linux-gnu | Yes | One | No | No | -| arm-unknown-linux-gnueabi | Yes | Two | No | No | -| arm-unknown-linux-gnueabihf | Yes | Two | No | No | -| x86_64-unknown-freebsd | Yes | Two | No | No | -| x86_64-unknown-netbsd | Yes | Two | No | No | -| x86_64-unknown-illumos | Yes | Two | No | No | -| powerpc-unknown-linux-gnu | Yes | Two | No | No | -| powerpc64le-unknown-linux-gnu | Yes | Two | No | No | -| mips-unknown-linux-gnu | Yes | Two | No | No | -| mips64-unknown-linux-gnu | Yes | Two | No | No | -| mipsel-unknown-linux-gnu | Yes | Two | No | No | -| mips64el-unknown-linux-gnu | Yes | Two | No | No | -| s390x-unknown-linux-gnu | Yes | Two | No | No | -| arm-linux-androideabi | Yes | Two | No | No | -| armv7-linux-androideabi | Yes | Two | No | No | -| i686-linux-android | Yes | Two | No | No | -| x86_64-linux-android | Yes | Two | No | No | -| riscv64gc-unknown-linux-gnu | Yes | --- | No | No | -| loongarch64-unknown-linux-gnu | Yes | Two | No | No | -| ----------------------------- | ---------- | ----- | ------ | ---------- | -| aarch64-apple-darwin | Yes | Two | Yes | Yes | -| x86_64-apple-darwin | No | One | Yes | Yes | -| ----------------------------- | ---------- | ----- | ------ | ---------- | -| x86_64-pc-windows-msvc | No | One | Yes | Yes | -| x86_64-pc-windows-gnu | No | One | No | Yes | -| i686-pc-windows-msvc | No | One | No | No | -| i686-pc-windows-gnu | No | One | No | No | -| aarch64-pc-windows-msvc | Yes | Two | No | Yes | - -We also have a clippy/shellcheck target which runs on x86_64 linux and is -run in all cases. It does a `cargo fmt` check, a `cargo clippy` check on the -beta toolchain, and also runs `rustup-init.sh` through to completion inside -a centos 6 docker to ensure that we continue to work on there OK. +We follow `rustc`'s [platform support policy] closely, and so `rustup` is expected +to build for all targets listed in the _tier 1_ or the _tier 2 with host tools_ section. + +[platform support policy]: https://doc.rust-lang.org/nightly/rustc/platform-support.html + +In order to reduce the maintainance burden, targets listed in the _tier 2 without host +tools_ section might get limited support, but should by no means become a blocker. +We should not build for targets listed in the _tier 3_ section, and if a target gets +downgraded to tier 3, its CI workflows should be dropped accordingly. + +If a platform is directly supported by GitHub Action's free runners, we should always +build for it natively with the full test suite activated. +Otherwise, we might consider performing a cross-build, in which case we won't run the +tests for the the target. ## Useful notes about how we run builds