Skip to content

Commit

Permalink
Remove the feature and always use the vendored version
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerollmops committed Jan 11, 2023
1 parent d5bef4f commit df71fed
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 42 deletions.
13 changes: 0 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ This library is able to serialize all kind of types, not just bytes slices, even

Go check out [the examples](heed/examples/).

## Vendoring

By default, if LMDB is installed on the system, this crate will attempt to make use of the system-available LMDB.
To force installation from source, build this crate with the `vendored` feature.

## Building from Source

### Using the system LMDB if available
Expand All @@ -35,11 +30,3 @@ However, if you already cloned it and forgot about the initialising the submodul
```bash
git submodule update --init
```

### Always vendoring

```bash
git clone --recursive https://github.com/meilisearch/heed.git
cd heed
cargo build --features vendored
```
3 changes: 0 additions & 3 deletions heed/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ url = "2.3.1"
# like the `EnvOpenOptions` struct.
default = ["serde", "serde-bincode", "serde-json"]

# Use the provided version of LMDB instead of the one that is installed on the system.
vendored = ["lmdb-master-sys/vendored"]

# The NO_TLS flag is automatically set on Env opening and
# RoTxn implements the Sync trait. This allow the user to reference
# a read-only transaction from multiple threads at the same time.
Expand Down
7 changes: 3 additions & 4 deletions lmdb-master-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ pkg-config = "0.3.26"

[features]
default = []
vendored = []
with-asan = ["vendored"]
with-fuzzer = ["vendored"]
with-fuzzer-no-link = ["vendored"]
with-asan = []
with-fuzzer = []
with-fuzzer-no-link = []
42 changes: 20 additions & 22 deletions lmdb-master-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,25 @@ fn main() {
warn!("Building with `-fsanitize=fuzzer`.");
}

if cfg!(feature = "vendored") || pkg_config::find_library("lmdb").is_err() {
let mut builder = cc::Build::new();

builder
.file(lmdb.join("mdb.c"))
.file(lmdb.join("midl.c"))
// https://github.com/mozilla/lmdb/blob/b7df2cac50fb41e8bd16aab4cc5fd167be9e032a/libraries/liblmdb/Makefile#L23
.flag_if_supported("-Wno-unused-parameter")
.flag_if_supported("-Wbad-function-cast")
.flag_if_supported("-Wuninitialized");

if cfg!(feature = "with-asan") {
builder.flag("-fsanitize=address");
}

if cfg!(feature = "with-fuzzer") {
builder.flag("-fsanitize=fuzzer");
} else if cfg!(feature = "with-fuzzer-no-link") {
builder.flag("-fsanitize=fuzzer-no-link");
}

builder.compile("liblmdb.a")
let mut builder = cc::Build::new();

builder
.file(lmdb.join("mdb.c"))
.file(lmdb.join("midl.c"))
// https://github.com/mozilla/lmdb/blob/b7df2cac50fb41e8bd16aab4cc5fd167be9e032a/libraries/liblmdb/Makefile#L23
.flag_if_supported("-Wno-unused-parameter")
.flag_if_supported("-Wbad-function-cast")
.flag_if_supported("-Wuninitialized");

if cfg!(feature = "with-asan") {
builder.flag("-fsanitize=address");
}

if cfg!(feature = "with-fuzzer") {
builder.flag("-fsanitize=fuzzer");
} else if cfg!(feature = "with-fuzzer-no-link") {
builder.flag("-fsanitize=fuzzer-no-link");
}

builder.compile("liblmdb.a")
}

0 comments on commit df71fed

Please sign in to comment.