mirror of
https://github.com/openai/codex.git
synced 2026-11-05 20:10:33 +00:00
Use Bazel's zstd library for zstd-sys (#59219)
## What changed Configure `zstd-sys` to depend on `@zstd` and disable its Cargo build script. Upgrade the Bazel `zstd` dependency to `1.5.7.bcr.2`, update the lockfile, and remove the unused Windows MSVC include-directory patch. GitOrigin-RevId: 723b1a0245ea9e1789a95960bf99100038a03c45
This commit is contained in:
+3
-6
@@ -383,7 +383,7 @@ crate.from_cargo(
|
||||
],
|
||||
)
|
||||
|
||||
bazel_dep(name = "zstd", version = "1.5.7")
|
||||
bazel_dep(name = "zstd", version = "1.5.7.bcr.2")
|
||||
|
||||
crate.annotation(
|
||||
# Keep Windows proxy authentication aligned with codex-rs/.cargo/config.toml.
|
||||
@@ -411,11 +411,8 @@ crate.annotation(
|
||||
)
|
||||
crate.annotation(
|
||||
crate = "zstd-sys",
|
||||
gen_build_script = "on",
|
||||
patch_args = ["-p1"],
|
||||
patches = [
|
||||
"//patches:zstd-sys_windows_msvc_include_dirs.patch",
|
||||
],
|
||||
gen_build_script = "off",
|
||||
deps = ["@zstd"],
|
||||
)
|
||||
crate.annotation(
|
||||
crate = "ring",
|
||||
|
||||
Generated
+2
-2
@@ -262,8 +262,8 @@
|
||||
"https://bcr.bazel.build/modules/zlib/1.3.1.bcr.8/MODULE.bazel": "772c674bb78a0342b8caf32ab5c25085c493ca4ff08398208dcbe4375fe9f776",
|
||||
"https://bcr.bazel.build/modules/zlib/1.3.1.bcr.8/source.json": "cf377d76800dfc3d3b71e9dd4a8c53a62837cbce37cc4f25e6207b15fc1e8f2b",
|
||||
"https://bcr.bazel.build/modules/zlib/1.3.1/MODULE.bazel": "751c9940dcfe869f5f7274e1295422a34623555916eb98c174c1e945594bf198",
|
||||
"https://bcr.bazel.build/modules/zstd/1.5.7/MODULE.bazel": "f5780cdbd6f4c5bb985a20f839844316fe48fb5e463056f372dbc37cfabdf450",
|
||||
"https://bcr.bazel.build/modules/zstd/1.5.7/source.json": "f72c48184b6528ffc908a5a2bcbf3070c6684f3db03da2182c8ca999ae5f5cfd"
|
||||
"https://bcr.bazel.build/modules/zstd/1.5.7.bcr.2/MODULE.bazel": "d20bf700aacefca7c09840baa4bae9b347ddb31bd9125f4e592998f80b980cd7",
|
||||
"https://bcr.bazel.build/modules/zstd/1.5.7.bcr.2/source.json": "19cf972e5efc777e24008b90c2d819a4c814d33d1326c62d736ed97544817bf0"
|
||||
},
|
||||
"selectedYankedVersions": {},
|
||||
"moduleExtensions": {
|
||||
|
||||
@@ -33,5 +33,4 @@ exports_files([
|
||||
"windows-support-remote-case-aliases.patch",
|
||||
"windows-support-native-tools.patch",
|
||||
"xz_windows_stack_args.patch",
|
||||
"zstd-sys_windows_msvc_include_dirs.patch",
|
||||
])
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
diff --git a/build.rs b/build.rs
|
||||
index 912a3bf..e078f0e 100644
|
||||
--- a/build.rs
|
||||
+++ b/build.rs
|
||||
@@ -85,6 +85,7 @@ fn flag_if_supported_with_fallbacks(config: &mut cc::Build, flags: &[&str]) {
|
||||
}
|
||||
|
||||
fn compile_zstd() {
|
||||
+ let target = env::var("TARGET").unwrap_or_default();
|
||||
let mut config = cc::Build::new();
|
||||
|
||||
// Search the following directories for C files to add to the compilation.
|
||||
@@ -164,6 +165,16 @@ fn compile_zstd() {
|
||||
// Some extra parameters
|
||||
config.include("zstd/lib/");
|
||||
config.include("zstd/lib/common");
|
||||
+ if target.contains("msvc") {
|
||||
+ config.include("zstd/lib/compress");
|
||||
+ config.include("zstd/lib/decompress");
|
||||
+ #[cfg(feature = "zdict_builder")]
|
||||
+ config.include("zstd/lib/dictBuilder");
|
||||
+ #[cfg(feature = "legacy")]
|
||||
+ config.include("zstd/lib/legacy");
|
||||
+ #[cfg(feature = "seekable")]
|
||||
+ config.include("zstd/contrib/seekable_format");
|
||||
+ }
|
||||
config.warnings(false);
|
||||
|
||||
config.define("ZSTD_LIB_DEPRECATED", Some("0"));
|
||||
@@ -210,7 +221,9 @@ fn compile_zstd() {
|
||||
|
||||
// Hide symbols from resulting library,
|
||||
// so we can be used with another zstd-linking lib.
|
||||
- // See https://github.com/gyscos/zstd-rs/issues/58
|
||||
- config.flag("-fvisibility=hidden");
|
||||
+ // See https://github.com/gyscos/zstd-rs/issues/58.
|
||||
+ if !target.contains("msvc") {
|
||||
+ config.flag("-fvisibility=hidden");
|
||||
+ }
|
||||
config.define("XXH_PRIVATE_API", Some(""));
|
||||
config.define("ZSTDLIB_VISIBILITY", Some(""));
|
||||
Reference in New Issue
Block a user