diff --git a/README.md b/README.md index 2bf9306c6..1cb104ccf 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,21 @@ $ scriptc coverage hello.ts ## Build WebAssembly -WASI and other cross-target builds require Zig. Its bundled WASI libc produces a portable WASI Preview 1 module through the production LLVM backend: +WASI and other cross-target builds require Zig. + +Note: + +`SCRIPTC_CC=zigcc` is not a command that `scriptc` runs; it's a keyword the compiler recognizes. In `packages/compiler/src/backend/native-toolchain.ts`, `resolveCc()` compares the value literally and maps it to the argv prefix `["zig", "cc"]`: + +```javascript +if (cc !== "zigcc") { + throw new Error(`unknown SCRIPTC_CC '${cc}' (supported: clang, zigcc)`); +} +if (target === "") return { argv: ["zig", "cc"], ... }; +``` +Only the exact strings `clang` or `zigcc` are accepted; `scriptc` then spawns `zig cc` itself. The only prerequisite is having `zig` on `PATH`. + +Its bundled WASI libc produces a portable WASI Preview 1 module through the production LLVM backend: ```console $ SCRIPTC_CC=zigcc SCRIPTC_TARGET=wasm32-wasi scriptc build hello.ts --no-keep-c -o hello.wasm >/dev/null