Skip to content

Commit 3bd503c

Browse files
muralisoundararajanMurali
and
Murali
authored
Add ability to pass vendored feature to openssl in libduckdb-sys (#321)
* Keep other feature configuration from openssl * Fix clippy warnings * Add ability to pass vendored feature to openssl in libduckdb-sys --------- Co-authored-by: Murali <[email protected]>
1 parent f5da417 commit 3bd503c

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

crates/duckdb/Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ bundled = ["libduckdb-sys/bundled"]
2323
httpfs = ["libduckdb-sys/httpfs", "bundled"]
2424
json = ["libduckdb-sys/json", "bundled"]
2525
parquet = ["libduckdb-sys/parquet", "bundled"]
26+
openssl_vendored = ["libduckdb-sys/openssl_vendored", "bundled"]
27+
unstable_boringssl = ["libduckdb-sys/unstable_boringssl", "bundled"]
28+
openssl_bindgen = ["libduckdb-sys/openssl_bindgen", "bundled"]
2629
vtab = []
2730
vtab-loadable = ["vtab", "duckdb-loadable-macros"]
2831
vtab-excel = ["vtab", "calamine"]

crates/libduckdb-sys/Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,17 @@ json = ["bundled"]
2525
parquet = ["bundled"]
2626
extensions-full = ["httpfs", "json", "parquet"]
2727

28+
openssl_vendored = ["bundled", "openssl-src"]
29+
openssl_bindgen = ["bundled", "bindgen", "pkg-config", "vcpkg"]
30+
unstable_boringssl = ["bundled"]
31+
2832
[dependencies]
2933

3034
[build-dependencies]
3135
autocfg = { workspace = true }
3236
bindgen = { workspace = true, features = ["runtime"], optional = true }
3337
flate2 = { workspace = true }
38+
openssl-src = { version = "300.3.0", optional = true, features = ["legacy"] }
3439
pkg-config = { workspace = true, optional = true }
3540
cc = { workspace = true, features = ["parallel"], optional = true }
3641
vcpkg = { workspace = true, optional = true }

crates/libduckdb-sys/openssl/find_normal.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ openssl-sys = {}
141141
openssl-sys crate build failed: no supported version of OpenSSL found.
142142
143143
Ways to fix it:
144-
- Use the `vendored` feature of openssl-sys crate to build OpenSSL from source.
144+
- Use the `openssl_vendored` feature of libduckdb-sys crate to build OpenSSL from source.
145145
- Use Homebrew to install the `openssl` package.
146146
147147
",

crates/libduckdb-sys/openssl/find_vendored.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
use openssl_src;
21
use std::path::PathBuf;
32

43
pub fn get_openssl(_target: &str) -> (Vec<PathBuf>, PathBuf) {
54
let artifacts = openssl_src::Build::new().build();
6-
println!("cargo:vendored=1");
5+
println!("cargo:openssl_vendored=1");
76
println!("cargo:root={}", artifacts.lib_dir().parent().unwrap().display());
87

98
(

crates/libduckdb-sys/openssl/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extern crate autocfg;
2222
#[cfg(feature = "openssl_bindgen")]
2323
extern crate bindgen;
2424
extern crate cc;
25-
#[cfg(feature = "vendored")]
25+
#[cfg(feature = "openssl_vendored")]
2626
extern crate openssl_src;
2727
extern crate pkg_config;
2828
#[cfg(target_env = "msvc")]
@@ -37,7 +37,7 @@ use std::{
3737
mod cfgs;
3838

3939
mod find_normal;
40-
#[cfg(feature = "vendored")]
40+
#[cfg(feature = "openssl_vendored")]
4141
mod find_vendored;
4242
#[cfg(feature = "openssl_bindgen")]
4343
mod run_bindgen;
@@ -69,7 +69,7 @@ fn env(name: &str) -> Option<OsString> {
6969
}
7070

7171
fn find_openssl(target: &str) -> Result<(Vec<PathBuf>, PathBuf), ()> {
72-
#[cfg(feature = "vendored")]
72+
#[cfg(feature = "openssl_vendored")]
7373
{
7474
// vendor if the feature is present, unless
7575
// OPENSSL_NO_VENDOR exists and isn't `0`
@@ -183,7 +183,7 @@ fn postprocess(include_dirs: &[PathBuf]) -> Version {
183183
}
184184
}
185185
#[cfg(feature = "openssl_bindgen")]
186-
run_bindgen::run(&include_dirs);
186+
run_bindgen::run(include_dirs);
187187

188188
version
189189
}

0 commit comments

Comments
 (0)