Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to pass vendored feature to openssl in libduckdb-sys #321

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/duckdb/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
5 changes: 5 additions & 0 deletions crates/libduckdb-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion crates/libduckdb-sys/openssl/find_normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

",
Expand Down
3 changes: 1 addition & 2 deletions crates/libduckdb-sys/openssl/find_vendored.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use openssl_src;
use std::path::PathBuf;

pub fn get_openssl(_target: &str) -> (Vec<PathBuf>, 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());

(
Expand Down
8 changes: 4 additions & 4 deletions crates/libduckdb-sys/openssl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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;
Expand Down Expand Up @@ -69,7 +69,7 @@ fn env(name: &str) -> Option<OsString> {
}

fn find_openssl(target: &str) -> Result<(Vec<PathBuf>, PathBuf), ()> {
#[cfg(feature = "vendored")]
#[cfg(feature = "openssl_vendored")]
{
// vendor if the feature is present, unless
// OPENSSL_NO_VENDOR exists and isn't `0`
Expand Down Expand Up @@ -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
}
Expand Down
Loading