This repository has been archived by the owner on Sep 13, 2023. It is now read-only.
forked from danburkert/lmdb-rs
Update lmdb to latest version and other goodies #56
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
596539c
Update lmdb and to latest version of mdb.RE/0.9.24-moz branch
victorporof b6720b8
Create bindings automatically using rust-bindgen
victorporof 2089925
Allow cc to handle build optimizations
victorporof a07f50b
Hide warnings while building
victorporof bd45823
Use `flag_if_supported` instead of `flag` when compiling liblmdb
victorporof cac5b8d
Update all dependencies to their latest version for the sys crate
victorporof 13d77dd
Update all dependencies to their latest version for the main crate
victorporof a5ceeb2
Bump version to 0.9.0
victorporof 5772289
Remove explicit support for rust 1.30 on travis
victorporof a4776c0
Format yml files
victorporof 6bd3798
Don't generate bindings as part of the build phase
victorporof File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!