Switch musl from a script download to a submodule
Rather than keeping a script that downloads the tarball, we can just add musl as a submodule and let git handle the synchronizatoin. Do so here.
This commit is contained in:
parent
98fd72b62a
commit
259e544192
7 changed files with 20 additions and 46 deletions
|
|
@ -79,6 +79,8 @@ jobs:
|
|||
- name: Print runner information
|
||||
run: uname -a
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install Rust (rustup)
|
||||
shell: bash
|
||||
run: |
|
||||
|
|
@ -94,10 +96,6 @@ jobs:
|
|||
with:
|
||||
key: ${{ matrix.target }}
|
||||
|
||||
- name: Download musl source
|
||||
run: ./ci/download-musl.sh
|
||||
shell: bash
|
||||
|
||||
- name: Verify API list
|
||||
if: matrix.os == 'ubuntu-24.04'
|
||||
run: python3 etc/update-api-list.py --check
|
||||
|
|
@ -126,14 +124,14 @@ jobs:
|
|||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
with:
|
||||
submodules: true
|
||||
- name: Install Rust
|
||||
run: |
|
||||
rustup update nightly --no-self-update
|
||||
rustup default nightly
|
||||
rustup component add clippy
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Download musl source
|
||||
run: ./ci/download-musl.sh
|
||||
- run: cargo clippy --all --all-features --all-targets
|
||||
|
||||
builtins:
|
||||
|
|
@ -153,6 +151,8 @@ jobs:
|
|||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
with:
|
||||
submodules: true
|
||||
- uses: taiki-e/install-action@cargo-binstall
|
||||
|
||||
- name: Set up dependencies
|
||||
|
|
@ -166,8 +166,6 @@ jobs:
|
|||
sudo apt-get install valgrind
|
||||
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Download musl source
|
||||
run: ./ci/download-musl.sh
|
||||
|
||||
- name: Run icount benchmarks
|
||||
env:
|
||||
|
|
@ -259,13 +257,13 @@ jobs:
|
|||
CHANGED: ${{ matrix.changed }}
|
||||
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/download-musl.sh
|
||||
- name: Run extensive tests
|
||||
run: |
|
||||
echo "Changed: '$CHANGED'"
|
||||
|
|
|
|||
1
library/compiler-builtins/libm/.gitignore
vendored
1
library/compiler-builtins/libm/.gitignore
vendored
|
|
@ -4,7 +4,6 @@
|
|||
/math/src
|
||||
target
|
||||
Cargo.lock
|
||||
musl/
|
||||
**.tar.gz
|
||||
|
||||
# Benchmark cache
|
||||
|
|
|
|||
4
library/compiler-builtins/libm/.gitmodules
vendored
Normal file
4
library/compiler-builtins/libm/.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[submodule "musl"]
|
||||
path = crates/musl-math-sys/musl
|
||||
url = https://git.musl-libc.org/git/musl
|
||||
shallow = true
|
||||
|
|
@ -62,6 +62,10 @@ Check [PR #65] for an example.
|
|||
Normal tests can be executed with:
|
||||
|
||||
```sh
|
||||
# Tests against musl require that the submodule is up to date.
|
||||
git submodule init
|
||||
git submodule update
|
||||
|
||||
# `--release` ables more test cases
|
||||
cargo test --release
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Download the expected version of musl to a directory `musl`
|
||||
|
||||
set -eux
|
||||
|
||||
fname=musl-1.2.5.tar.gz
|
||||
sha=a9a118bbe84d8764da0ea0d28b3ab3fae8477fc7e4085d90102b8596fc7c75e4
|
||||
|
||||
mkdir musl
|
||||
curl -L "https://musl.libc.org/releases/$fname" -O --retry 5
|
||||
|
||||
case "$(uname -s)" in
|
||||
MINGW*)
|
||||
# Need to extract the second line because certutil does human output
|
||||
fsha=$(certutil -hashfile "$fname" SHA256 | sed -n '2p')
|
||||
[ "$sha" = "$fsha" ] || exit 1
|
||||
;;
|
||||
*)
|
||||
echo "$sha $fname" | shasum -a 256 --check || exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
tar -xzf "$fname" -C musl --strip-components 1
|
||||
rm "$fname"
|
||||
|
|
@ -79,17 +79,12 @@ impl Config {
|
|||
let target_features = env::var("CARGO_CFG_TARGET_FEATURE")
|
||||
.map(|feats| feats.split(',').map(ToOwned::to_owned).collect())
|
||||
.unwrap_or_default();
|
||||
|
||||
// Default to the `{workspace_root}/musl` if not specified
|
||||
let musl_dir = env::var("MUSL_SOURCE_DIR")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|_| manifest_dir.parent().unwrap().parent().unwrap().join("musl"));
|
||||
let musl_dir = manifest_dir.join("musl");
|
||||
|
||||
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
|
||||
let musl_arch = if target_arch == "x86" { "i386".to_owned() } else { target_arch.clone() };
|
||||
|
||||
println!("cargo::rerun-if-changed={}/c_patches", manifest_dir.display());
|
||||
println!("cargo::rerun-if-env-changed=MUSL_SOURCE_DIR");
|
||||
println!("cargo::rerun-if-changed={}", musl_dir.display());
|
||||
|
||||
Self {
|
||||
|
|
@ -111,13 +106,10 @@ impl Config {
|
|||
/// Build musl math symbols to a static library
|
||||
fn build_musl_math(cfg: &Config) {
|
||||
let musl_dir = &cfg.musl_dir;
|
||||
assert!(
|
||||
musl_dir.exists(),
|
||||
"musl source is missing. it can be downloaded with ./ci/download-musl.sh"
|
||||
);
|
||||
|
||||
let math = musl_dir.join("src/math");
|
||||
let arch_dir = musl_dir.join("arch").join(&cfg.musl_arch);
|
||||
assert!(math.exists(), "musl source not found. Is the submodule up to date?");
|
||||
|
||||
let source_map = find_math_source(&math, cfg);
|
||||
let out_path = cfg.out_dir.join(format!("lib{LIB_NAME}.a"));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 0784374d561435f7c787a555aeab8ede699ed298
|
||||
Loading…
Add table
Add a link
Reference in a new issue