mirror of
https://github.com/isar/rusqlite.git
synced 2025-04-21 17:37:48 +08:00
feat: sync openssl search logic
This commit is contained in:
parent
a7d5d33548
commit
1886a0a5ef
@ -156,32 +156,34 @@ mod build_bundled {
|
|||||||
let (lib_dir, inc_dir) = match (lib_dir, inc_dir) {
|
let (lib_dir, inc_dir) = match (lib_dir, inc_dir) {
|
||||||
(Some(lib_dir), Some(inc_dir)) => {
|
(Some(lib_dir), Some(inc_dir)) => {
|
||||||
use_openssl = true;
|
use_openssl = true;
|
||||||
(lib_dir, inc_dir)
|
(vec![lib_dir], inc_dir)
|
||||||
}
|
}
|
||||||
(lib_dir, inc_dir) => match find_openssl_dir(&host, &target) {
|
(lib_dir, inc_dir) => match find_openssl_dir(&host, &target) {
|
||||||
None => {
|
None => {
|
||||||
if is_windows && !cfg!(feature = "bundled-sqlcipher-vendored-openssl") {
|
if is_windows && !cfg!(feature = "bundled-sqlcipher-vendored-openssl") {
|
||||||
panic!("Missing environment variable OPENSSL_DIR or OPENSSL_DIR is not set")
|
panic!("Missing environment variable OPENSSL_DIR or OPENSSL_DIR is not set")
|
||||||
} else {
|
} else {
|
||||||
(PathBuf::new(), PathBuf::new())
|
(vec![PathBuf::new()], PathBuf::new())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(openssl_dir) => {
|
Some(openssl_dir) => {
|
||||||
let lib_dir = lib_dir.unwrap_or_else(|| {
|
let lib_dir = lib_dir.map(|d| vec![d]).unwrap_or_else(|| {
|
||||||
|
let mut lib_dirs = vec![];
|
||||||
// OpenSSL 3.0 now puts it's libraries in lib64/ by default,
|
// OpenSSL 3.0 now puts it's libraries in lib64/ by default,
|
||||||
// check for both it and lib/.
|
// check for both it and lib/.
|
||||||
if openssl_dir.join("lib64").exists() {
|
if openssl_dir.join("lib64").exists() {
|
||||||
return openssl_dir.join("lib64");
|
lib_dirs.push(openssl_dir.join("lib64"));
|
||||||
}
|
}
|
||||||
openssl_dir.join("lib")
|
if openssl_dir.join("lib").exists() {
|
||||||
|
lib_dirs.push(openssl_dir.join("lib"));
|
||||||
|
}
|
||||||
|
lib_dirs
|
||||||
});
|
});
|
||||||
let inc_dir = inc_dir.unwrap_or_else(|| openssl_dir.join("include"));
|
let inc_dir = inc_dir.unwrap_or_else(|| openssl_dir.join("include"));
|
||||||
|
|
||||||
assert!(
|
if !lib_dir.iter().all(|p| p.exists()) {
|
||||||
Path::new(&lib_dir).exists(),
|
panic!("OpenSSL library directory does not exist: {:?}", lib_dir);
|
||||||
"OpenSSL library directory does not exist: {}",
|
}
|
||||||
lib_dir.to_string_lossy()
|
|
||||||
);
|
|
||||||
|
|
||||||
if !Path::new(&inc_dir).exists() {
|
if !Path::new(&inc_dir).exists() {
|
||||||
panic!(
|
panic!(
|
||||||
@ -204,7 +206,9 @@ mod build_bundled {
|
|||||||
cfg.include(inc_dir.to_string_lossy().as_ref());
|
cfg.include(inc_dir.to_string_lossy().as_ref());
|
||||||
let lib_name = if is_windows { "libcrypto" } else { "crypto" };
|
let lib_name = if is_windows { "libcrypto" } else { "crypto" };
|
||||||
println!("cargo:rustc-link-lib=dylib={}", lib_name);
|
println!("cargo:rustc-link-lib=dylib={}", lib_name);
|
||||||
println!("cargo:rustc-link-search={}", lib_dir.to_string_lossy());
|
for lib_dir_item in lib_dir.iter() {
|
||||||
|
println!("cargo:rustc-link-search={}", lib_dir_item.to_string_lossy());
|
||||||
|
}
|
||||||
} else if is_apple {
|
} else if is_apple {
|
||||||
cfg.flag("-DSQLCIPHER_CRYPTO_CC");
|
cfg.flag("-DSQLCIPHER_CRYPTO_CC");
|
||||||
println!("cargo:rustc-link-lib=framework=Security");
|
println!("cargo:rustc-link-lib=framework=Security");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user