Skip to content

Replace the musl submodule with a download script #944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ jobs:
- name: Print runner information
run: uname -a
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Rust (rustup)
shell: bash
run: |
Expand Down Expand Up @@ -146,6 +144,10 @@ jobs:
shell: bash
- run: echo "RUST_COMPILER_RT_ROOT=$(realpath ./compiler-rt)" >> "$GITHUB_ENV"
shell: bash

- name: Download musl source
run: ./ci/update-musl.sh
shell: bash

- name: Verify API list
if: matrix.os == 'ubuntu-24.04'
Expand Down Expand Up @@ -182,15 +184,15 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
submodules: true
# Unlike rustfmt, stable clippy does not work on code with nightly features.
- name: Install nightly `clippy`
run: |
rustup set profile minimal
rustup default nightly
rustup component add clippy
- uses: Swatinem/rust-cache@v2
- name: Download musl source
run: ./ci/update-musl.sh
- run: cargo clippy --workspace --all-targets

benchmarks:
Expand All @@ -205,8 +207,6 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
with:
submodules: true
- uses: taiki-e/install-action@cargo-binstall

- name: Set up dependencies
Expand All @@ -223,6 +223,8 @@ jobs:
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Download musl source
run: ./ci/update-musl.sh

- name: Run icount benchmarks
env:
Expand Down Expand Up @@ -256,8 +258,6 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Rust (rustup)
run: rustup update nightly --no-self-update && rustup default nightly
shell: bash
Expand Down Expand Up @@ -292,8 +292,6 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable `rustfmt`
run: rustup set profile minimal && rustup default stable && rustup component add rustfmt
- run: cargo fmt -- --check
Expand All @@ -317,13 +315,13 @@ jobs:
TO_TEST: ${{ matrix.to_test }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Rust
run: |
rustup update nightly --no-self-update
rustup default nightly
- uses: Swatinem/rust-cache@v2
- name: download musl source
run: ./ci/update-musl.sh
- name: Run extensive tests
run: ./ci/run-extensive.sh
- name: Print test logs if available
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ iai-home
*.bk
*.rs.bk
.#*

# Manually managed
crates/musl-math-sys/musl
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

15 changes: 15 additions & 0 deletions ci/update-musl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
# Download musl to a repository for `musl-math-sys`

set -eux

url=git://git.musl-libc.org/musl
ref=c47ad25ea3b484e10326f933e927c0bc8cded3da
dst=crates/musl-math-sys/musl

if ! [ -d "$dst" ]; then
git clone "$url" "$dst" --single-branch --depth=1000
fi

git -C "$dst" fetch "$url" --depth=1
git -C "$dst" checkout "$ref"
2 changes: 1 addition & 1 deletion crates/musl-math-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ fn build_musl_math(cfg: &Config) {
let arch_dir = musl_dir.join("arch").join(&cfg.musl_arch);
assert!(
math.exists(),
"musl source not found. Is the submodule up to date?"
"musl source not found. You may need to run `./ci/update-musl.sh`."
);

let source_map = find_math_source(&math, cfg);
Expand Down
1 change: 0 additions & 1 deletion crates/musl-math-sys/musl
Submodule musl deleted from c47ad2
2 changes: 1 addition & 1 deletion libm-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish = false
license = "MIT OR Apache-2.0"

[features]
default = ["build-mpfr", "build-musl", "unstable-float"]
default = ["build-mpfr", "unstable-float"]

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