Skip to content

Commit

Permalink
bindings: ensure CFLAGS includes come after libcrypto includes (#4338)
Browse files Browse the repository at this point in the history
* bindings: ensure CFLAGS includes come after libcrypto includes

* Prepend cflags
  • Loading branch information
WesleyRosenblum authored Dec 21, 2023
1 parent 6c71deb commit 3478c90
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion bindings/rust/s2n-tls-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,18 @@ fn build_vendored() {
fn builder(libcrypto: &Libcrypto) -> cc::Build {
let mut build = cc::Build::new();

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));
} else {
build.include(&libcrypto.include);
};

build
.include(&libcrypto.include)
.include("lib")
.include("lib/api")
.flag("-std=c11")
Expand Down

0 comments on commit 3478c90

Please sign in to comment.