summaryrefslogtreecommitdiff
path: root/libc/build.rs
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-06-01 11:46:58 -0700
committerDaniel Mueller <deso@posteo.net>2019-06-01 11:46:58 -0700
commit61f2baa0af6b2a54e0c109e5f73c8ff25f9f2ca6 (patch)
tree7526c0aca9a6ec34826a55cad24dd4a3457364f0 /libc/build.rs
parent7c880699bb9a49037c09b1be990e677a1857af7a (diff)
downloadnitrocli-61f2baa0af6b2a54e0c109e5f73c8ff25f9f2ca6.tar.gz
nitrocli-61f2baa0af6b2a54e0c109e5f73c8ff25f9f2ca6.tar.bz2
Update libc crate to 0.2.57
This change updates the libc crate to version 0.2.57. Import subrepo libc/:libc at cdc48ea36d8d2890dba38e8f779001e6855339a2
Diffstat (limited to 'libc/build.rs')
-rw-r--r--libc/build.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/libc/build.rs b/libc/build.rs
index 9b13376..8452940 100644
--- a/libc/build.rs
+++ b/libc/build.rs
@@ -9,6 +9,19 @@ fn main() {
std::env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
let align_cargo_feature = std::env::var("CARGO_FEATURE_ALIGN").is_ok();
+ if std::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");
+ }
+ }
+
// Rust >= 1.15 supports private module use:
if rustc_minor_ver >= 15 || rustc_dep_of_std {
println!("cargo:rustc-cfg=libc_priv_mod_use");
@@ -63,3 +76,26 @@ fn rustc_minor_version() -> Option<u32> {
otry!(pieces.next()).parse().ok()
}
+
+fn which_freebsd() -> Option<i32> {
+ let output = std::process::Command::new("freebsd-version").output().ok();
+ if output.is_none() {
+ return None;
+ }
+ let output = output.unwrap();
+ if !output.status.success() {
+ return None;
+ }
+
+ let stdout = String::from_utf8(output.stdout).ok();
+ if stdout.is_none() {
+ return None;
+ }
+ let stdout = stdout.unwrap();
+
+ match &stdout {
+ s if s.starts_with("11") => Some(11),
+ s if s.starts_with("12") => Some(12),
+ _ => None,
+ }
+}