33This guide is for maintainers and builders working on clayterm itself.
44
55It covers:
6+
67- cloning the repo correctly,
78- initializing the ` clay ` git submodule,
89- installing the toolchain needed to compile the C sources to WebAssembly,
@@ -16,6 +17,7 @@ It does **not** cover npm/JSR packaging or publishing.
1617The local source build is driven by ` make ` .
1718
1819It generates:
20+
1921- ` clayterm.wasm ` — the compiled WebAssembly module built from the C sources
2022- ` wasm.ts ` — a generated TypeScript file derived from ` clayterm.wasm `
2123
@@ -44,11 +46,13 @@ Quick check:
4446git submodule status --recursive
4547```
4648
47- You should also see a populated ` clay/ ` directory. If ` clay/ ` is missing or empty, fix the submodule state before building.
49+ You should also see a populated ` clay/ ` directory. If ` clay/ ` is missing or
50+ empty, fix the submodule state before building.
4851
4952## Required tools
5053
5154You need:
55+
5256- ` git `
5357- ` make `
5458- ` clang ` with wasm32-capable support
@@ -60,7 +64,8 @@ Equivalent packages are fine if your package manager uses different names.
6064
6165### macOS
6266
63- Install Apple's command line tools first. They provide the base developer tools, including ` git ` and ` make ` .
67+ Install Apple's command line tools first. They provide the base developer tools,
68+ including ` git ` and ` make ` .
6469
6570``` sh
6671xcode-select --install
@@ -79,7 +84,8 @@ echo 'export PATH="$(brew --prefix llvm)/bin:$PATH"' >> ~/.zshrc
7984source ~ /.zshrc
8085```
8186
82- If you do not already have ` git ` available after installing the command line tools, install it with Homebrew:
87+ If you do not already have ` git ` available after installing the command line
88+ tools, install it with Homebrew:
8389
8490``` sh
8591brew install git
@@ -138,9 +144,11 @@ From an elevated PowerShell prompt:
138144wsl --install -d Ubuntu
139145```
140146
141- Then open the Ubuntu environment and follow the ** Debian / Ubuntu** instructions above.
147+ Then open the Ubuntu environment and follow the ** Debian / Ubuntu** instructions
148+ above.
142149
143- The build host runs inside WSL2, but the resulting WebAssembly artifacts are intended to run on ** native Windows** at runtime.
150+ The build host runs inside WSL2, but the resulting WebAssembly artifacts are
151+ intended to run on ** native Windows** at runtime.
144152
145153## Verify the toolchain
146154
@@ -160,7 +168,9 @@ clang --target=wasm32 -c -x c /dev/null -o /tmp/clayterm-wasm-test.o
160168rm -f /tmp/clayterm-wasm-test.o
161169```
162170
163- On macOS, if ` which clang ` still points to ` /usr/bin/clang ` and the wasm test fails, make sure the Homebrew LLVM ` bin/ ` directory is at the front of your ` PATH ` .
171+ On macOS, if ` which clang ` still points to ` /usr/bin/clang ` and the wasm test
172+ fails, make sure the Homebrew LLVM ` bin/ ` directory is at the front of your
173+ ` PATH ` .
164174
165175## Build from source
166176
171181```
172182
173183This should produce:
184+
174185- ` clayterm.wasm `
175186- ` wasm.ts `
176187
@@ -183,6 +194,7 @@ make clean && make
183194## When to rebuild
184195
185196Re-run ` make ` when:
197+
186198- you change files under ` src/ `
187199- you update the ` clay ` submodule
188200- ` clayterm.wasm ` or ` wasm.ts ` is missing
@@ -214,6 +226,7 @@ deno lint
214226### ` clay/ ` is missing or empty
215227
216228Symptoms may include build failures such as:
229+
217230- ` fatal error: '../clay/clay.h' file not found `
218231
219232Recovery:
@@ -232,10 +245,12 @@ make clean && make
232245### ` clang ` cannot target ` wasm32 `
233246
234247Symptoms may include:
248+
235249- target-related ` clang ` errors mentioning ` wasm32 `
236250- linker failures while producing ` clayterm.wasm `
237251
238252Recovery:
253+
239254- make sure you are using an LLVM/Clang build with wasm support
240255- on macOS, prefer the Homebrew ` llvm ` toolchain over ` /usr/bin/clang `
241256- on Linux/WSL2, make sure both ` clang ` and ` lld ` are installed
@@ -251,6 +266,7 @@ If the smoke test fails, fix the toolchain first and only then rerun `make`.
251266### Generated artifacts are missing or stale
252267
253268Symptoms may include:
269+
254270- ` clayterm.wasm ` is missing
255271- ` wasm.ts ` is missing
256272- you changed ` src/ ` or updated ` clay/ ` , but the generated outputs do not match
@@ -272,6 +288,7 @@ deno task test
272288This document is intentionally limited to local source builds for development.
273289
274290Out of scope:
291+
275292- ` deno task build:npm `
276293- ` deno task build:jsr `
277294- ` npm publish `
0 commit comments