From 4f78c817aa779660095b7680b859cea0cff57058 Mon Sep 17 00:00:00 2001 From: Heraldo Lucena <23155511+HMaker@users.noreply.github.com> Date: Sat, 21 Oct 2023 00:30:34 -0300 Subject: [PATCH] fix bindgen for BoringSSL - remove the -include flag (works for bindgen 0.68+) - fix allowlist-file regex to match Windows' path backslash --- openssl-sys/Cargo.toml | 2 +- openssl-sys/build/run_bindgen.rs | 18 ++---------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/openssl-sys/Cargo.toml b/openssl-sys/Cargo.toml index 44fc45a71b..5123fc5dcb 100644 --- a/openssl-sys/Cargo.toml +++ b/openssl-sys/Cargo.toml @@ -23,7 +23,7 @@ libc = "0.2" bssl-sys = { version = "0.1.0", optional = true } [build-dependencies] -bindgen = { version = "0.64.0", optional = true, features = ["experimental"] } +bindgen = { version = "0.68.1", optional = true, features = ["experimental"] } cc = "1.0.61" openssl-src = { version = "300.1.2", optional = true, features = ["legacy"] } pkg-config = "0.3.9" diff --git a/openssl-sys/build/run_bindgen.rs b/openssl-sys/build/run_bindgen.rs index 1eeaad225d..e34ac32960 100644 --- a/openssl-sys/build/run_bindgen.rs +++ b/openssl-sys/build/run_bindgen.rs @@ -119,7 +119,7 @@ pub fn run_boringssl(include_dirs: &[PathBuf]) { .enable_function_attribute_detection() .default_macro_constant_type(MacroTypeVariation::Signed) .rustified_enum("point_conversion_form_t") - .allowlist_file(".*/openssl/[^/]+\\.h") + .allowlist_file(".*[/\\\\]openssl/[^/]+\\.h") .allowlist_recursively(false) .blocklist_function("BIO_vsnprintf") .blocklist_function("OPENSSL_vasprintf") @@ -148,13 +148,6 @@ pub fn run_boringssl(include_dirs: &[PathBuf]) { cc::Build::new() .file(out_dir.join("boring_static_wrapper.c")) .includes(include_dirs) - .flag("-include") - .flag( - &out_dir - .join("boring_static_wrapper.h") - .display() - .to_string(), - ) .compile("boring_static_wrapper"); } @@ -180,7 +173,7 @@ pub fn run_boringssl(include_dirs: &[PathBuf]) { .arg("--enable-function-attribute-detection") .arg("--default-macro-constant-type=signed") .arg("--rustified-enum=point_conversion_form_t") - .arg("--allowlist-file=.*/openssl/[^/]+\\.h") + .arg("--allowlist-file=.*[/\\\\]openssl/[^/]+\\.h") .arg("--no-recursive-allowlist") .arg("--blocklist-function=BIO_vsnprintf") .arg("--blocklist-function=OPENSSL_vasprintf") @@ -203,13 +196,6 @@ pub fn run_boringssl(include_dirs: &[PathBuf]) { cc::Build::new() .file(out_dir.join("boring_static_wrapper.c")) .includes(include_dirs) - .flag("-include") - .flag( - &out_dir - .join("boring_static_wrapper.h") - .display() - .to_string(), - ) .compile("boring_static_wrapper"); }