Skip to content

Commit

Permalink
Fix building with non bazel commits of boringssl
Browse files Browse the repository at this point in the history
We need to add `/build/crypto` and `/build/ssl` to the library search
path to handle the case where we pass `BORING_BSSL_SOURCE_PATH` when
building without enabling any fips features. Otherwise, non bazel
commits will not work because `/build/` itself will not contain any
crypto libraries to link with
  • Loading branch information
rushilmehra committed Jan 25, 2024
1 parent 3cf8bc4 commit 01b14dc
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions boring-sys/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,16 @@ fn built_boring_source_path(config: &Config) -> &PathBuf {
"cargo:warning=skipping git patches application, provided\
native BoringSSL is expected to have the patches included"
);
} else if config.env.source_path.is_some()
&& (config.features.rpk
|| config.features.pq_experimental
|| config.features.underscore_wildcards)
{
panic!(
"BORING_BSSL_ASSUME_PATCHED must be set when setting
BORING_BSSL_SOURCE_PATH and using any of the following
features: rpk, pq-experimental, underscore-wildcards"
);
} else {
ensure_patches_applied(config).unwrap();
}
Expand Down Expand Up @@ -620,17 +630,18 @@ fn main() {
let bssl_dir = built_boring_source_path(&config);
let build_path = get_boringssl_platform_output_path(&config);

println!(
"cargo:rustc-link-search=native={}/build/crypto/{}",
bssl_dir.display(),
build_path
);
println!(
"cargo:rustc-link-search=native={}/build/ssl/{}",
bssl_dir.display(),
build_path
);

if config.features.fips || config.features.fips_link_precompiled {
println!(
"cargo:rustc-link-search=native={}/build/crypto/{}",
bssl_dir.display(),
build_path
);
println!(
"cargo:rustc-link-search=native={}/build/ssl/{}",
bssl_dir.display(),
build_path
);
println!(
"cargo:rustc-link-search=native={}/lib/{}",
bssl_dir.display(),
Expand Down

0 comments on commit 01b14dc

Please sign in to comment.