Bump to 0.11, use pkg version in build of sys package

pull/38/merge
Thijs Cadier 7 years ago
parent b90a142d1e
commit ed49b0067e

@ -1,3 +1,7 @@
# 0.11.0
* Update bson dependency to 0.10
* Use installed libmongoc if it right version is present on the system (thanks to Matrix-Zhang)
# 0.10.0 # 0.10.0
* Initial upgrade to mongo c driver 1.8.0, no support for new features yet * Initial upgrade to mongo c driver 1.8.0, no support for new features yet

@ -1,6 +1,6 @@
[package] [package]
name = "mongo_driver" name = "mongo_driver"
version = "0.10.0" version = "0.11.0"
authors = ["Thijs Cadier <thijs@appsignal.com>"] authors = ["Thijs Cadier <thijs@appsignal.com>"]
description = "Mongo Rust driver built on top of the Mongo C driver" description = "Mongo Rust driver built on top of the Mongo C driver"
readme = "README.md" readme = "README.md"
@ -25,7 +25,7 @@ bson = "^0.10"
[dependencies.mongoc-sys] [dependencies.mongoc-sys]
path = "mongoc-sys" path = "mongoc-sys"
version = "1.8.0" version = "1.8.0-0"
[dev-dependencies] [dev-dependencies]
chrono = "^0.4" chrono = "^0.4"

@ -1,6 +1,6 @@
[package] [package]
name = "mongoc-sys" name = "mongoc-sys"
version = "1.8.0" version = "1.8.0-0"
description = "Sys package with installer and bindings for mongoc" description = "Sys package with installer and bindings for mongoc"
authors = ["Thijs Cadier <thijs@appsignal.com>"] authors = ["Thijs Cadier <thijs@appsignal.com>"]
build = "build.rs" build = "build.rs"

@ -4,26 +4,30 @@ use std::env;
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
static VERSION: &'static str = "1.8.0"; // Should be the same major version as in the manifest
fn main() { fn main() {
let mongoc_version = env!("CARGO_PKG_VERSION")
.split('-')
.next()
.expect("Crate version is not valid");
if pkg_config::Config::new() if pkg_config::Config::new()
.atleast_version(VERSION) .atleast_version(mongoc_version)
.statik(true) .statik(true)
.probe("libmongoc-1.0") .probe("libmongoc-1.0")
.is_err() .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 = format!("{}/{}", out_dir_var, VERSION); let out_dir = format!("{}/{}", out_dir_var, mongoc_version);
let driver_src_path = format!("mongo-c-driver-{}", VERSION); let driver_src_path = format!("mongo-c-driver-{}", mongoc_version);
let libmongoc_path = Path::new(&out_dir).join("lib/libmongoc-1.0.a"); let libmongoc_path = Path::new(&out_dir).join("lib/libmongoc-1.0.a");
if !libmongoc_path.exists() { if !libmongoc_path.exists() {
// Download and extract driver archive // Download and extract driver archive
let url = format!( let url = format!(
"https://github.com/mongodb/mongo-c-driver/releases/download/{}/mongo-c-driver-{}.tar.gz", "https://github.com/mongodb/mongo-c-driver/releases/download/{}/mongo-c-driver-{}.tar.gz",
VERSION, mongoc_version,
VERSION mongoc_version
); );
assert!( assert!(
Command::new("curl").arg("-O") // Save to disk Command::new("curl").arg("-O") // Save to disk
@ -34,7 +38,7 @@ fn main() {
.success() .success()
); );
let archive_name = format!("mongo-c-driver-{}.tar.gz", VERSION); let archive_name = format!("mongo-c-driver-{}.tar.gz", mongoc_version);
assert!( assert!(
Command::new("tar") Command::new("tar")
.arg("xzf") .arg("xzf")

Loading…
Cancel
Save