From 155f9b7e7f36975240ef93f3daf983b228592a11 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Thu, 15 Aug 2019 08:11:13 -0700 Subject: Update libc crate to 0.2.62 This change updates the libc crate to version 0.2.62. Import subrepo libc/:libc at 37f8f8dc233a79ea9cc89b102aa30ff6e402fe94 --- libc/build.rs | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'libc/build.rs') diff --git a/libc/build.rs b/libc/build.rs index 8452940..efc95b6 100644 --- a/libc/build.rs +++ b/libc/build.rs @@ -5,21 +5,27 @@ use std::str; fn main() { let rustc_minor_ver = rustc_minor_version().expect("Failed to get rustc version"); - let rustc_dep_of_std = - std::env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok(); - let align_cargo_feature = std::env::var("CARGO_FEATURE_ALIGN").is_ok(); + 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 std::env::var("CARGO_FEATURE_USE_STD").is_ok() { + if env::var("CARGO_FEATURE_USE_STD").is_ok() { println!( "cargo:warning=\"libc's use_std cargo feature is deprecated since libc 0.2.55; \ please consider using the `std` cargo feature instead\"" ); } - if std::env::var("LIBC_CI").is_ok() { - if let Some(12) = which_freebsd() { - println!("cargo:rustc-cfg=freebsd12"); - } + // 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: @@ -53,6 +59,11 @@ fn main() { if rustc_minor_ver >= 33 || rustc_dep_of_std { println!("cargo:rustc-cfg=libc_packedN"); } + + // #[thread_local] is currently unstable + if rustc_dep_of_std { + println!("cargo:rustc-cfg=libc_thread_local"); + } } fn rustc_minor_version() -> Option { @@ -96,6 +107,7 @@ fn which_freebsd() -> Option { match &stdout { s if s.starts_with("11") => Some(11), s if s.starts_with("12") => Some(12), + s if s.starts_with("13") => Some(13), _ => None, } } -- cgit v1.2.1