Skip to content

Commit 0c955e8

Browse files
authored
Build wasmtime with wasmtime-c-api-impl crate (#501)
Always uses prefixed wasmtime-c-api-impl, otherwise the prefixed implementation bitrots. Prefixes the headers in the repo rule to allow for globbing, which is not possible in a genrule. The crates_vendor-provided wasmtime-c-api-impl provided build allows us to upgrade wasmtime solely by changing the version number in the repositories.bzl and Cargo.toml files. Build off of #496 --------- Signed-off-by: Matt Leon <mattleon@google.com>
1 parent e5865aa commit 0c955e8

47 files changed

Lines changed: 8228 additions & 1342 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

BUILD

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -187,45 +187,6 @@ cc_library(
187187
],
188188
)
189189

190-
cc_library(
191-
name = "wasmtime_lib",
192-
srcs = [
193-
"src/common/types.h",
194-
"src/wasmtime/types.h",
195-
"src/wasmtime/wasmtime.cc",
196-
],
197-
hdrs = ["include/proxy-wasm/wasmtime.h"],
198-
copts = [
199-
"-DWASM_API_EXTERN=",
200-
],
201-
defines = [
202-
"PROXY_WASM_HAS_RUNTIME_WASMTIME",
203-
"PROXY_WASM_HOST_ENGINE_WASMTIME",
204-
],
205-
# See: https://bytecodealliance.github.io/wasmtime/c-api/
206-
linkopts = select({
207-
"@platforms//os:macos": [],
208-
"@platforms//os:windows": [
209-
"ws2_32.lib",
210-
"advapi32.lib",
211-
"userenv.lib",
212-
"ntdll.lib",
213-
"shell32.lib",
214-
"ole32.lib",
215-
"bcrypt.lib",
216-
],
217-
"//conditions:default": [
218-
"-ldl",
219-
"-lm",
220-
"-lpthread",
221-
],
222-
}),
223-
deps = [
224-
":wasm_vm_headers",
225-
"@com_github_bytecodealliance_wasmtime//:wasmtime_lib",
226-
],
227-
)
228-
229190
genrule(
230191
name = "prefixed_wasmtime_sources",
231192
srcs = [
@@ -239,15 +200,14 @@ genrule(
239200
cmd = """
240201
for file in $(SRCS); do
241202
sed -e 's/wasm_/wasmtime_wasm_/g' \
242-
-e 's/include\\/wasm.h/include\\/prefixed_wasm.h/g' \
243203
-e 's/wasmtime\\/types.h/wasmtime\\/prefixed_types.h/g' \
244-
$$file >$(@D)/$$(dirname $$file)/prefixed_$$(basename $$file)
204+
$$file >$(@D)/src/wasmtime/prefixed_$$(basename $$file)
245205
done
246206
""",
247207
)
248208

249209
cc_library(
250-
name = "prefixed_wasmtime_lib",
210+
name = "wasmtime_lib",
251211
srcs = [
252212
"src/common/types.h",
253213
"src/wasmtime/prefixed_types.h",
@@ -281,7 +241,7 @@ cc_library(
281241
}),
282242
deps = [
283243
":wasm_vm_headers",
284-
"@com_github_bytecodealliance_wasmtime//:prefixed_wasmtime_lib",
244+
"@com_github_bytecodealliance_wasmtime//:wasmtime_lib",
285245
],
286246
)
287247

@@ -299,6 +259,5 @@ cc_library(
299259
[":wasmedge_lib"],
300260
) + proxy_wasm_select_engine_wasmtime(
301261
[":wasmtime_lib"],
302-
[":prefixed_wasmtime_lib"],
303262
),
304263
)

0 commit comments

Comments
 (0)