Skip to content

Commit 53a20d9

Browse files
committed
chore: upgrade criterion to 0.7
1 parent 4bff765 commit 53a20d9

File tree

17 files changed

+5322
-25
lines changed

17 files changed

+5322
-25
lines changed

.github/workflows/rust.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ jobs:
1515
with:
1616
toolchain: 1.89.0
1717
components: rustfmt
18-
override: true
1918
- name: Check formatting
2019
run: |
2120
cargo fmt --all -- --check
@@ -32,8 +31,7 @@ jobs:
3231
uses: dtolnay/rust-toolchain@stable
3332
with:
3433
toolchain: 1.89.0
35-
components: clippy
36-
override: true
34+
components: clippy rustfmt
3735
- run: sudo apt update && sudo apt install -y libclang-dev
3836
- name: Run clippy
3937
run: |
@@ -90,23 +88,19 @@ jobs:
9088
with:
9189
toolchain: 1.89.0
9290
target: ${{ matrix.target }}
93-
profile: minimal
94-
override: true
91+
components: rustfmt
9592
- name: Remove msys64 # Workaround to resolve link error with C:\msys64\mingw64\bin\libclang.dll
9693
if: runner.os == 'Windows'
9794
run: Remove-Item -LiteralPath "C:\msys64\" -Force -Recurse
9895
- name: Install dependencies
9996
if: runner.os == 'Windows'
100-
run: choco install llvm -y
101-
- name: Install libclang-dev
102-
if: runner.os == 'Linux'
103-
run: sudo apt install libclang-dev
104-
- name: Install jemalloc
105-
if: runner.os == 'Linux'
106-
run: sudo apt install libjemalloc-dev
107-
- name: Install liburing
97+
run: vcpkg install llvm
98+
- name: Install dependencies (macOS)
99+
if: runner.os == 'macOS'
100+
run: brew install llvm lld
101+
- name: Install dependencies (Linux)
108102
if: runner.os == 'Linux'
109-
run: sudo apt install liburing-dev
103+
run: sudo apt-get update && sudo apt-get install -y libclang-dev libjemalloc-dev liburing-dev
110104
- name: Debug librocksdb-sys tests
111105
if: runner.os == 'Linux' || runner.os == 'Windows'
112106
run: clang --version && env

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@
77
[submodule "librocksdb-sys/lz4"]
88
path = librocksdb-sys/lz4
99
url = https://github.com/lz4/lz4.git
10+
[submodule "librocksdb-sys/zstd"]
11+
path = librocksdb-sys/zstd
12+
url = https://github.com/facebook/zstd.git
13+
[submodule "librocksdb-sys/zlib"]
14+
path = librocksdb-sys/zlib
15+
url = https://github.com/madler/zlib.git

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ serde = { version = "1", features = ["derive"], optional = true }
4141

4242
[dev-dependencies]
4343
trybuild = "1.0"
44-
criterion = "0.5"
44+
criterion = "0.7"
4545

4646
[[bench]]
4747
name = "transaction"

librocksdb-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ uuid = { version = "1.0", features = ["v4"] }
5050

5151
[build-dependencies]
5252
cc = { version = "1.0", features = ["parallel"] }
53-
bindgen = { version = "0.72.1", default-features = false }
53+
bindgen = { version = "0.72.1" }
5454
glob = "0.3.2"
5555
pkg-config = "0.3"
5656
rust-ini = "0.21"

librocksdb-sys/build.rs

Lines changed: 88 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,23 +128,18 @@ fn build_rocksdb() {
128128

129129
if cfg!(feature = "zstd") {
130130
config.define("ZSTD", Some("1"));
131-
if let Some(path) = env::var_os("DEP_ZSTD_INCLUDE") {
132-
config.include(path);
133-
}
131+
config.include("zstd/lib/");
132+
config.include("zstd/lib/dictBuilder/");
134133
}
135134

136135
if cfg!(feature = "zlib") {
137136
config.define("ZLIB", Some("1"));
138-
if let Some(path) = env::var_os("DEP_Z_INCLUDE") {
139-
config.include(path);
140-
}
137+
config.include("zlib/");
141138
}
142139

143140
if cfg!(feature = "bzip2") {
144141
config.define("BZIP2", Some("1"));
145-
if let Some(path) = env::var_os("DEP_BZIP2_INCLUDE") {
146-
config.include(path);
147-
}
142+
config.include("bzip2/");
148143
}
149144

150145
if cfg!(feature = "rtti") {
@@ -385,6 +380,75 @@ fn build_lz4() {
385380
compiler.compile("liblz4.a");
386381
}
387382

383+
fn build_zstd() {
384+
let mut compiler = cc::Build::new();
385+
386+
compiler.include("zstd/lib/");
387+
compiler.include("zstd/lib/common");
388+
compiler.include("zstd/lib/legacy");
389+
390+
let globs = &[
391+
"zstd/lib/common/*.c",
392+
"zstd/lib/compress/*.c",
393+
"zstd/lib/decompress/*.c",
394+
"zstd/lib/dictBuilder/*.c",
395+
"zstd/lib/legacy/*.c",
396+
];
397+
398+
for pattern in globs {
399+
for path in glob::glob(pattern).unwrap() {
400+
let path = path.unwrap();
401+
compiler.file(path);
402+
}
403+
}
404+
405+
compiler.opt_level(3);
406+
compiler.extra_warnings(false);
407+
408+
compiler.define("ZSTD_LIB_DEPRECATED", Some("0"));
409+
compiler.compile("libzstd.a");
410+
}
411+
412+
fn build_zlib() {
413+
let mut compiler = cc::Build::new();
414+
415+
let globs = &["zlib/*.c"];
416+
417+
for pattern in globs {
418+
for path in glob::glob(pattern).unwrap() {
419+
let path = path.unwrap();
420+
compiler.file(path);
421+
}
422+
}
423+
424+
compiler.flag_if_supported("-Wno-implicit-function-declaration");
425+
compiler.opt_level(3);
426+
compiler.extra_warnings(false);
427+
compiler.compile("libz.a");
428+
}
429+
430+
fn build_bzip2() {
431+
let mut compiler = cc::Build::new();
432+
433+
compiler
434+
.file("bzip2/blocksort.c")
435+
.file("bzip2/bzlib.c")
436+
.file("bzip2/compress.c")
437+
.file("bzip2/crctable.c")
438+
.file("bzip2/decompress.c")
439+
.file("bzip2/huffman.c")
440+
.file("bzip2/randtable.c");
441+
442+
compiler
443+
.define("_FILE_OFFSET_BITS", Some("64"))
444+
.define("BZ_NO_STDIO", None);
445+
446+
compiler.extra_warnings(false);
447+
compiler.opt_level(3);
448+
compiler.extra_warnings(false);
449+
compiler.compile("libbz2.a");
450+
}
451+
388452
fn try_to_find_and_link_lib(lib_name: &str) -> bool {
389453
if let Ok(v) = env::var(&format!("{}_COMPILE", lib_name)) {
390454
if v.to_lowercase() == "true" || v == "1" {
@@ -433,6 +497,21 @@ fn main() {
433497
fail_on_empty_directory("lz4");
434498
build_lz4();
435499
}
500+
if cfg!(feature = "zstd") && !try_to_find_and_link_lib("ZSTD") {
501+
println!("cargo:rerun-if-changed=zstd/");
502+
fail_on_empty_directory("zstd");
503+
build_zstd();
504+
}
505+
if cfg!(feature = "zlib") && !try_to_find_and_link_lib("Z") {
506+
println!("cargo:rerun-if-changed=zlib/");
507+
fail_on_empty_directory("zlib");
508+
build_zlib();
509+
}
510+
if cfg!(feature = "bzip2") && !try_to_find_and_link_lib("BZ2") {
511+
println!("cargo:rerun-if-changed=bzip2/");
512+
fail_on_empty_directory("bzip2");
513+
build_bzip2();
514+
}
436515

437516
println!("cargo:out_dir={}", env::var("OUT_DIR").unwrap());
438517
}

librocksdb-sys/bzip2/LICENSE

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
--------------------------------------------------------------------------
3+
4+
This program, "bzip2", the associated library "libbzip2", and all
5+
documentation, are copyright (C) 1996-2019 Julian R Seward. All
6+
rights reserved.
7+
8+
Redistribution and use in source and binary forms, with or without
9+
modification, are permitted provided that the following conditions
10+
are met:
11+
12+
1. Redistributions of source code must retain the above copyright
13+
notice, this list of conditions and the following disclaimer.
14+
15+
2. The origin of this software must not be misrepresented; you must
16+
not claim that you wrote the original software. If you use this
17+
software in a product, an acknowledgment in the product
18+
documentation would be appreciated but is not required.
19+
20+
3. Altered source versions must be plainly marked as such, and must
21+
not be misrepresented as being the original software.
22+
23+
4. The name of the author may not be used to endorse or promote
24+
products derived from this software without specific prior written
25+
permission.
26+
27+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
28+
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
31+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
33+
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
35+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38+
39+
Julian Seward, jseward@acm.org
40+
bzip2/libbzip2 version 1.0.8 of 13 July 2019
41+
42+
--------------------------------------------------------------------------

0 commit comments

Comments
 (0)