Skip to content

Commit

Permalink
Adds BORING_BSSL_CPLUS_INCLUDE_PATH env variable handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Isaiah Becker-Mayer committed Jan 24, 2024
1 parent 69d4083 commit 6fb6a1e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions boring-sys/build/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub(crate) struct Features {
pub(crate) struct Env {
pub(crate) path: Option<PathBuf>,
pub(crate) include_path: Option<PathBuf>,
pub(crate) cplus_include_path: Option<PathBuf>,
pub(crate) source_path: Option<PathBuf>,
pub(crate) precompiled_bcm_o: Option<PathBuf>,
pub(crate) assume_patched: bool,
Expand Down Expand Up @@ -146,6 +147,7 @@ impl Env {
Self {
path: boringssl_var("BORING_BSSL_PATH").map(PathBuf::from),
include_path: boringssl_var("BORING_BSSL_INCLUDE_PATH").map(PathBuf::from),
cplus_include_path: boringssl_var("BORING_BSSL_CPLUS_INCLUDE_PATH").map(PathBuf::from),
source_path: boringssl_var("BORING_BSSL_SOURCE_PATH").map(PathBuf::from),
precompiled_bcm_o: boringssl_var("BORING_BSSL_PRECOMPILED_BCM_O").map(PathBuf::from),
assume_patched: boringssl_var("BORING_BSSL_ASSUME_PATCHED")
Expand Down
15 changes: 15 additions & 0 deletions boring-sys/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,8 +619,23 @@ fn link_in_precompiled_bcm_o(config: &Config) {
.unwrap();
}

// Note: this is the entrypoint into the boring-sys build process.
fn main() {
let config = Config::from_env();

if let Some(ref cplus_include_path) = config.env.cplus_include_path {
println!(
"Setting CPLUS_INCLUDE_PATH to {}",
cplus_include_path.display()
);
// Inject CPLUS_INCLUDE_PATH into the environment for the build.
// This must be done before we build the boring source path so that it can
// be used during that build process.
std::env::set_var("CPLUS_INCLUDE_PATH", cplus_include_path);
} else {
println!("Didn't set CPLUS_INCLUDE_PATH");
}

let bssl_dir = built_boring_source_path(&config);
let build_path = get_boringssl_platform_output_path(&config);

Expand Down

0 comments on commit 6fb6a1e

Please sign in to comment.