Auto merge of #1467 - gnzlbg:fix_freebsd, r=gnzlbg
Fix FreeBSD #1440 broke FreeBSD by changing `libc` FreeBSD targets to require a `cfg(freebsdXX)` to be defined, but not updating `build.rs` to define `freebsd11` when `LIBC_CI` is not available. Since `LIBC_CI` is always defined on CI, this issue went undetected. This PR fixes that issue in the `build.rs` and introduces a build task that tests FreeBSD without `LIBC_CI` on FreeBSD11, although I'm not sure this would have caught the issue in #1466 . Closes #1466 .
This commit is contained in:
commit
37f8f8dc23
|
@ -10,6 +10,7 @@ task:
|
|||
- rustup default stable
|
||||
test_script:
|
||||
- . $HOME/.cargo/env
|
||||
- LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd
|
||||
- sh ci/run.sh x86_64-unknown-freebsd
|
||||
|
||||
task:
|
||||
|
@ -24,4 +25,5 @@ task:
|
|||
- rustup default nightly
|
||||
test_script:
|
||||
- . $HOME/.cargo/env
|
||||
- LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd
|
||||
- sh ci/run.sh x86_64-unknown-freebsd
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "libc"
|
||||
version = "0.2.61"
|
||||
version = "0.2.62"
|
||||
authors = ["The Rust Project Developers"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
readme = "README.md"
|
||||
|
|
21
build.rs
21
build.rs
|
@ -7,6 +7,8 @@ fn main() {
|
|||
rustc_minor_version().expect("Failed to get rustc version");
|
||||
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
|
||||
let align_cargo_feature = env::var("CARGO_FEATURE_ALIGN").is_ok();
|
||||
#[allow(unused)]
|
||||
let libc_ci = env::var("LIBC_CI").is_ok();
|
||||
|
||||
if env::var("CARGO_FEATURE_USE_STD").is_ok() {
|
||||
println!(
|
||||
|
@ -15,16 +17,15 @@ fn main() {
|
|||
);
|
||||
}
|
||||
|
||||
if env::var("LIBC_CI").is_ok() {
|
||||
if let Some(11) = which_freebsd() {
|
||||
println!("cargo:rustc-cfg=freebsd11");
|
||||
}
|
||||
if let Some(12) = which_freebsd() {
|
||||
println!("cargo:rustc-cfg=freebsd12");
|
||||
}
|
||||
if let Some(13) = which_freebsd() {
|
||||
println!("cargo:rustc-cfg=freebsd13");
|
||||
}
|
||||
// The ABI of libc is backward compatible with FreeBSD 11.
|
||||
//
|
||||
// On CI, we detect the actual FreeBSD version and match its ABI exactly,
|
||||
// running tests to ensure that the ABI is correct.
|
||||
match which_freebsd() {
|
||||
Some(11) if libc_ci => println!("cargo:rustc-cfg=freebsd11"),
|
||||
Some(12) if libc_ci => println!("cargo:rustc-cfg=freebsd12"),
|
||||
Some(13) if libc_ci => println!("cargo:rustc-cfg=freebsd13"),
|
||||
Some(_) | None => println!("cargo:rustc-cfg=freebsd11"),
|
||||
}
|
||||
|
||||
// Rust >= 1.15 supports private module use:
|
||||
|
|
10
ci/azure.yml
10
ci/azure.yml
|
@ -15,7 +15,7 @@ jobs:
|
|||
vmImage: ubuntu-16.04
|
||||
steps:
|
||||
- template: azure-install-rust.yml
|
||||
- bash: sh ./ci/run-docker.sh $TARGET
|
||||
- bash: LIBC_CI=1 sh ./ci/run-docker.sh $TARGET
|
||||
displayName: Execute run-docker.sh
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -30,7 +30,7 @@ jobs:
|
|||
vmImage: ubuntu-16.04
|
||||
steps:
|
||||
- template: azure-install-rust.yml
|
||||
- bash: sh ./ci/run-docker.sh $TARGET
|
||||
- bash: LIBC_CI=1 sh ./ci/run-docker.sh $TARGET
|
||||
displayName: Execute run-docker.sh
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -88,7 +88,7 @@ jobs:
|
|||
vmImage: macos-10.14
|
||||
steps:
|
||||
- template: azure-install-rust.yml
|
||||
- bash: sh ./ci/run.sh $TARGET
|
||||
- bash: LIBC_CI=1 sh ./ci/run.sh $TARGET
|
||||
displayName: Execute run.sh
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -100,7 +100,7 @@ jobs:
|
|||
vmImage: macos-10.13
|
||||
steps:
|
||||
- template: azure-install-rust.yml
|
||||
- bash: sh ./ci/run.sh $TARGET
|
||||
- bash: LIBC_CI=1 sh ./ci/run.sh $TARGET
|
||||
displayName: Execute run.sh
|
||||
strategy:
|
||||
matrix:
|
||||
|
@ -112,7 +112,7 @@ jobs:
|
|||
vmImage: vs2017-win2016
|
||||
steps:
|
||||
- template: azure-install-rust.yml
|
||||
- bash: sh ./ci/run.sh $TARGET
|
||||
- bash: LIBC_CI=1 sh ./ci/run.sh $TARGET
|
||||
displayName: Execute run.sh
|
||||
strategy:
|
||||
matrix:
|
||||
|
|
|
@ -47,6 +47,9 @@ while read -r target; do
|
|||
|
||||
rustup target add "${target}" || true
|
||||
|
||||
# Enable extra configuration flags:
|
||||
export RUSTDOCFLAGS="--cfg freebsd11"
|
||||
|
||||
# If cargo doc fails, then try xargo:
|
||||
if ! cargo doc --target "${target}" \
|
||||
--no-default-features --features extra_traits ; then
|
||||
|
|
|
@ -23,6 +23,7 @@ run() {
|
|||
docker run \
|
||||
--rm \
|
||||
--user "$(id -u)":"$(id -g)" \
|
||||
--env LIBC_CI \
|
||||
--env CARGO_HOME=/cargo \
|
||||
--env CARGO_TARGET_DIR=/checkout/target \
|
||||
--volume "$(dirname "$(dirname "$(command -v cargo)")")":/cargo \
|
||||
|
|
|
@ -87,8 +87,6 @@ if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then
|
|||
opt="--release"
|
||||
fi
|
||||
|
||||
export LIBC_CI=1
|
||||
|
||||
cargo test -vv $opt --no-default-features --manifest-path libc-test/Cargo.toml \
|
||||
--target "${TARGET}"
|
||||
|
||||
|
|
|
@ -1334,9 +1334,11 @@ cfg_if! {
|
|||
} else if #[cfg(freebsd13)] {
|
||||
mod freebsd12;
|
||||
pub use self::freebsd12::*;
|
||||
} else {
|
||||
} else if #[cfg(freebsd11)] {
|
||||
mod freebsd11;
|
||||
pub use self::freebsd11::*;
|
||||
} else {
|
||||
// Unknown freebsd version
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue