Skip to content

Commit af2d813

Browse files
committed
bzlmod: patch v8 to allow for bazel_dep usage
Signed-off-by: Matt Leon <mattleon@google.com>
1 parent 3e95b20 commit af2d813

5 files changed

Lines changed: 246 additions & 232 deletions

File tree

MODULE.bazel

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,24 @@ llvm_configure(
114114
)
115115

116116
# V8 runtime and its dependencies
117-
v8 = use_extension("//bazel:extensions.bzl", "v8")
118-
use_repo(v8, "v8")
119-
120-
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
121-
pip.parse(
122-
extra_pip_args = ["--require-hashes"],
123-
hub_name = "v8_python_deps",
124-
python_version = "3.11",
125-
requirements_lock = "@v8//:bazel/requirements.txt",
117+
bazel_dep(name = "v8", version = "0.0.0")
118+
archive_override(
119+
module_name = "v8",
120+
integrity = "sha256-igwEEi6kcb2q7EodzjJasjCx/6LRMiFTVWfDKcNB+Xw=",
121+
patch_cmds = [
122+
"find ./src ./include -type f -exec sed -i.bak -e 's!#include \"third_party/simdutf/simdutf.h\"!#include \"simdutf.h\"!' {} \\;",
123+
"find ./src ./include -type f -exec sed -i.bak -e 's!#include \"third_party/fp16/src/include/fp16.h\"!#include \"fp16.h\"!' {} \\;",
124+
"find ./src ./include -type f -exec sed -i.bak -e 's!#include \"third_party/dragonbox/src/include/dragonbox/dragonbox.h\"!#include \"dragonbox/dragonbox.h\"!' {} \\;",
125+
"find ./src ./include -type f -exec sed -i.bak -e 's!#include \"third_party/fast_float/src/include/fast_float/!#include \"fast_float/!' {} \\;",
126+
],
127+
patch_strip = 1,
128+
patches = [
129+
"@proxy_wasm_cpp_host//bazel/external:v8.patch",
130+
"@proxy_wasm_cpp_host//bazel/external:v8_module_bazel.patch"
131+
],
132+
strip_prefix = "v8-14.4.258.16",
133+
urls = ["https://github.com/v8/v8/archive/refs/tags/14.4.258.16.tar.gz"],
126134
)
127-
use_repo(pip, "v8_python_deps")
128135

129136
# WasmEdge runtime
130137
wasmedge = use_extension("//bazel:extensions.bzl", "wasmedge")

MODULE.bazel.lock

Lines changed: 68 additions & 149 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bazel/extensions.bzl

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -118,78 +118,6 @@ wamr_jit_deps = module_extension(
118118
implementation = _wamr_jit_deps_impl,
119119
)
120120

121-
def _v8_impl(ctx):
122-
# V8 supporting dependencies. Some of these repositories are possible to
123-
# use with bazel_dep. All V8 dependencies are listed here for ease of maintenance.
124-
http_archive(
125-
name = "highway",
126-
sha256 = "7e0be78b8318e8bdbf6fa545d2ecb4c90f947df03f7aadc42c1967f019e63343",
127-
urls = ["https://github.com/google/highway/archive/refs/tags/1.2.0.tar.gz"],
128-
strip_prefix = "highway-1.2.0",
129-
)
130-
http_archive(
131-
name = "fast_float",
132-
sha256 = "d2a08e722f461fe699ba61392cd29e6b23be013d0f56e50c7786d0954bffcb17",
133-
urls = ["https://github.com/fastfloat/fast_float/archive/refs/tags/v7.0.0.tar.gz"],
134-
strip_prefix = "fast_float-7.0.0",
135-
)
136-
http_archive(
137-
name = "dragonbox",
138-
urls = ["https://github.com/jk-jeon/dragonbox/archive/6c7c925b571d54486b9ffae8d9d18a822801cbda.zip"],
139-
strip_prefix = "dragonbox-6c7c925b571d54486b9ffae8d9d18a822801cbda",
140-
sha256 = "2f10448d665355b41f599e869ac78803f82f13b070ce7ef5ae7b5cceb8a178f3",
141-
build_file = "@proxy_wasm_cpp_host//bazel/external:dragonbox.BUILD",
142-
)
143-
http_archive(
144-
name = "fp16",
145-
urls = ["https://github.com/Maratyszcza/FP16/archive/0a92994d729ff76a58f692d3028ca1b64b145d91.zip"],
146-
strip_prefix = "FP16-0a92994d729ff76a58f692d3028ca1b64b145d91",
147-
sha256 = "e66e65515fa09927b348d3d584c68be4215cfe664100d01c9dbc7655a5716d70",
148-
build_file = "@proxy_wasm_cpp_host//bazel/external:fp16.BUILD",
149-
)
150-
http_archive(
151-
name = "simdutf",
152-
sha256 = "512374f8291d3daf102ccd0ad223b1a8318358f7c1295efd4d9a3abbb8e4b6ff",
153-
urls = ["https://github.com/simdutf/simdutf/releases/download/v7.3.0/singleheader.zip"],
154-
build_file = "@proxy_wasm_cpp_host//bazel/external:simdutf.BUILD",
155-
)
156-
http_archive(
157-
name = "intel_ittapi",
158-
strip_prefix = "ittapi-a3911fff01a775023a06af8754f9ec1e5977dd97",
159-
sha256 = "1d0dddfc5abb786f2340565c82c6edd1cff10c917616a18ce62ee0b94dbc2ed4",
160-
urls = ["https://github.com/intel/ittapi/archive/a3911fff01a775023a06af8754f9ec1e5977dd97.tar.gz"],
161-
build_file = "@proxy_wasm_cpp_host//bazel/external: intel_ittapi.BUILD",
162-
)
163-
164-
# V8 is present in bazel central repository, however, as of 2026-01-20 does
165-
# not enumerate all of its dependencies, and the bazel_dep version of V8
166-
# cannot depend on repositories declared in extensions. Instead, import V8
167-
# via extension.
168-
http_archive(
169-
name = "v8",
170-
urls = ["https://github.com/v8/v8/archive/refs/tags/14.4.258.16.tar.gz"],
171-
integrity = "sha256-igwEEi6kcb2q7EodzjJasjCx/6LRMiFTVWfDKcNB+Xw=",
172-
strip_prefix = "v8-14.4.258.16",
173-
patches = [
174-
"@proxy_wasm_cpp_host//bazel/external:v8.patch",
175-
],
176-
patch_strip = 1,
177-
patch_cmds = [
178-
"find ./src ./include -type f -exec sed -i.bak -e 's!#include \"third_party/simdutf/simdutf.h\"!#include \"simdutf.h\"!' {} \\;",
179-
"find ./src ./include -type f -exec sed -i.bak -e 's!#include \"third_party/fp16/src/include/fp16.h\"!#include \"fp16.h\"!' {} \\;",
180-
"find ./src ./include -type f -exec sed -i.bak -e 's!#include \"third_party/dragonbox/src/include/dragonbox/dragonbox.h\"!#include \"dragonbox/dragonbox.h\"!' {} \\;",
181-
"find ./src ./include -type f -exec sed -i.bak -e 's!#include \"third_party/fast_float/src/include/fast_float/!#include \"fast_float/!' {} \\;",
182-
],
183-
)
184-
return ctx.extension_metadata(
185-
root_module_direct_deps = ["v8"],
186-
root_module_direct_dev_deps = [],
187-
)
188-
189-
v8 = module_extension(
190-
implementation = _v8_impl,
191-
)
192-
193121
def _wasmedge_impl(ctx):
194122
http_archive(
195123
name = "com_github_wasmedge_wasmedge",

bazel/external/v8.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ index 05630ab7035..7f14a987148 100644
136136
"@fast_float//:fast_float",
137137
- ":lib_fp16",
138138
- ":simdutf",
139-
+ "@fp16//:FP16",
139+
+ "@fp16//:fp16",
140140
+ "@simdutf//:simdutf",
141141
":v8_libbase",
142142
"@abseil-cpp//absl/container:btree",

0 commit comments

Comments
 (0)