Repatch rusty_v8

This commit is contained in:
Channing Conger
2026-03-20 03:52:36 +00:00
parent 7b806611e2
commit 393b5603d1
3 changed files with 44 additions and 4 deletions

View File

@@ -135,20 +135,33 @@ crate.annotation(
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")
new_local_repository(
name = "v8_targets",
build_file = "//third_party/v8:BUILD.bazel",
path = "third_party/v8",
)
crate.annotation(
build_script_data = [
"@//third_party/v8:rusty_v8_archive_for_target",
"@//third_party/v8:rusty_v8_binding_for_target",
"@v8_targets//:rusty_v8_archive_for_target",
"@v8_targets//:rusty_v8_binding_for_target",
],
build_script_env = {
"RUSTY_V8_ARCHIVE": "$(execpath @//third_party/v8:rusty_v8_archive_for_target)",
"RUSTY_V8_SRC_BINDING_PATH": "$(execpath @//third_party/v8:rusty_v8_binding_for_target)",
"RUSTY_V8_ARCHIVE": "$(execpath @v8_targets//:rusty_v8_archive_for_target)",
"RUSTY_V8_SRC_BINDING_PATH": "$(execpath @v8_targets//:rusty_v8_binding_for_target)",
},
crate = "v8",
gen_build_script = "on",
patch_args = ["-p1"],
patches = [
"//patches:rusty_v8_prebuilt_out_dir.patch",
],
)
inject_repo(crate, "v8_targets")
llvm = use_extension("@llvm//extensions:llvm.bzl", "llvm")
use_repo(llvm, "llvm-project")

View File

@@ -1,5 +1,6 @@
exports_files([
"aws-lc-sys_memcmp_check.patch",
"rusty_v8_prebuilt_out_dir.patch",
"v8_bazel_rules.patch",
"v8_module_deps.patch",
"v8_source_portability.patch",

View File

@@ -0,0 +1,26 @@
--- a/build.rs
+++ b/build.rs
@@ -577,7 +577,23 @@
path
}
+fn out_dir_abs() -> PathBuf {
+ let cwd = env::current_dir().unwrap();
+
+ // target/debug/build/rusty_v8-d9e5a424d4f96994/out/
+ let out_dir = env::var_os("OUT_DIR").expect(
+ "The 'OUT_DIR' environment is not set (it should be something like \
+ 'target/debug/rusty_v8-{hash}').",
+ );
+
+ cwd.join(out_dir)
+}
+
fn static_lib_dir() -> PathBuf {
+ if env::var_os("RUSTY_V8_ARCHIVE").is_some() {
+ return out_dir_abs().join("gn_out").join("obj");
+ }
+
build_dir().join("gn_out").join("obj")
}