Reapply "Don't link binaries on docs.rs" (#94)
This reverts commit d574ccc370.
This commit is contained in:
parent
21652b6344
commit
373bbbea5b
|
|
@ -36,6 +36,7 @@ pub(crate) struct Env {
|
|||
pub(crate) android_ndk_home: Option<PathBuf>,
|
||||
pub(crate) cmake_toolchain_file: Option<PathBuf>,
|
||||
pub(crate) cpp_runtime_lib: Option<OsString>,
|
||||
pub(crate) docs_rs: bool,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
|
|
@ -185,6 +186,7 @@ impl Env {
|
|||
android_ndk_home: target_var("ANDROID_NDK_HOME").map(Into::into),
|
||||
cmake_toolchain_file: target_var("CMAKE_TOOLCHAIN_FILE").map(Into::into),
|
||||
cpp_runtime_lib: target_var("BORING_BSSL_RUST_CPPLIB"),
|
||||
docs_rs: var("DOCS_RS").is_some(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -660,8 +660,15 @@ fn get_cpp_runtime_lib(config: &Config) -> Option<String> {
|
|||
|
||||
fn main() {
|
||||
let config = Config::from_env();
|
||||
let bssl_dir = built_boring_source_path(&config);
|
||||
let build_path = get_boringssl_platform_output_path(&config);
|
||||
if !config.env.docs_rs {
|
||||
emit_link_directives(&config);
|
||||
}
|
||||
generate_bindings(&config);
|
||||
}
|
||||
|
||||
fn emit_link_directives(config: &Config) {
|
||||
let bssl_dir = built_boring_source_path(config);
|
||||
let build_path = get_boringssl_platform_output_path(config);
|
||||
|
||||
if config.is_bazel || (config.features.is_fips_like() && config.env.path.is_some()) {
|
||||
println!(
|
||||
|
|
@ -693,10 +700,10 @@ fn main() {
|
|||
}
|
||||
|
||||
if config.features.fips_link_precompiled {
|
||||
link_in_precompiled_bcm_o(&config);
|
||||
link_in_precompiled_bcm_o(config);
|
||||
}
|
||||
|
||||
if let Some(cpp_lib) = get_cpp_runtime_lib(&config) {
|
||||
if let Some(cpp_lib) = get_cpp_runtime_lib(config) {
|
||||
println!("cargo:rustc-link-lib={cpp_lib}");
|
||||
}
|
||||
println!("cargo:rustc-link-lib=static=crypto");
|
||||
|
|
@ -706,13 +713,15 @@ fn main() {
|
|||
// Rust 1.87.0 compat - https://github.com/rust-lang/rust/pull/138233
|
||||
println!("cargo:rustc-link-lib=advapi32");
|
||||
}
|
||||
}
|
||||
|
||||
fn generate_bindings(config: &Config) {
|
||||
let include_path = config.env.include_path.clone().unwrap_or_else(|| {
|
||||
if let Some(bssl_path) = &config.env.path {
|
||||
return bssl_path.join("include");
|
||||
}
|
||||
|
||||
let src_path = get_boringssl_source_path(&config);
|
||||
let src_path = get_boringssl_source_path(config);
|
||||
let candidate = src_path.join("include");
|
||||
|
||||
if candidate.exists() {
|
||||
|
|
@ -746,7 +755,7 @@ fn main() {
|
|||
.layout_tests(supports_layout_tests)
|
||||
.prepend_enum_name(true)
|
||||
.blocklist_type("max_align_t") // Not supported by bindgen on all targets, not used by BoringSSL
|
||||
.clang_args(get_extra_clang_args_for_bindgen(&config))
|
||||
.clang_args(get_extra_clang_args_for_bindgen(config))
|
||||
.clang_arg("-I")
|
||||
.clang_arg(include_path.display().to_string());
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue