From babc0594df116906c86674299ea13e6d96b2c54e Mon Sep 17 00:00:00 2001 From: Myk Melez Date: Fri, 12 Apr 2019 14:38:39 -0700 Subject: [PATCH 1/2] add feature flags to define MDB_IDL_LOGN macro --- lmdb-sys/Cargo.toml | 22 ++++++++++++++++++++++ lmdb-sys/build.rs | 29 +++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/lmdb-sys/Cargo.toml b/lmdb-sys/Cargo.toml index 659f171..6e1386c 100644 --- a/lmdb-sys/Cargo.toml +++ b/lmdb-sys/Cargo.toml @@ -21,3 +21,25 @@ libc = "0.2" [build-dependencies] pkg-config = "0.3.2" cc = "1" + +[features] +default = [] + +# These features configure the MDB_IDL_LOGN macro, which determines +# the size of the free and dirty page lists (and thus the amount of memory +# allocated when opening an LMDB environment in read-write mode). +# +# Each feature defines MDB_IDL_LOGN as the value in the name of the feature. +# That means these features are mutually exclusive, and you must not specify +# more than one at the same time (or the crate will fail to compile). +# +# For more information on the motivation for these features (and their effect), +# see https://github.com/mozilla/lmdb/pull/2. +mdb_idl_logn_8 = [] +mdb_idl_logn_9 = [] +mdb_idl_logn_10 = [] +mdb_idl_logn_11 = [] +mdb_idl_logn_12 = [] +mdb_idl_logn_13 = [] +mdb_idl_logn_14 = [] +mdb_idl_logn_15 = [] diff --git a/lmdb-sys/build.rs b/lmdb-sys/build.rs index 8ae769a..0a115da 100644 --- a/lmdb-sys/build.rs +++ b/lmdb-sys/build.rs @@ -4,6 +4,34 @@ extern crate cc; use std::env; use std::path::PathBuf; +#[cfg(feature = "mdb_idl_logn_8")] +const MDB_IDL_LOGN: u8 = 8; +#[cfg(feature = "mdb_idl_logn_9")] +const MDB_IDL_LOGN: u8 = 9; +#[cfg(feature = "mdb_idl_logn_10")] +const MDB_IDL_LOGN: u8 = 10; +#[cfg(feature = "mdb_idl_logn_11")] +const MDB_IDL_LOGN: u8 = 11; +#[cfg(feature = "mdb_idl_logn_12")] +const MDB_IDL_LOGN: u8 = 12; +#[cfg(feature = "mdb_idl_logn_13")] +const MDB_IDL_LOGN: u8 = 13; +#[cfg(feature = "mdb_idl_logn_14")] +const MDB_IDL_LOGN: u8 = 14; +#[cfg(feature = "mdb_idl_logn_15")] +const MDB_IDL_LOGN: u8 = 15; +#[cfg(not(any( + feature = "mdb_idl_logn_8", + feature = "mdb_idl_logn_9", + feature = "mdb_idl_logn_10", + feature = "mdb_idl_logn_11", + feature = "mdb_idl_logn_12", + feature = "mdb_idl_logn_13", + feature = "mdb_idl_logn_14", + feature = "mdb_idl_logn_15", +)))] +const MDB_IDL_LOGN: u8 = 16; + fn main() { let mut lmdb: PathBuf = PathBuf::from(&env::var("CARGO_MANIFEST_DIR").unwrap()); lmdb.push("lmdb"); @@ -12,6 +40,7 @@ fn main() { if !pkg_config::find_library("liblmdb").is_ok() { cc::Build::new() + .define("MDB_IDL_LOGN", Some(MDB_IDL_LOGN.to_string().as_str())) .file(lmdb.join("mdb.c")) .file(lmdb.join("midl.c")) // https://github.com/LMDB/lmdb/blob/LMDB_0.9.21/libraries/liblmdb/Makefile#L25 From 0c37ccb2d374d6c0904e6816b303ed64f8c8b7d6 Mon Sep 17 00:00:00 2001 From: Myk Melez Date: Fri, 12 Apr 2019 14:52:15 -0700 Subject: [PATCH 2/2] update to latest version of mdb.RE/0.9-moz branch --- lmdb-sys/lmdb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lmdb-sys/lmdb b/lmdb-sys/lmdb index 4d36c60..6477ba9 160000 --- a/lmdb-sys/lmdb +++ b/lmdb-sys/lmdb @@ -1 +1 @@ -Subproject commit 4d36c60963e65aa1a753483fd1cfca305a9002cf +Subproject commit 6477ba95ca484050a4203051305a31c52aa64896