forked from mirrors/gecko-dev
This updates binjs_meta and thus weedle, bindgen and thus clang-sys transitively, and the mime / mime_guess crate and thus unicase and version-check. Differential Revision: https://phabricator.services.mozilla.com/D66282 --HG-- rename : third_party/rust/lmdb-rkv-sys/tests/fixtures/testdb/lock.mdb => third_party/rust/lmdb-rkv-sys/tests/fixtures/testdb-32/lock.mdb rename : third_party/rust/mime_guess/Cargo.lock => third_party/rust/nom/Cargo.lock rename : third_party/rust/nom/src/branch.rs => third_party/rust/nom/src/branch/macros.rs rename : third_party/rust/nom/src/sequence.rs => third_party/rust/nom/src/sequence/macros.rs rename : third_party/rust/rkv-0.10.2/.cargo-checksum.json => third_party/rust/rkv-0.10.4/.cargo-checksum.json rename : third_party/rust/rkv-0.10.2/CODE_OF_CONDUCT.md => third_party/rust/rkv-0.10.4/CODE_OF_CONDUCT.md rename : third_party/rust/rkv-0.10.2/Cargo.toml => third_party/rust/rkv-0.10.4/Cargo.toml rename : third_party/rust/rkv-0.10.2/LICENSE => third_party/rust/rkv-0.10.4/LICENSE rename : third_party/rust/rkv-0.10.2/examples/README.md => third_party/rust/rkv-0.10.4/examples/README.md rename : third_party/rust/rkv-0.10.2/examples/iterator.rs => third_party/rust/rkv-0.10.4/examples/iterator.rs rename : third_party/rust/rkv-0.10.2/examples/simple-store.rs => third_party/rust/rkv-0.10.4/examples/simple-store.rs rename : third_party/rust/rkv-0.10.2/run-all-examples.sh => third_party/rust/rkv-0.10.4/run-all-examples.sh rename : third_party/rust/rkv-0.10.2/src/bin/dump.rs => third_party/rust/rkv-0.10.4/src/bin/dump.rs rename : third_party/rust/rkv-0.10.2/src/bin/rand.rs => third_party/rust/rkv-0.10.4/src/bin/rand.rs rename : third_party/rust/rkv-0.10.2/src/env.rs => third_party/rust/rkv-0.10.4/src/env.rs rename : third_party/rust/rkv-0.10.2/src/error.rs => third_party/rust/rkv-0.10.4/src/error.rs rename : third_party/rust/rkv-0.10.2/src/lib.rs => third_party/rust/rkv-0.10.4/src/lib.rs rename : third_party/rust/rkv-0.10.2/src/manager.rs => third_party/rust/rkv-0.10.4/src/manager.rs rename : third_party/rust/rkv-0.10.2/src/migrate.rs => third_party/rust/rkv-0.10.4/src/migrate.rs rename : third_party/rust/rkv-0.10.2/src/readwrite.rs => third_party/rust/rkv-0.10.4/src/readwrite.rs rename : third_party/rust/rkv-0.10.2/src/store.rs => third_party/rust/rkv-0.10.4/src/store.rs rename : third_party/rust/rkv-0.10.2/src/store/integer.rs => third_party/rust/rkv-0.10.4/src/store/integer.rs rename : third_party/rust/rkv-0.10.2/src/store/integermulti.rs => third_party/rust/rkv-0.10.4/src/store/integermulti.rs rename : third_party/rust/rkv-0.10.2/src/store/multi.rs => third_party/rust/rkv-0.10.4/src/store/multi.rs rename : third_party/rust/rkv-0.10.2/src/store/single.rs => third_party/rust/rkv-0.10.4/src/store/single.rs rename : third_party/rust/rkv-0.10.2/src/value.rs => third_party/rust/rkv-0.10.4/src/value.rs rename : third_party/rust/rkv-0.10.2/tests/integer-store.rs => third_party/rust/rkv-0.10.4/tests/integer-store.rs rename : third_party/rust/rkv-0.10.2/tests/manager.rs => third_party/rust/rkv-0.10.4/tests/manager.rs rename : third_party/rust/rkv-0.10.2/tests/multi-integer-store.rs => third_party/rust/rkv-0.10.4/tests/multi-integer-store.rs rename : third_party/rust/rkv-0.10.2/tests/test_txn.rs => third_party/rust/rkv-0.10.4/tests/test_txn.rs extra : moz-landing-system : lando
69 lines
2 KiB
Rust
69 lines
2 KiB
Rust
use bindgen::callbacks::IntKind;
|
|
use bindgen::callbacks::ParseCallbacks;
|
|
use std::env;
|
|
use std::path::PathBuf;
|
|
|
|
#[derive(Debug)]
|
|
struct Callbacks;
|
|
|
|
impl ParseCallbacks for Callbacks {
|
|
fn int_macro(&self, name: &str, _value: i64) -> Option<IntKind> {
|
|
match name {
|
|
"MDB_SUCCESS"
|
|
| "MDB_KEYEXIST"
|
|
| "MDB_NOTFOUND"
|
|
| "MDB_PAGE_NOTFOUND"
|
|
| "MDB_CORRUPTED"
|
|
| "MDB_PANIC"
|
|
| "MDB_VERSION_MISMATCH"
|
|
| "MDB_INVALID"
|
|
| "MDB_MAP_FULL"
|
|
| "MDB_DBS_FULL"
|
|
| "MDB_READERS_FULL"
|
|
| "MDB_TLS_FULL"
|
|
| "MDB_TXN_FULL"
|
|
| "MDB_CURSOR_FULL"
|
|
| "MDB_PAGE_FULL"
|
|
| "MDB_MAP_RESIZED"
|
|
| "MDB_INCOMPATIBLE"
|
|
| "MDB_BAD_RSLOT"
|
|
| "MDB_BAD_TXN"
|
|
| "MDB_BAD_VALSIZE"
|
|
| "MDB_BAD_DBI"
|
|
| "MDB_LAST_ERRCODE" => Some(IntKind::Int),
|
|
_ => Some(IntKind::UInt),
|
|
}
|
|
}
|
|
}
|
|
|
|
pub fn generate() {
|
|
let mut lmdb = PathBuf::from(&env::var("CARGO_MANIFEST_DIR").unwrap());
|
|
lmdb.push("lmdb");
|
|
lmdb.push("libraries");
|
|
lmdb.push("liblmdb");
|
|
|
|
let mut out_path = PathBuf::from(&env::var("CARGO_MANIFEST_DIR").unwrap());
|
|
out_path.push("src");
|
|
|
|
let bindings = bindgen::Builder::default()
|
|
.header(lmdb.join("lmdb.h").to_string_lossy())
|
|
.whitelist_var("^(MDB|mdb)_.*")
|
|
.whitelist_type("^(MDB|mdb)_.*")
|
|
.whitelist_function("^(MDB|mdb)_.*")
|
|
.size_t_is_usize(true)
|
|
.ctypes_prefix("::libc")
|
|
.blacklist_item("mode_t")
|
|
.blacklist_item("mdb_mode_t")
|
|
.blacklist_item("mdb_filehandle_t")
|
|
.blacklist_item("^__.*")
|
|
.parse_callbacks(Box::new(Callbacks {}))
|
|
.layout_tests(false)
|
|
.prepend_enum_name(false)
|
|
.rustfmt_bindings(true)
|
|
.generate()
|
|
.expect("Unable to generate bindings");
|
|
|
|
bindings
|
|
.write_to_file(out_path.join("bindings.rs"))
|
|
.expect("Couldn't write bindings!");
|
|
}
|