Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down