diff --git a/aws-lc-fips-sys/Cargo.toml b/aws-lc-fips-sys/Cargo.toml index 8728e515a2c..95911aa41b0 100644 --- a/aws-lc-fips-sys/Cargo.toml +++ b/aws-lc-fips-sys/Cargo.toml @@ -62,10 +62,10 @@ cmake = "0.1.48" dunce = "1.0" fs_extra = "1.3" -[target.'cfg(any(all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "aarch64")))'.build-dependencies] +[target.'cfg(any(all(target_os = "linux", target_arch = "x86_64", target_env="gnu"), all(target_os = "linux", target_arch = "aarch64", target_env="gnu")))'.build-dependencies] bindgen = { version = "0.69.1", optional = true } -[target.'cfg(not(any(all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "aarch64"))))'.build-dependencies] +[target.'cfg(not(any(all(target_os = "linux", target_arch = "x86_64", target_env="gnu"), all(target_os = "linux", target_arch = "aarch64", target_env="gnu"))))'.build-dependencies] bindgen = { version = "0.69.1" } [dependencies] diff --git a/aws-lc-fips-sys/builder/main.rs b/aws-lc-fips-sys/builder/main.rs index 61de77d40b0..76d6f9f44f5 100644 --- a/aws-lc-fips-sys/builder/main.rs +++ b/aws-lc-fips-sys/builder/main.rs @@ -261,6 +261,10 @@ fn target_arch() -> String { env::var("CARGO_CFG_TARGET_ARCH").unwrap() } +fn target_env() -> String { + env::var("CARGO_CFG_TARGET_ENV").unwrap() +} + #[allow(unused)] fn target_vendor() -> String { env::var("CARGO_CFG_TARGET_VENDOR").unwrap() @@ -272,9 +276,9 @@ fn target() -> String { } macro_rules! cfg_bindgen_platform { - ($binding:ident, $os:literal, $arch:literal, $additional:expr) => { + ($binding:ident, $os:literal, $arch:literal, $env:literal, $additional:expr) => { let $binding = { - (target_os() == $os && target_arch() == $arch && $additional) + (target_os() == $os && target_arch() == $arch && target_env() == $env && $additional) .then(|| { emit_rustc_cfg(concat!($os, "_", $arch)); true @@ -297,8 +301,8 @@ fn main() { let pregenerated = !is_bindgen_required || is_internal_generate; - cfg_bindgen_platform!(linux_x86_64, "linux", "x86_64", pregenerated); - cfg_bindgen_platform!(linux_aarch64, "linux", "aarch64", pregenerated); + cfg_bindgen_platform!(linux_x86_64, "linux", "x86_64", "gnu", pregenerated); + cfg_bindgen_platform!(linux_aarch64, "linux", "aarch64", "gnu", pregenerated); if !(linux_x86_64 || linux_aarch64) { emit_rustc_cfg("use_bindgen_generated"); diff --git a/aws-lc-sys/Cargo.toml b/aws-lc-sys/Cargo.toml index 7b9523ac316..166e6b42770 100644 --- a/aws-lc-sys/Cargo.toml +++ b/aws-lc-sys/Cargo.toml @@ -54,10 +54,10 @@ cmake = "0.1.48" dunce = "1.0" fs_extra = "1.3" -[target.'cfg(any(all(target_os = "macos", target_arch = "x86_64"), all(target_os = "linux", target_arch = "x86"), all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "aarch64")))'.build-dependencies] +[target.'cfg(any(all(target_os = "macos", target_arch = "x86_64"), all(target_os = "linux", target_arch = "x86", target_env="gnu"), all(target_os = "linux", target_arch = "x86_64", target_env="gnu"), all(target_os = "linux", target_arch = "aarch64", target_env="gnu")))'.build-dependencies] bindgen = { version = "0.69.1", optional = true } -[target.'cfg(not(any(all(target_os = "macos", target_arch = "x86_64"), all(target_os = "linux", target_arch = "x86"), all(target_os = "linux", target_arch = "x86_64"), all(target_os = "linux", target_arch = "aarch64"))))'.build-dependencies] +[target.'cfg(not(any(all(target_os = "macos", target_arch = "x86_64"), all(target_os = "linux", target_arch = "x86", target_env="gnu"), all(target_os = "linux", target_arch = "x86_64", target_env="gnu"), all(target_os = "linux", target_arch = "aarch64", target_env="gnu"))))'.build-dependencies] bindgen = { version = "0.68.1" } diff --git a/aws-lc-sys/builder/main.rs b/aws-lc-sys/builder/main.rs index ddb0e5b1709..2b70e9e438e 100644 --- a/aws-lc-sys/builder/main.rs +++ b/aws-lc-sys/builder/main.rs @@ -264,6 +264,10 @@ fn target_arch() -> String { env::var("CARGO_CFG_TARGET_ARCH").unwrap() } +fn target_env() -> String { + env::var("CARGO_CFG_TARGET_ENV").unwrap() +} + fn target_vendor() -> String { env::var("CARGO_CFG_TARGET_VENDOR").unwrap() } @@ -273,9 +277,9 @@ fn target() -> String { } macro_rules! cfg_bindgen_platform { - ($binding:ident, $os:literal, $arch:literal, $additional:expr) => { + ($binding:ident, $os:literal, $arch:literal, $env:literal, $additional:expr) => { let $binding = { - (target_os() == $os && target_arch() == $arch && $additional) + (target_os() == $os && target_arch() == $arch && target_env() == $env && $additional) .then(|| { emit_rustc_cfg(concat!($os, "_", $arch)); true @@ -297,10 +301,10 @@ fn main() { let pregenerated = !is_bindgen_required || is_internal_generate; - cfg_bindgen_platform!(linux_x86, "linux", "x86", pregenerated); - cfg_bindgen_platform!(linux_x86_64, "linux", "x86_64", pregenerated); - cfg_bindgen_platform!(linux_aarch64, "linux", "aarch64", pregenerated); - cfg_bindgen_platform!(macos_x86_64, "macos", "x86_64", pregenerated); + cfg_bindgen_platform!(linux_x86, "linux", "x86", "gnu", pregenerated); + cfg_bindgen_platform!(linux_x86_64, "linux", "x86_64", "gnu", pregenerated); + cfg_bindgen_platform!(linux_aarch64, "linux", "aarch64", "gnu", pregenerated); + cfg_bindgen_platform!(macos_x86_64, "macos", "x86_64", "", pregenerated); if !(linux_x86 || linux_x86_64 || linux_aarch64 || macos_x86_64) { emit_rustc_cfg("use_bindgen_generated");