This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
forked from danburkert/lmdb-rs
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from mozilla/update-lmdb
Update lmdb to latest version and other goodies
- Loading branch information
Showing
12 changed files
with
1,559 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
jobs: | ||
- job: ${{ parameters.name }} | ||
pool: | ||
vmImage: ${{ parameters.vmImage }} | ||
strategy: | ||
matrix: | ||
stable: | ||
rustup_toolchain: stable | ||
beta: | ||
rustup_toolchain: beta | ||
nightly: | ||
rustup_toolchain: nightly | ||
steps: | ||
# Linux and macOS. | ||
- ${{ if ne(parameters.name, 'Windows') }}: | ||
- script: | | ||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN | ||
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" | ||
displayName: Install rust | ||
# Windows. | ||
- ${{ if eq(parameters.name, 'Windows') }}: | ||
- script: | | ||
curl -sSf -o rustup-init.exe https://win.rustup.rs | ||
rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN% | ||
set PATH=%PATH%;%USERPROFILE%\.cargo\bin | ||
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin" | ||
displayName: Install rust (windows) | ||
# All platforms. | ||
- script: | | ||
rustc -Vv | ||
cargo -V | ||
displayName: Query rust and cargo versions | ||
- script: cargo build | ||
displayName: Build | ||
- script: | | ||
cargo test --all --verbose | ||
cargo test --release --all --verbose | ||
displayName: Test | ||
# Linux and macOS w/nightly toolchain. | ||
# Ideally we'd only run the script for the nightly toolchain, but I can't | ||
# figure out how to determine that within the Azure Pipelines conditional. | ||
- ${{ if ne(parameters.name, 'Windows') }}: | ||
- script: | | ||
export RUST_BACKTRACE=1 | ||
if [ "$RUSTUP_TOOLCHAIN" = "nightly" ] | ||
then cargo bench --all --verbose; | ||
fi | ||
displayName: Bench | ||
# Windows w/nightly toolchain. | ||
# Ideally we'd only run the script for the nightly toolchain, but I can't | ||
# figure out how to determine that within the Azure Pipelines conditional. | ||
- ${{ if eq(parameters.name, 'Windows') }}: | ||
- script: | | ||
SET RUST_BACKTRACE=1 | ||
if "%RUSTUP_TOOLCHAIN%" == "nightly" ( | ||
cargo bench --all --verbose | ||
) | ||
displayName: Bench | ||
- job: ${{ parameters.name }} | ||
pool: | ||
vmImage: ${{ parameters.vmImage }} | ||
strategy: | ||
matrix: | ||
stable: | ||
rustup_toolchain: stable | ||
beta: | ||
rustup_toolchain: beta | ||
nightly: | ||
rustup_toolchain: nightly | ||
steps: | ||
# Linux and macOS. | ||
- ${{ if ne(parameters.name, 'Windows') }}: | ||
- script: | | ||
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN | ||
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" | ||
displayName: Install rust | ||
# Windows. | ||
- ${{ if eq(parameters.name, 'Windows') }}: | ||
- script: | | ||
curl -sSf -o rustup-init.exe https://win.rustup.rs | ||
rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN% | ||
set PATH=%PATH%;%USERPROFILE%\.cargo\bin | ||
echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin" | ||
displayName: Install rust (windows) | ||
# All platforms. | ||
- script: | | ||
rustc -Vv | ||
cargo -V | ||
displayName: Query rust and cargo versions | ||
- script: cargo build | ||
displayName: Build | ||
- script: | | ||
cargo test --all --verbose | ||
cargo test --release --all --verbose | ||
displayName: Test | ||
# Linux and macOS w/nightly toolchain. | ||
# Ideally we'd only run the script for the nightly toolchain, but I can't | ||
# figure out how to determine that within the Azure Pipelines conditional. | ||
- ${{ if ne(parameters.name, 'Windows') }}: | ||
- script: | | ||
export RUST_BACKTRACE=1 | ||
if [ "$RUSTUP_TOOLCHAIN" = "nightly" ] | ||
then cargo bench --all --verbose; | ||
fi | ||
displayName: Bench | ||
# Windows w/nightly toolchain. | ||
# Ideally we'd only run the script for the nightly toolchain, but I can't | ||
# figure out how to determine that within the Azure Pipelines conditional. | ||
- ${{ if eq(parameters.name, 'Windows') }}: | ||
- script: | | ||
SET RUST_BACKTRACE=1 | ||
if "%RUSTUP_TOOLCHAIN%" == "nightly" ( | ||
cargo bench --all --verbose | ||
) | ||
displayName: Bench |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
jobs: | ||
- template: azure-pipelines-template.yml | ||
parameters: | ||
name: macOS | ||
vmImage: macOS-10.13 | ||
- template: azure-pipelines-template.yml | ||
parameters: | ||
name: macOS | ||
vmImage: macOS-10.13 | ||
|
||
- template: azure-pipelines-template.yml | ||
parameters: | ||
name: Linux | ||
vmImage: ubuntu-16.04 | ||
- template: azure-pipelines-template.yml | ||
parameters: | ||
name: Linux | ||
vmImage: ubuntu-16.04 | ||
|
||
- template: azure-pipelines-template.yml | ||
parameters: | ||
name: Windows | ||
vmImage: vs2017-win2016 | ||
- template: azure-pipelines-template.yml | ||
parameters: | ||
name: Windows | ||
vmImage: vs2017-win2016 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
extern crate bindgen; | ||
|
||
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), | ||
} | ||
} | ||
} | ||
|
||
fn main() { | ||
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)_.*") | ||
.ctypes_prefix("::libc") | ||
.blacklist_item("mode_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!"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule lmdb
updated
6 files
+5 −0 | libraries/liblmdb/CHANGES | |
+1 −1 | libraries/liblmdb/COPYRIGHT | |
+3 −3 | libraries/liblmdb/lmdb.h | |
+5 −5 | libraries/liblmdb/mdb.c | |
+1 −1 | libraries/liblmdb/midl.c | |
+1 −1 | libraries/liblmdb/midl.h |
Oops, something went wrong.