Skip to content

Commit 571ce5f

Browse files
committed
Add a script for downloading compiler-rt
Rather than needing to copy the version and URL from the CI workflow, put this into a script that can be directly run locally.
1 parent b833653 commit 571ce5f

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

.github/workflows/main.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on: [push, pull_request]
44
env:
55
RUSTDOCFLAGS: -Dwarnings
66
RUSTFLAGS: -Dwarnings
7-
RUST_LLVM_VERSION: 20.1-2025-02-13
87
RUST_COMPILER_RT_ROOT: ./compiler-rt
98

109
jobs:
@@ -129,12 +128,10 @@ jobs:
129128
uses: actions/cache@v4
130129
with:
131130
path: compiler-rt
132-
key: ${{ runner.os }}-compiler-rt-${{ env.RUST_LLVM_VERSION }}
131+
key: ${{ runner.os }}-compiler-rt-${{ hashFiles('ci/download-compiler-rt.sh') }}
133132
- name: Download compiler-rt reference sources
134133
if: steps.cache-compiler-rt.outputs.cache-hit != 'true'
135-
run: |
136-
curl -L -o code.tar.gz "https://github.com/rust-lang/llvm-project/archive/rustc/${RUST_LLVM_VERSION}.tar.gz"
137-
tar xzf code.tar.gz --strip-components 1 llvm-project-rustc-${RUST_LLVM_VERSION}/compiler-rt
134+
run: ./ci/download-compiler-rt.sh
138135
shell: bash
139136

140137
# Non-linux tests just use our raw script

build.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,10 @@ mod c {
619619
let root = match env::var_os("RUST_COMPILER_RT_ROOT") {
620620
Some(s) => PathBuf::from(s),
621621
None => {
622-
panic!("RUST_COMPILER_RT_ROOT is not set. You may need to download compiler-rt.")
622+
panic!(
623+
"RUST_COMPILER_RT_ROOT is not set. You may need to run \
624+
`ci/download-compiler-rt.sh`."
625+
);
623626
}
624627
};
625628
if !root.exists() {

ci/download-compiler-rt.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
# Download sources to build C versions of intrinsics. Once being run,
3+
# `RUST_COMPILER_RT_ROOT` must be set.
4+
5+
set -eux
6+
7+
rust_llvm_version=20.1-2025-02-13
8+
9+
curl -L -o code.tar.gz "https://github.com/rust-lang/llvm-project/archive/rustc/${rust_llvm_version}.tar.gz"
10+
tar xzf code.tar.gz --strip-components 1 llvm-project-rustc-${rust_llvm_version}/compiler-rt

0 commit comments

Comments
 (0)