|
|
@ -115,32 +115,36 @@ fn build_rocksdb() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if target.contains("darwin") { |
|
|
|
if target.contains("darwin") { |
|
|
|
config.define("OS_MACOSX", Some("1")); |
|
|
|
config.define("OS_MACOSX", None); |
|
|
|
config.define("ROCKSDB_PLATFORM_POSIX", Some("1")); |
|
|
|
config.define("ROCKSDB_PLATFORM_POSIX", None); |
|
|
|
config.define("ROCKSDB_LIB_IO_POSIX", Some("1")); |
|
|
|
config.define("ROCKSDB_LIB_IO_POSIX", None); |
|
|
|
} else if target.contains("android") { |
|
|
|
} else if target.contains("android") { |
|
|
|
config.define("OS_ANDROID", Some("1")); |
|
|
|
config.define("OS_ANDROID", None); |
|
|
|
config.define("ROCKSDB_PLATFORM_POSIX", Some("1")); |
|
|
|
config.define("ROCKSDB_PLATFORM_POSIX", None); |
|
|
|
config.define("ROCKSDB_LIB_IO_POSIX", Some("1")); |
|
|
|
config.define("ROCKSDB_LIB_IO_POSIX", None); |
|
|
|
} else if target.contains("linux") { |
|
|
|
} else if target.contains("linux") { |
|
|
|
config.define("OS_LINUX", Some("1")); |
|
|
|
config.define("OS_LINUX", None); |
|
|
|
config.define("ROCKSDB_PLATFORM_POSIX", Some("1")); |
|
|
|
config.define("ROCKSDB_PLATFORM_POSIX", None); |
|
|
|
config.define("ROCKSDB_LIB_IO_POSIX", Some("1")); |
|
|
|
config.define("ROCKSDB_LIB_IO_POSIX", None); |
|
|
|
} else if target.contains("freebsd") { |
|
|
|
} else if target.contains("freebsd") { |
|
|
|
config.define("OS_FREEBSD", Some("1")); |
|
|
|
config.define("OS_FREEBSD", None); |
|
|
|
config.define("ROCKSDB_PLATFORM_POSIX", Some("1")); |
|
|
|
config.define("ROCKSDB_PLATFORM_POSIX", None); |
|
|
|
config.define("ROCKSDB_LIB_IO_POSIX", Some("1")); |
|
|
|
config.define("ROCKSDB_LIB_IO_POSIX", None); |
|
|
|
} else if target.contains("windows") { |
|
|
|
} else if target.contains("windows") { |
|
|
|
link("rpcrt4", false); |
|
|
|
link("rpcrt4", false); |
|
|
|
link("shlwapi", false); |
|
|
|
link("shlwapi", false); |
|
|
|
config.define("OS_WIN", Some("1")); |
|
|
|
config.define("DWIN32", None); |
|
|
|
config.define("ROCKSDB_WINDOWS_UTF8_FILENAMES", Some("1")); |
|
|
|
config.define("OS_WIN", None); |
|
|
|
|
|
|
|
config.define("_MBCS", None); |
|
|
|
|
|
|
|
config.define("WIN64", None); |
|
|
|
|
|
|
|
config.define("NOMINMAX", None); |
|
|
|
|
|
|
|
|
|
|
|
if &target == "x86_64-pc-windows-gnu" { |
|
|
|
if &target == "x86_64-pc-windows-gnu" { |
|
|
|
// Tell MinGW to create localtime_r wrapper of localtime_s function.
|
|
|
|
// Tell MinGW to create localtime_r wrapper of localtime_s function.
|
|
|
|
config.define("_POSIX_C_SOURCE", None); |
|
|
|
config.define("_POSIX_C_SOURCE", Some("1")); |
|
|
|
// Tell MinGW to use at least Windows Vista headers instead of the ones of Windows XP.
|
|
|
|
// Tell MinGW to use at least Windows Vista headers instead of the ones of Windows XP.
|
|
|
|
// (This is minimum supported version of rocksdb)
|
|
|
|
// (This is minimum supported version of rocksdb)
|
|
|
|
config.define("_WIN32_WINNT", Some("0x0600")); |
|
|
|
config.define("_WIN32_WINNT", Some("_WIN32_WINNT_VISTA")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Remove POSIX-specific sources
|
|
|
|
// Remove POSIX-specific sources
|
|
|
@ -306,6 +310,12 @@ fn build_bzip2() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn try_to_find_and_link_lib(lib_name: &str) -> bool { |
|
|
|
fn try_to_find_and_link_lib(lib_name: &str) -> bool { |
|
|
|
|
|
|
|
if let Ok(v) = env::var(&format!("{}_COMPILE", lib_name)) { |
|
|
|
|
|
|
|
if v.to_lowercase() == "true" || v == "1" { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if let Ok(lib_dir) = env::var(&format!("{}_LIB_DIR", lib_name)) { |
|
|
|
if let Ok(lib_dir) = env::var(&format!("{}_LIB_DIR", lib_name)) { |
|
|
|
println!("cargo:rustc-link-search=native={}", lib_dir); |
|
|
|
println!("cargo:rustc-link-search=native={}", lib_dir); |
|
|
|
let mode = match env::var_os(&format!("{}_STATIC", lib_name)) { |
|
|
|
let mode = match env::var_os(&format!("{}_STATIC", lib_name)) { |
|
|
|