adding openssl plugin for some target (testing with darwin for now)

master
Niko PLP 1 year ago
parent cbd19b2b1e
commit f2e471a23f
  1. 4
      librocksdb-sys/Cargo.toml
  2. 31
      librocksdb-sys/build.rs
  3. 1
      librocksdb-sys/rocksdb_lib_sources.txt
  4. 2
      librocksdb-sys/src/lib.rs

@ -32,6 +32,10 @@ zstd-sys = { version = "2.0", features = ["zdict_builder"], optional = true }
libz-sys = { version = "1.1", default-features = false, optional = true }
bzip2-sys = { version = "0.1", default-features = false, optional = true }
[target."cfg(not(any(target_os = \"linux\")))".dependencies.openssl]
version = "0.10"
features = ["vendored"]
[dev-dependencies]
const-cstr = "0.3"
uuid = { version = "1.0", features = ["v4"] }

@ -53,7 +53,6 @@ fn build_rocksdb() {
config.include("rocksdb/include/");
config.include("rocksdb/");
config.include("rocksdb/third-party/gtest-1.8.1/fused-src/");
config.include("rocksdb/plugin/ippcp/library/include");
if cfg!(feature = "snappy") {
config.define("SNAPPY", Some("1"));
@ -142,7 +141,8 @@ fn build_rocksdb() {
// most processors made since roughly 2013.
// if this becomes a problem for some app installers with older hardware, a special install
// file should be generated with a lib compiled without this flag
config.flag("-march=haswell");
// config.flag("-march=haswell");
// the flag has been moved to the darwin. openbsd, freebsd and linux cases below
}
if target.contains("apple-ios") {
@ -155,6 +155,7 @@ fn build_rocksdb() {
config.define("ROCKSDB_LIB_IO_POSIX", None);
env::set_var("IPHONEOS_DEPLOYMENT_TARGET", "12.0");
} else if target.contains("darwin") {
config.flag("-march=haswell");
config.define("OS_MACOSX", None);
config.define("ROCKSDB_PLATFORM_POSIX", None);
config.define("ROCKSDB_LIB_IO_POSIX", None);
@ -165,14 +166,28 @@ fn build_rocksdb() {
config.define("HAVE_UINT128_EXTENSION", None);
config.flag_if_supported("-faligned-new");
config.define("AVE_ALIGNED_NEW", None);
// on macos we use the IPPCP plugin of rocksdb for the crypto (the lib is precompiled)
// config.include("rocksdb/plugin/ippcp/library/include");
// lib_sources.push("plugin/ippcp/ippcp_provider.cc");
// let dir = env::var("CARGO_MANIFEST_DIR").unwrap();
// println!(
// "cargo:rustc-link-search=native={}",
// Path::new(&dir)
// .join("rocksdb/plugin/ippcp/library/macos/lib")
// .display()
// );
// println!("cargo:rustc-link-lib=static=ippcp");
config.include("rocksdb/plugin/openssl/include");
lib_sources.push("plugin/openssl/openssl_provider.cc");
let dir = env::var("CARGO_MANIFEST_DIR").unwrap();
println!(
"cargo:rustc-link-search=native={}",
"cargo:rustc-link-search=dependency={}",
Path::new(&dir)
.join("rocksdb/plugin/ippcp/library/macos/lib")
//.join("rocksdb/plugin/ippcp/library/macos/lib")
.display()
);
println!("cargo:rustc-link-lib=static=ippcp");
println!("cargo:rustc-link-lib=static=crypto");
} else if target.contains("android") {
config.define("OS_ANDROID", None);
config.define("ROCKSDB_PLATFORM_POSIX", None);
@ -180,6 +195,7 @@ fn build_rocksdb() {
config.define("_REENTRANT", None);
config.flag("-fno-builtin-memcmp");
} else if target.contains("linux") {
config.flag("-march=haswell");
config.define("OS_LINUX", None);
config.define("ROCKSDB_PLATFORM_POSIX", None);
config.define("ROCKSDB_LIB_IO_POSIX", None);
@ -196,6 +212,9 @@ fn build_rocksdb() {
println!("cargo:rustc-link-arg=-ldl");
config.flag("-fno-builtin-memcmp");
// on linux we use the IPPCP plugin of rocksdb for the crypto (the lib is precompiled)
config.include("rocksdb/plugin/ippcp/library/include");
lib_sources.push("plugin/ippcp/ippcp_provider.cc");
let dir = env::var("CARGO_MANIFEST_DIR").unwrap();
println!(
"cargo:rustc-link-search=native={}",
@ -205,6 +224,7 @@ fn build_rocksdb() {
);
println!("cargo:rustc-link-lib=static=ippcp");
} else if target.contains("freebsd") {
config.flag("-march=haswell");
config.define("OS_FREEBSD", None);
config.define("ROCKSDB_PLATFORM_POSIX", None);
config.define("ROCKSDB_LIB_IO_POSIX", None);
@ -212,6 +232,7 @@ fn build_rocksdb() {
config.flag("-fno-builtin-memcmp");
config.define("_REENTRANT", None);
} else if target.contains("openbsd") {
config.flag("-march=haswell");
config.define("OS_OPENBSD", None);
config.define("ROCKSDB_PLATFORM_POSIX", None);
config.define("ROCKSDB_LIB_IO_POSIX", None);

@ -311,4 +311,3 @@ utilities/ttl/db_ttl_impl.cc
utilities/wal_filter.cc
utilities/write_batch_with_index/write_batch_with_index.cc
utilities/write_batch_with_index/write_batch_with_index_internal.cc
plugin/ippcp/ippcp_provider.cc

@ -24,6 +24,8 @@ extern crate bzip2_sys;
extern crate libz_sys;
#[cfg(feature = "lz4")]
extern crate lz4_sys;
#[cfg(not(any(target_os = "linux")))] //, target_os = "macos"
extern crate openssl;
#[cfg(feature = "zstd")]
extern crate zstd_sys;

Loading…
Cancel
Save