diff options
author | Daniel Mueller <deso@posteo.net> | 2019-05-24 18:07:22 -0700 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2019-05-24 18:07:22 -0700 |
commit | 82cf43dd887801b8b22b8aae8c02854d921915d5 (patch) | |
tree | b1bf3710bd07fe83e396a5db8563f3e6c5e85689 /libc/build.rs | |
parent | 06722702ea35434189d7de2b13a00209b2ebbd6d (diff) | |
download | nitrocli-82cf43dd887801b8b22b8aae8c02854d921915d5.tar.gz nitrocli-82cf43dd887801b8b22b8aae8c02854d921915d5.tar.bz2 |
Update libc crate to 0.2.55
This change updates the libc crate to version 0.2.55.
Import subrepo libc/:libc at caf17a0641d29dc624621177f5756804dd180c13
Diffstat (limited to 'libc/build.rs')
-rw-r--r-- | libc/build.rs | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/libc/build.rs b/libc/build.rs index 1852ed2..9b13376 100644 --- a/libc/build.rs +++ b/libc/build.rs @@ -3,12 +3,42 @@ use std::process::Command; use std::str; fn main() { - /* - * If `core::ffi::c_void` exists, libc can just re-export it. Otherwise, it - * must define an incompatible type to retain backwards-compatibility. - */ - if rustc_minor_version().expect("Failed to get rustc version") >= 30 { - println!("cargo:rustc-cfg=core_cvoid"); + 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(); + + // Rust >= 1.15 supports private module use: + if rustc_minor_ver >= 15 || rustc_dep_of_std { + println!("cargo:rustc-cfg=libc_priv_mod_use"); + } + + // Rust >= 1.19 supports unions: + if rustc_minor_ver >= 19 || rustc_dep_of_std { + println!("cargo:rustc-cfg=libc_union"); + } + + // Rust >= 1.24 supports const mem::size_of: + if rustc_minor_ver >= 24 || rustc_dep_of_std { + println!("cargo:rustc-cfg=libc_const_size_of"); + } + + // Rust >= 1.25 supports repr(align): + if rustc_minor_ver >= 25 || rustc_dep_of_std || align_cargo_feature { + println!("cargo:rustc-cfg=libc_align"); + } + + // Rust >= 1.30 supports `core::ffi::c_void`, so libc can just re-export it. + // Otherwise, it defines an incompatible type to retaining + // backwards-compatibility. + if rustc_minor_ver >= 30 || rustc_dep_of_std { + println!("cargo:rustc-cfg=libc_core_cvoid"); + } + + // Rust >= 1.33 supports repr(packed(N)) + if rustc_minor_ver >= 33 || rustc_dep_of_std { + println!("cargo:rustc-cfg=libc_packedN"); } } |