Skip to content

Commit f1c4a11

Browse files
committed
Replace the musl submodule with a download script
The submodule was causing issues in rust-lang/rust, so eliminiate it here. `build-musl` is also removed from `libm-test`'s default features so the crate doesn't need to be built by default.
1 parent da8433d commit f1c4a11

File tree

7 files changed

+30
-19
lines changed

7 files changed

+30
-19
lines changed

.github/workflows/main.yaml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ jobs:
108108
- name: Print runner information
109109
run: uname -a
110110
- uses: actions/checkout@v4
111-
with:
112-
submodules: true
113111
- name: Install Rust (rustup)
114112
shell: bash
115113
run: |
@@ -146,6 +144,10 @@ jobs:
146144
shell: bash
147145
- run: echo "RUST_COMPILER_RT_ROOT=$(realpath ./compiler-rt)" >> "$GITHUB_ENV"
148146
shell: bash
147+
148+
- name: Download musl source
149+
run: ./ci/update-musl.sh
150+
shell: bash
149151

150152
- name: Verify API list
151153
if: matrix.os == 'ubuntu-24.04'
@@ -182,15 +184,15 @@ jobs:
182184
timeout-minutes: 10
183185
steps:
184186
- uses: actions/checkout@v4
185-
with:
186-
submodules: true
187187
# Unlike rustfmt, stable clippy does not work on code with nightly features.
188188
- name: Install nightly `clippy`
189189
run: |
190190
rustup set profile minimal
191191
rustup default nightly
192192
rustup component add clippy
193193
- uses: Swatinem/rust-cache@v2
194+
- name: Download musl source
195+
run: ./ci/update-musl.sh
194196
- run: cargo clippy --workspace --all-targets
195197

196198
benchmarks:
@@ -205,8 +207,6 @@ jobs:
205207
runs-on: ${{ matrix.os }}
206208
steps:
207209
- uses: actions/checkout@master
208-
with:
209-
submodules: true
210210
- uses: taiki-e/install-action@cargo-binstall
211211

212212
- name: Set up dependencies
@@ -223,6 +223,8 @@ jobs:
223223
- uses: Swatinem/rust-cache@v2
224224
with:
225225
key: ${{ matrix.target }}
226+
- name: Download musl source
227+
run: ./ci/update-musl.sh
226228

227229
- name: Run icount benchmarks
228230
env:
@@ -256,8 +258,6 @@ jobs:
256258
timeout-minutes: 10
257259
steps:
258260
- uses: actions/checkout@v4
259-
with:
260-
submodules: true
261261
- name: Install Rust (rustup)
262262
run: rustup update nightly --no-self-update && rustup default nightly
263263
shell: bash
@@ -292,8 +292,6 @@ jobs:
292292
timeout-minutes: 10
293293
steps:
294294
- uses: actions/checkout@v4
295-
with:
296-
submodules: true
297295
- name: Install stable `rustfmt`
298296
run: rustup set profile minimal && rustup default stable && rustup component add rustfmt
299297
- run: cargo fmt -- --check
@@ -317,13 +315,13 @@ jobs:
317315
TO_TEST: ${{ matrix.to_test }}
318316
steps:
319317
- uses: actions/checkout@v4
320-
with:
321-
submodules: true
322318
- name: Install Rust
323319
run: |
324320
rustup update nightly --no-self-update
325321
rustup default nightly
326322
- uses: Swatinem/rust-cache@v2
323+
- name: download musl source
324+
run: ./ci/update-musl.sh
327325
- name: Run extensive tests
328326
run: ./ci/run-extensive.sh
329327
- name: Print test logs if available

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,6 @@ iai-home
1414
*.bk
1515
*.rs.bk
1616
.#*
17+
18+
# Manually managed
19+
crates/musl-math-sys/musl

.gitmodules

Lines changed: 0 additions & 4 deletions
This file was deleted.

ci/update-musl.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
# Download musl to a repository for `musl-math-sys`
3+
4+
set -eux
5+
6+
url=git://git.musl-libc.org/musl
7+
ref=c47ad25ea3b484e10326f933e927c0bc8cded3da
8+
dst=crates/musl-math-sys/musl
9+
10+
if ! [ -d "$dst" ]; then
11+
git clone "$url" "$dst" --single-branch --depth=1000
12+
fi
13+
14+
git -C "$dst" fetch "$url" --depth=1
15+
git -C "$dst" checkout "$ref"

crates/musl-math-sys/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ fn build_musl_math(cfg: &Config) {
120120
let arch_dir = musl_dir.join("arch").join(&cfg.musl_arch);
121121
assert!(
122122
math.exists(),
123-
"musl source not found. Is the submodule up to date?"
123+
"musl source not found. You may need to run `./ci/update-musl.sh`."
124124
);
125125

126126
let source_map = find_math_source(&math, cfg);

crates/musl-math-sys/musl

Lines changed: 0 additions & 1 deletion
This file was deleted.

libm-test/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ publish = false
66
license = "MIT OR Apache-2.0"
77

88
[features]
9-
default = ["build-mpfr", "build-musl", "unstable-float"]
9+
default = ["build-mpfr", "unstable-float"]
1010

1111
# Propagated from libm because this affects which functions we test.
1212
unstable-float = ["libm/unstable-float", "rug?/nightly-float"]

0 commit comments

Comments
 (0)