|
|
@ -10,14 +10,6 @@ fn main() {
|
|
|
|
.next()
|
|
|
|
.next()
|
|
|
|
.expect("Crate version is not valid");
|
|
|
|
.expect("Crate version is not valid");
|
|
|
|
|
|
|
|
|
|
|
|
pkg_config::Config::new().probe("zlib").expect("Cannot find zlib");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if pkg_config::Config::new()
|
|
|
|
|
|
|
|
.atleast_version(mongoc_version)
|
|
|
|
|
|
|
|
.statik(true)
|
|
|
|
|
|
|
|
.probe("libmongoc-static-1.0")
|
|
|
|
|
|
|
|
.is_err()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let out_dir_var = env::var("OUT_DIR").expect("No out dir");
|
|
|
|
let out_dir_var = env::var("OUT_DIR").expect("No out dir");
|
|
|
|
let out_dir = Path::new(&out_dir_var);
|
|
|
|
let out_dir = Path::new(&out_dir_var);
|
|
|
|
let driver_src_path = out_dir.join(format!("mongo-c-driver-{}", mongoc_version));
|
|
|
|
let driver_src_path = out_dir.join(format!("mongo-c-driver-{}", mongoc_version));
|
|
|
@ -55,6 +47,28 @@ fn main() {
|
|
|
|
let mut cmake = Command::new("cmake");
|
|
|
|
let mut cmake = Command::new("cmake");
|
|
|
|
cmake.current_dir(&driver_src_path);
|
|
|
|
cmake.current_dir(&driver_src_path);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let pkg = pkg_config::Config::new();
|
|
|
|
|
|
|
|
pkg.probe("zlib").expect("Cannot find zlib");
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")] pkg.probe("icu-i18n").expect("Cannot find icu");
|
|
|
|
|
|
|
|
match pkg.probe("snappy") {
|
|
|
|
|
|
|
|
Ok(_) => {
|
|
|
|
|
|
|
|
cmake.arg("-DENABLE_SNAPPY=ON");
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
Err(e) => {
|
|
|
|
|
|
|
|
println!("Snappy not found: {}", e);
|
|
|
|
|
|
|
|
cmake.arg("-DENABLE_SNAPPY=OFF");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
match pkg.probe("zstd") {
|
|
|
|
|
|
|
|
Ok(_) => {
|
|
|
|
|
|
|
|
cmake.arg("-DENABLE_ZSTD=ON");
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
Err(e) => {
|
|
|
|
|
|
|
|
println!("Zstd not found: {}", e);
|
|
|
|
|
|
|
|
cmake.arg("-DENABLE_ZSTD=OFF");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cmake.arg("-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF");
|
|
|
|
cmake.arg("-DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF");
|
|
|
|
cmake.arg("-DENABLE_SSL=OPENSSL");
|
|
|
|
cmake.arg("-DENABLE_SSL=OPENSSL");
|
|
|
|
cmake.arg("-DENABLE_SASL=OFF");
|
|
|
|
cmake.arg("-DENABLE_SASL=OFF");
|
|
|
@ -64,7 +78,6 @@ fn main() {
|
|
|
|
cmake.arg("-DENABLE_TESTS=OFF");
|
|
|
|
cmake.arg("-DENABLE_TESTS=OFF");
|
|
|
|
cmake.arg("-DENABLE_SHM_COUNTERS=OFF");
|
|
|
|
cmake.arg("-DENABLE_SHM_COUNTERS=OFF");
|
|
|
|
cmake.arg("-DWITH_PIC=ON");
|
|
|
|
cmake.arg("-DWITH_PIC=ON");
|
|
|
|
cmake.arg("-DWITH_SNAPPY=OFF");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Run in current dir
|
|
|
|
// Run in current dir
|
|
|
|
cmake.arg(".");
|
|
|
|
cmake.arg(".");
|
|
|
@ -87,6 +100,4 @@ fn main() {
|
|
|
|
println!("cargo:rustc-link-lib=static=bson-static-1.0");
|
|
|
|
println!("cargo:rustc-link-lib=static=bson-static-1.0");
|
|
|
|
println!("cargo:rustc-link-lib=static=mongoc-static-1.0");
|
|
|
|
println!("cargo:rustc-link-lib=static=mongoc-static-1.0");
|
|
|
|
println!("cargo:rustc-link-lib=resolv");
|
|
|
|
println!("cargo:rustc-link-lib=resolv");
|
|
|
|
#[cfg(target_os = "linux")] println!("cargo:rustc-link-lib=icuuc");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|