From 640353177bbbc1a3550055bcd3f52dae2267819d Mon Sep 17 00:00:00 2001 From: Lindsay Stewart Date: Tue, 26 Mar 2024 00:08:10 -0700 Subject: [PATCH] bindings: ensure CFLAGS includes come after build script includes --- bindings/rust/s2n-tls-sys/build.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bindings/rust/s2n-tls-sys/build.rs b/bindings/rust/s2n-tls-sys/build.rs index 34889e6abed..68ba6f182a2 100644 --- a/bindings/rust/s2n-tls-sys/build.rs +++ b/bindings/rust/s2n-tls-sys/build.rs @@ -154,20 +154,19 @@ fn build_vendored() { fn builder(libcrypto: &Libcrypto) -> cc::Build { let mut build = cc::Build::new(); + let includes = [&libcrypto.include, "lib", "lib/api"]; if let Ok(cflags) = std::env::var("CFLAGS") { // cc will read the CFLAGS env variable and prepend the compiler // command with all flags and includes from it, which may conflict // with the libcrypto includes we specify. To ensure the libcrypto // includes show up first in the compiler command, we prepend our // includes to CFLAGS. - std::env::set_var("CFLAGS", format!("-I {} {}", libcrypto.include, cflags)); + std::env::set_var("CFLAGS", format!("-I {} {}", includes.join(" -I "), cflags)); } else { - build.include(&libcrypto.include); + build.includes(includes); }; build - .include("lib") - .include("lib/api") .flag("-std=c11") .flag("-fgnu89-inline") // make sure the stack is non-executable