1 class WasmMicroRuntime < Formula
2 desc "WebAssembly Micro Runtime (WAMR)"
3 homepage "https://github.com/bytecodealliance/wasm-micro-runtime"
4 url "https://github.com/bytecodealliance/wasm-micro-runtime/archive/refs/tags/WAMR-2.2.0.tar.gz"
5 sha256 "93b6ba03f681e061967106046b1908631ee705312b9a6410f3baee7af7c6aac9"
6 license "Apache-2.0" => { with: "LLVM-exception" }
7 head "https://github.com/bytecodealliance/wasm-micro-runtime.git", branch: "main"
9 # Upstream creates releases that use a stable tag (e.g., `v1.2.3`) but are
10 # labeled as "pre-release" on GitHub before the version is released, so it's
11 # necessary to use the `GithubLatest` strategy.
14 strategy :github_latest
18 sha256 cellar: :any, arm64_sequoia: "8c09d15112bc9ac42ab86ccc8baf1881ec3653a0d589dfad8a7aa41ae5f4d411"
19 sha256 cellar: :any, arm64_sonoma: "9b5b5ea15d69f031cd2d314a8bcf70d804c210280b330be3fb0034726cf36f75"
20 sha256 cellar: :any, arm64_ventura: "2e6ac37ea867c542514480907f9b0710e477c67dd286c1208930444da16582f4"
21 sha256 cellar: :any, sonoma: "92ed7cdc11f95b3d4be42b9b2878e9c66aae6f0c537be17fcb0731ded92a7dd2"
22 sha256 cellar: :any, ventura: "f4ba8cddef3b9e781ead80432292f6996a9f259c68b3696d8d1b3589f7f4250e"
23 sha256 cellar: :any_skip_relocation, x86_64_linux: "f1c67ba32fefde0efd67412efe9853e03b47fb0a8cfd845d03a795d231e130a6"
26 depends_on "cmake" => :build
29 # Prevent CMake from downloading and building things on its own.
30 buildpath.glob("**/build_llvm*").map(&:unlink)
31 buildpath.glob("**/libc_uvwasi.cmake").map(&:unlink)
33 -DWAMR_BUILD_MULTI_MODULE=1
34 -DWAMR_BUILD_DUMP_CALL_STACK=1
36 -DWAMR_BUILD_LIBC_UVWASI=0
39 cmake_source = buildpath/"product-mini/platforms"/OS.kernel_name.downcase
41 # First build the CLI which has its own CMake build configuration
42 system "cmake", "-S", cmake_source, "-B", "platform_build", *cmake_args, *std_cmake_args
43 system "cmake", "--build", "platform_build"
44 system "cmake", "--install", "platform_build"
46 # As a second step build and install the shared library and the C headers
47 system "cmake", "-S", ".", "-B", "build", *cmake_args, *std_cmake_args
48 system "cmake", "--build", "build"
49 system "cmake", "--install", "build"
53 resource "homebrew-fib_wasm" do
54 url "https://github.com/wasm3/wasm3/raw/main/test/lang/fib.c.wasm"
55 sha256 "e6fafc5913921693101307569fc1159d4355998249ca8d42d540015433d25664"
58 resource("homebrew-fib_wasm").stage testpath
60 output = shell_output("#{bin}/iwasm -f fib #{testpath}/fib.c.wasm 2>&1", 1)
61 assert_match "Exception: invalid input argument count", output
63 assert_match version.to_s, shell_output("#{bin}/iwasm --version")