Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.

Commit 8678658

Browse files
committed
Add zstd-safe
Signed-off-by: Quanyi Ma <eli@patch.sh>
1 parent 4d0529a commit 8678658

File tree

16 files changed

+2989
-5
lines changed

16 files changed

+2989
-5
lines changed

BUCK

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,14 @@ cargo.rust_binary(
66
srcs = glob(["src/**/*.rs"]),
77
crate_root = "src/main.rs",
88
deps = [
9-
# Shlex
10-
"//third-party/rust/crates/shlex/1.3.0:shlex",
11-
"//third-party/rust/crates/shlex/1.3.0:shlex-no-std",
12-
# ---
13-
149
# zstd-sys
1510
"//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys",
1611
"//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys-experimental",
1712
# ---
1813

14+
# zstd-safe
15+
"//third-party/rust/crates/zstd-safe/7.2.1:zstd-safe",
16+
1917
# cfg-if
2018
"//third-party/rust/crates/cfg-if/1.0.0:cfg-if",
2119
# ---
@@ -81,6 +79,11 @@ cargo.rust_binary(
8179

8280
# portable-atomic
8381
# "//third-party/rust/crates/portable-atomic/1.8.0:portable-atomic",
82+
83+
# Shlex
84+
"//third-party/rust/crates/shlex/1.3.0:shlex",
85+
"//third-party/rust/crates/shlex/1.3.0:shlex-no-std",
86+
# ---
8487
],
8588
visibility = ["PUBLIC"],
8689
)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[cells]
2+
root = .
3+
prelude = prelude
4+
toolchains = toolchains
5+
none = none
6+
7+
[cell_aliases]
8+
config = prelude
9+
ovr_config = prelude
10+
fbcode = none
11+
fbsource = none
12+
fbcode_macros = none
13+
buck = none
14+
15+
# Uses a copy of the prelude bundled with the buck2 binary. You can alternatively delete this
16+
# section and vendor a copy of the prelude to the `prelude` directory of your project.
17+
[external_cells]
18+
prelude = bundled
19+
20+
[parser]
21+
target_platform_detector_spec = target:root//...->prelude//platforms:default
22+
23+
[build]
24+
execution_platforms = prelude//platforms:default
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"git": {
3+
"sha1": "03bc5c3e1856ea9b426a62c838066eca195c7816"
4+
},
5+
"path_in_vcs": "zstd-safe"
6+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
"""Buck build file for zstd-safe crate.
2+
3+
This file defines the build configuration for the zstd-safe Rust crate,
4+
including its features, dependencies, and build settings.
5+
"""
6+
7+
load("@prelude//rust:cargo_package.bzl", "cargo")
8+
9+
# Define available features
10+
FEATURES = {
11+
"arrays": [],
12+
"bindgen": ["//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys[bindgen]"],
13+
"debug": ["//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys[debug]"],
14+
"default": [
15+
"legacy",
16+
"arrays",
17+
"zdict_builder",
18+
],
19+
"experimental": ["//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys[experimental]"],
20+
"fat-lto": ["//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys[fat-lto]"],
21+
"legacy": ["//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys[legacy]"],
22+
"no_asm": ["//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys[no_asm]"],
23+
"pkg-config": ["//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys[pkg-config]"],
24+
"std": ["//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys[std]"],
25+
"thin": ["//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys[thin]"],
26+
"thin-lto": ["//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys[thin-lto]"],
27+
"zdict_builder": ["//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys[zdict_builder]"],
28+
"zstdmt": ["//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys[zstdmt]"],
29+
}
30+
31+
cargo.rust_binary(
32+
name = "build-script",
33+
edition = "2021",
34+
srcs = ["build.rs"],
35+
crate_root = "build.rs",
36+
deps = [],
37+
visibility = [":zstd-safe"],
38+
)
39+
40+
cargo.rust_library(
41+
name = "zstd-safe",
42+
edition = "2021",
43+
srcs = glob(["src/**/*.rs"]),
44+
crate_root = "src/lib.rs",
45+
features = FEATURES["default"] + ["std"], # Always enable std feature to be safe
46+
rustc_flags = [],
47+
# Since we can't easily access target_arch and target_os in Buck2,
48+
# we'll just enable the std feature by default to ensure compatibility
49+
deps = [
50+
"//third-party/rust/crates/zstd-sys/2.0.13+zstd.1.5.6:zstd-sys",
51+
":build-script",
52+
],
53+
visibility = ["PUBLIC"],
54+
)
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
2+
#
3+
# When uploading crates to the registry Cargo will automatically
4+
# "normalize" Cargo.toml files for maximal compatibility
5+
# with all versions of Cargo and also rewrite `path` dependencies
6+
# to registry (e.g., crates.io) dependencies.
7+
#
8+
# If you are reading this file be aware that the original Cargo.toml
9+
# will likely look very different (and much more reasonable).
10+
# See Cargo.toml.orig for the original contents.
11+
12+
[package]
13+
edition = "2018"
14+
rust-version = "1.64"
15+
name = "zstd-safe"
16+
version = "7.2.1"
17+
authors = ["Alexandre Bury <alexandre.bury@gmail.com>"]
18+
build = "build.rs"
19+
exclude = ["update_consts.sh"]
20+
description = "Safe low-level bindings for the zstd compression library."
21+
readme = "Readme.md"
22+
keywords = [
23+
"zstd",
24+
"zstandard",
25+
"compression",
26+
]
27+
categories = [
28+
"api-bindings",
29+
"compression",
30+
]
31+
license = "MIT/Apache-2.0"
32+
repository = "https://github.com/gyscos/zstd-rs"
33+
34+
[package.metadata.docs.rs]
35+
features = [
36+
"experimental",
37+
"arrays",
38+
"std",
39+
"zdict_builder",
40+
"doc-cfg",
41+
]
42+
43+
[dependencies.zstd-sys]
44+
version = "2.0.10"
45+
default-features = false
46+
47+
[features]
48+
arrays = []
49+
bindgen = ["zstd-sys/bindgen"]
50+
debug = ["zstd-sys/debug"]
51+
default = [
52+
"legacy",
53+
"arrays",
54+
"zdict_builder",
55+
]
56+
doc-cfg = []
57+
experimental = ["zstd-sys/experimental"]
58+
fat-lto = ["zstd-sys/fat-lto"]
59+
legacy = ["zstd-sys/legacy"]
60+
no_asm = ["zstd-sys/no_asm"]
61+
pkg-config = ["zstd-sys/pkg-config"]
62+
std = ["zstd-sys/std"]
63+
thin = ["zstd-sys/thin"]
64+
thin-lto = ["zstd-sys/thin-lto"]
65+
zdict_builder = ["zstd-sys/zdict_builder"]
66+
zstdmt = ["zstd-sys/zstdmt"]

third-party/rust/crates/zstd-safe/7.2.1/Cargo.toml.orig

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
MIT or Apache-2.0

0 commit comments

Comments
 (0)