uses the Zig build system to build WebAssembly's binary C tools.
zig build
zig fetch --save git+https://github.com/dasimmet/wabt.git
> ./zig-out/bin/wasm2c --help
usage: wasm2c [options] filename
Read a file in the WebAssembly binary format, and convert it to
a C source file and header.
> ./zig-out/bin/wasm-merge --help
================================================================================
wasm-merge INFILE1 NAME1 INFILE2 NAME2 [..]
Merge wasm files into one.
const wabt = @import("wabt");
// wasm-opt
const optimized_wasm: LazyPath = wabt.wasm_opt(
b.path("my.wasm"), // source path
"optimized.wasm", // out_basename
.{"--mvp-features", "-Oz", "-c"}, // extra args
);
// wasm2wat
const my_wat: LazyPath = wabt.wasm2wat(
optimized_wasm, // source path
"my.wat", // out_basename
.{}, // extra args
);