From 9b723016e12fd6aa17537a7e08cf75f4126765be Mon Sep 17 00:00:00 2001 From: Murali Date: Mon, 3 Jun 2024 21:33:12 +0200 Subject: [PATCH 1/3] Keep other feature configuration from openssl --- crates/libduckdb-sys/openssl/find_normal.rs | 2 +- crates/libduckdb-sys/openssl/find_vendored.rs | 2 +- crates/libduckdb-sys/openssl/mod.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/libduckdb-sys/openssl/find_normal.rs b/crates/libduckdb-sys/openssl/find_normal.rs index 4655a8af..591857dd 100644 --- a/crates/libduckdb-sys/openssl/find_normal.rs +++ b/crates/libduckdb-sys/openssl/find_normal.rs @@ -141,7 +141,7 @@ openssl-sys = {} openssl-sys crate build failed: no supported version of OpenSSL found. Ways to fix it: -- Use the `vendored` feature of openssl-sys crate to build OpenSSL from source. +- Use the `openssl_vendored` feature of libduckdb-sys crate to build OpenSSL from source. - Use Homebrew to install the `openssl` package. ", diff --git a/crates/libduckdb-sys/openssl/find_vendored.rs b/crates/libduckdb-sys/openssl/find_vendored.rs index 2ab44cfa..63fb6abf 100644 --- a/crates/libduckdb-sys/openssl/find_vendored.rs +++ b/crates/libduckdb-sys/openssl/find_vendored.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; pub fn get_openssl(_target: &str) -> (Vec, PathBuf) { let artifacts = openssl_src::Build::new().build(); - println!("cargo:vendored=1"); + println!("cargo:openssl_vendored=1"); println!("cargo:root={}", artifacts.lib_dir().parent().unwrap().display()); ( diff --git a/crates/libduckdb-sys/openssl/mod.rs b/crates/libduckdb-sys/openssl/mod.rs index a7bf791c..21b12045 100644 --- a/crates/libduckdb-sys/openssl/mod.rs +++ b/crates/libduckdb-sys/openssl/mod.rs @@ -22,7 +22,7 @@ extern crate autocfg; #[cfg(feature = "openssl_bindgen")] extern crate bindgen; extern crate cc; -#[cfg(feature = "vendored")] +#[cfg(feature = "openssl_vendored")] extern crate openssl_src; extern crate pkg_config; #[cfg(target_env = "msvc")] @@ -37,7 +37,7 @@ use std::{ mod cfgs; mod find_normal; -#[cfg(feature = "vendored")] +#[cfg(feature = "openssl_vendored")] mod find_vendored; #[cfg(feature = "openssl_bindgen")] mod run_bindgen; @@ -69,7 +69,7 @@ fn env(name: &str) -> Option { } fn find_openssl(target: &str) -> Result<(Vec, PathBuf), ()> { - #[cfg(feature = "vendored")] + #[cfg(feature = "openssl_vendored")] { // vendor if the feature is present, unless // OPENSSL_NO_VENDOR exists and isn't `0` From 19eaddcaac50d63109b83f2855aaa31fc38fab16 Mon Sep 17 00:00:00 2001 From: Murali Date: Tue, 4 Jun 2024 07:10:04 +0200 Subject: [PATCH 2/3] Fix clippy warnings --- crates/libduckdb-sys/openssl/find_vendored.rs | 1 - crates/libduckdb-sys/openssl/mod.rs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/libduckdb-sys/openssl/find_vendored.rs b/crates/libduckdb-sys/openssl/find_vendored.rs index 63fb6abf..82348b6e 100644 --- a/crates/libduckdb-sys/openssl/find_vendored.rs +++ b/crates/libduckdb-sys/openssl/find_vendored.rs @@ -1,4 +1,3 @@ -use openssl_src; use std::path::PathBuf; pub fn get_openssl(_target: &str) -> (Vec, PathBuf) { diff --git a/crates/libduckdb-sys/openssl/mod.rs b/crates/libduckdb-sys/openssl/mod.rs index 21b12045..4877258a 100644 --- a/crates/libduckdb-sys/openssl/mod.rs +++ b/crates/libduckdb-sys/openssl/mod.rs @@ -183,7 +183,7 @@ fn postprocess(include_dirs: &[PathBuf]) -> Version { } } #[cfg(feature = "openssl_bindgen")] - run_bindgen::run(&include_dirs); + run_bindgen::run(include_dirs); version } From 28afabbd498b575f776840ecdf5b8ffbd8b9c42a Mon Sep 17 00:00:00 2001 From: Murali Date: Tue, 4 Jun 2024 19:57:05 +0200 Subject: [PATCH 3/3] Add ability to pass vendored feature to openssl in libduckdb-sys --- crates/duckdb/Cargo.toml | 3 +++ crates/libduckdb-sys/Cargo.toml | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/crates/duckdb/Cargo.toml b/crates/duckdb/Cargo.toml index 5e45b701..6a26438c 100644 --- a/crates/duckdb/Cargo.toml +++ b/crates/duckdb/Cargo.toml @@ -23,6 +23,9 @@ bundled = ["libduckdb-sys/bundled"] httpfs = ["libduckdb-sys/httpfs", "bundled"] json = ["libduckdb-sys/json", "bundled"] parquet = ["libduckdb-sys/parquet", "bundled"] +openssl_vendored = ["libduckdb-sys/openssl_vendored", "bundled"] +unstable_boringssl = ["libduckdb-sys/unstable_boringssl", "bundled"] +openssl_bindgen = ["libduckdb-sys/openssl_bindgen", "bundled"] vtab = [] vtab-loadable = ["vtab", "duckdb-loadable-macros"] vtab-excel = ["vtab", "calamine"] diff --git a/crates/libduckdb-sys/Cargo.toml b/crates/libduckdb-sys/Cargo.toml index 207bdf56..ab4e89ce 100644 --- a/crates/libduckdb-sys/Cargo.toml +++ b/crates/libduckdb-sys/Cargo.toml @@ -25,12 +25,17 @@ json = ["bundled"] parquet = ["bundled"] extensions-full = ["httpfs", "json", "parquet"] +openssl_vendored = ["bundled", "openssl-src"] +openssl_bindgen = ["bundled", "bindgen", "pkg-config", "vcpkg"] +unstable_boringssl = ["bundled"] + [dependencies] [build-dependencies] autocfg = { workspace = true } bindgen = { workspace = true, features = ["runtime"], optional = true } flate2 = { workspace = true } +openssl-src = { version = "300.3.0", optional = true, features = ["legacy"] } pkg-config = { workspace = true, optional = true } cc = { workspace = true, features = ["parallel"], optional = true } vcpkg = { workspace = true, optional = true }