Skip to content

Commit f7d9101

Browse files
committed
bazel-registry: Add wamr@2.4.4.envoy
Signed-off-by: Ryan Northey <ryan@synca.io>
1 parent b914787 commit f7d9101

File tree

6 files changed

+271
-0
lines changed

6 files changed

+271
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module(
2+
name = "wamr",
3+
version = "2.4.4.envoy",
4+
compatibility_level = 1,
5+
)
6+
7+
bazel_dep(name = "bazel_skylib", version = "1.7.0")
8+
bazel_dep(name = "rules_cc", version = "0.1.5")
9+
bazel_dep(name = "platforms", version = "1.0.0")
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
load("@rules_cc//cc:defs.bzl", "cc_library")
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
licenses(["notice"]) # Apache 2.0 with LLVM exception
6+
7+
cc_library(
8+
name = "iwasm",
9+
srcs = [
10+
# Memory allocator sources (EMS only - tlsf has been removed from upstream)
11+
"core/shared/mem-alloc/ems/ems_alloc.c",
12+
"core/shared/mem-alloc/ems/ems_gc.c",
13+
"core/shared/mem-alloc/ems/ems_hmu.c",
14+
"core/shared/mem-alloc/ems/ems_kfc.c",
15+
"core/shared/mem-alloc/mem_alloc.c",
16+
# Shared utils
17+
"core/shared/utils/bh_assert.c",
18+
"core/shared/utils/bh_bitmap.c",
19+
"core/shared/utils/bh_common.c",
20+
"core/shared/utils/bh_hashmap.c",
21+
"core/shared/utils/bh_leb128.c",
22+
"core/shared/utils/bh_list.c",
23+
"core/shared/utils/bh_log.c",
24+
"core/shared/utils/bh_queue.c",
25+
"core/shared/utils/bh_vector.c",
26+
"core/shared/utils/runtime_timer.c",
27+
# IWASM common sources
28+
"core/iwasm/common/wasm_blocking_op.c",
29+
"core/iwasm/common/wasm_c_api.c",
30+
"core/iwasm/common/wasm_exec_env.c",
31+
"core/iwasm/common/wasm_loader_common.c",
32+
"core/iwasm/common/wasm_memory.c",
33+
"core/iwasm/common/wasm_native.c",
34+
"core/iwasm/common/wasm_runtime_common.c",
35+
"core/iwasm/common/wasm_shared_memory.c",
36+
# Interpreter sources
37+
"core/iwasm/interpreter/wasm_loader.c",
38+
"core/iwasm/interpreter/wasm_runtime.c",
39+
] + select({
40+
# Fast vs classic interpreter
41+
"//bazel:fast_interp_enabled": ["core/iwasm/interpreter/wasm_interp_fast.c"],
42+
"//conditions:default": ["core/iwasm/interpreter/wasm_interp_classic.c"],
43+
}) + select({
44+
# Platform-specific sources
45+
"@platforms//os:linux": [
46+
"core/shared/platform/linux/platform_init.c",
47+
"core/shared/platform/common/posix/posix_malloc.c",
48+
"core/shared/platform/common/posix/posix_memmap.c",
49+
"core/shared/platform/common/posix/posix_thread.c",
50+
"core/shared/platform/common/posix/posix_time.c",
51+
"core/shared/platform/common/posix/posix_sleep.c",
52+
"core/shared/platform/common/posix/posix_blocking_op.c",
53+
],
54+
"@platforms//os:macos": [
55+
"core/shared/platform/darwin/platform_init.c",
56+
"core/shared/platform/common/posix/posix_malloc.c",
57+
"core/shared/platform/common/posix/posix_memmap.c",
58+
"core/shared/platform/common/posix/posix_thread.c",
59+
"core/shared/platform/common/posix/posix_time.c",
60+
"core/shared/platform/common/posix/posix_sleep.c",
61+
"core/shared/platform/common/posix/posix_blocking_op.c",
62+
# macOS doesn't have mremap, use fallback
63+
"core/shared/platform/common/memory/mremap.c",
64+
],
65+
}) + select({
66+
# Architecture-specific native invoke sources
67+
"//bazel:x86_64_simd": ["core/iwasm/common/arch/invokeNative_em64_simd.s"],
68+
"//bazel:x86_64_no_simd": ["core/iwasm/common/arch/invokeNative_em64.s"],
69+
"//bazel:aarch64_simd": ["core/iwasm/common/arch/invokeNative_aarch64_simd.s"],
70+
"//bazel:aarch64_no_simd": ["core/iwasm/common/arch/invokeNative_aarch64.s"],
71+
# Fallback to general C implementation for other architectures
72+
"//conditions:default": ["core/iwasm/common/arch/invokeNative_general.c"],
73+
}),
74+
hdrs = glob([
75+
"core/*.h", # For version.h and config.h
76+
"core/iwasm/include/*.h",
77+
"core/shared/platform/include/*.h",
78+
"core/shared/platform/linux/*.h",
79+
"core/shared/platform/darwin/*.h",
80+
"core/shared/platform/common/posix/*.h",
81+
"core/shared/mem-alloc/*.h",
82+
"core/shared/mem-alloc/ems/*.h",
83+
"core/shared/utils/*.h",
84+
"core/iwasm/common/*.h",
85+
"core/iwasm/interpreter/*.h",
86+
"core/iwasm/aot/*.h",
87+
"core/iwasm/compilation/*.h",
88+
]),
89+
copts = select({
90+
"@platforms//os:windows": [],
91+
"//conditions:default": [
92+
"-std=gnu99",
93+
"-Wno-unused-parameter",
94+
"-Wno-pedantic",
95+
"-Wno-unused-command-line-argument",
96+
],
97+
}),
98+
includes = [
99+
".", # Root for all relative paths
100+
"core",
101+
"core/iwasm", # For relative paths like ../aot/ from common/
102+
"core/iwasm/include",
103+
"core/shared/platform/include",
104+
"core/shared/mem-alloc",
105+
"core/shared/mem-alloc/ems",
106+
"core/shared/utils",
107+
"core/iwasm/common",
108+
"core/iwasm/interpreter",
109+
"core/iwasm/aot",
110+
"core/iwasm/compilation",
111+
] + select({
112+
"@platforms//os:linux": ["core/shared/platform/linux"],
113+
"@platforms//os:macos": ["core/shared/platform/darwin"],
114+
"//conditions:default": [],
115+
}),
116+
linkopts = select({
117+
"@platforms//os:linux": ["-lpthread", "-lm"],
118+
"@platforms//os:macos": ["-lpthread"],
119+
"//conditions:default": [],
120+
}),
121+
local_defines = [
122+
# Core defines
123+
"WASM_ENABLE_INTERP=1",
124+
"BH_MALLOC=wasm_runtime_malloc",
125+
"BH_FREE=wasm_runtime_free",
126+
# Use EMS allocator (tlsf has been removed from upstream WAMR)
127+
"MEM_ALLOCATOR_EMS=0",
128+
"MEM_ALLOCATOR_TLSF=1",
129+
"DEFAULT_MEM_ALLOCATOR=MEM_ALLOCATOR_EMS",
130+
# Disable features we don't need
131+
"WASM_ENABLE_LIBC_WASI=0",
132+
"WASM_ENABLE_LIBC_BUILTIN=0",
133+
"WASM_ENABLE_MULTI_MODULE=0",
134+
"WASM_ENABLE_AOT=0",
135+
"WASM_ENABLE_JIT=0",
136+
] + select({
137+
"@platforms//os:linux": [
138+
"BH_PLATFORM_LINUX",
139+
"_GNU_SOURCE", # Required for mremap and MREMAP_MAYMOVE
140+
"WASM_HAVE_MREMAP=1", # Linux has native mremap syscall
141+
],
142+
"@platforms//os:macos": ["BH_PLATFORM_DARWIN"],
143+
"//conditions:default": [],
144+
}) + select({
145+
"//bazel:fast_interp_enabled": ["WASM_ENABLE_FAST_INTERP=1"],
146+
"//conditions:default": ["WASM_ENABLE_FAST_INTERP=0"],
147+
}) + select({
148+
"//bazel:dump_call_stack_enabled": ["WASM_ENABLE_DUMP_CALL_STACK=1"],
149+
"//conditions:default": ["WASM_ENABLE_DUMP_CALL_STACK=0"],
150+
}) + select({
151+
"//bazel:custom_name_section_enabled": ["WASM_ENABLE_CUSTOM_NAME_SECTION=1"],
152+
"//conditions:default": ["WASM_ENABLE_CUSTOM_NAME_SECTION=0"],
153+
}) + select({
154+
"//bazel:load_custom_section_enabled": ["WASM_ENABLE_LOAD_CUSTOM_SECTION=1"],
155+
"//conditions:default": ["WASM_ENABLE_LOAD_CUSTOM_SECTION=0"],
156+
}) + select({
157+
"//bazel:bulk_memory_enabled": ["WASM_ENABLE_BULK_MEMORY=1"],
158+
"//conditions:default": ["WASM_ENABLE_BULK_MEMORY=0"],
159+
}) + select({
160+
"//bazel:ref_types_enabled": ["WASM_ENABLE_REF_TYPES=1"],
161+
"//conditions:default": ["WASM_ENABLE_REF_TYPES=0"],
162+
}) + select({
163+
"//bazel:tail_call_enabled": ["WASM_ENABLE_TAIL_CALL=1"],
164+
"//conditions:default": ["WASM_ENABLE_TAIL_CALL=0"],
165+
}) + select({
166+
"//bazel:simd_enabled": ["WASM_ENABLE_SIMD=1"],
167+
"//conditions:default": ["WASM_ENABLE_SIMD=0"],
168+
}),
169+
)
170+
171+
# Alias for compatibility
172+
alias(
173+
name = "wamr_lib",
174+
actual = ":iwasm",
175+
)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
# Debug/dev features - default OFF for production
6+
bool_flag(name = "dump_call_stack", build_setting_default = False)
7+
bool_flag(name = "custom_name_section", build_setting_default = False)
8+
bool_flag(name = "load_custom_section", build_setting_default = False)
9+
10+
# Runtime mode
11+
bool_flag(name = "fast_interp", build_setting_default = True)
12+
13+
# Wasm features
14+
bool_flag(name = "bulk_memory", build_setting_default = True)
15+
bool_flag(name = "ref_types", build_setting_default = True)
16+
bool_flag(name = "tail_call", build_setting_default = True)
17+
bool_flag(name = "simd", build_setting_default = False)
18+
19+
# Config settings for selects
20+
config_setting(name = "dump_call_stack_enabled", flag_values = {":dump_call_stack": "True"})
21+
config_setting(name = "custom_name_section_enabled", flag_values = {":custom_name_section": "True"})
22+
config_setting(name = "load_custom_section_enabled", flag_values = {":load_custom_section": "True"})
23+
config_setting(name = "fast_interp_enabled", flag_values = {":fast_interp": "True"})
24+
config_setting(name = "bulk_memory_enabled", flag_values = {":bulk_memory": "True"})
25+
config_setting(name = "ref_types_enabled", flag_values = {":ref_types": "True"})
26+
config_setting(name = "tail_call_enabled", flag_values = {":tail_call": "True"})
27+
config_setting(name = "simd_enabled", flag_values = {":simd": "True"})
28+
29+
# Combined arch + simd config settings
30+
config_setting(
31+
name = "x86_64_simd",
32+
constraint_values = ["@platforms//cpu:x86_64"],
33+
flag_values = {":simd": "True"},
34+
)
35+
36+
config_setting(
37+
name = "x86_64_no_simd",
38+
constraint_values = ["@platforms//cpu:x86_64"],
39+
flag_values = {":simd": "False"},
40+
)
41+
42+
config_setting(
43+
name = "aarch64_simd",
44+
constraint_values = ["@platforms//cpu:aarch64"],
45+
flag_values = {":simd": "True"},
46+
)
47+
48+
config_setting(
49+
name = "aarch64_no_simd",
50+
constraint_values = ["@platforms//cpu:aarch64"],
51+
flag_values = {":simd": "False"},
52+
)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
matrix:
2+
platform:
3+
- debian11
4+
- ubuntu2404
5+
- macos
6+
bazel:
7+
- 8.x
8+
9+
tasks:
10+
verify_targets:
11+
name: Verify build targets
12+
platform: ${{ platform }}
13+
bazel: ${{ bazel }}
14+
build_targets:
15+
- "@wamr//..."
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"url": "https://github.com/bytecodealliance/wasm-micro-runtime/archive/refs/tags/WAMR-2.4.4.tar.gz",
3+
"integrity": "sha256-A61RA38GI1V3t2XuBCpGIybYkZMAEHr0VGcZw1Ulspg=",
4+
"strip_prefix": "wasm-micro-runtime-WAMR-2.4.4",
5+
"overlay": {
6+
"BUILD.bazel": "sha256-15Kvn7oeE1LzysysQNzR8wmweMhfB/VsVuWRJpPR/GA=",
7+
"bazel/BUILD.bazel": "sha256-zlpzIe/So0vrWA7sGML4CI5E1k5UOe8ebJ77XK4h8xc="
8+
}
9+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"homepage": "https://github.com/bytecodealliance/wasm-micro-runtime",
3+
"maintainers": [],
4+
"repository": [
5+
"github:bytecodealliance/wasm-micro-runtime"
6+
],
7+
"versions": [
8+
"2.4.4.envoy"
9+
],
10+
"yanked_versions": []
11+
}

0 commit comments

Comments
 (0)