builder: build wasi-libc inside TinyGo

Instead of relying on a build when TinyGo is being built, do it like all
other libraries when it is needed.

This brings a few benefits:

  * No more running `make wasi-libc` on the command line as a special
    case for WebAssembly. The generic `git submodule update --init` step
    is now enough for wasi-libc.
  * It becomes much easier to customize the build per system. For
    example: include/exclude malloc as needed, disable/enable bulk
    memory operations per target, etc.
This commit is contained in:
Ayke van Laethem
2025-03-20 14:41:52 +01:00
committed by Ron Evans
parent 4c54aa20da
commit 632357ffb9
11 changed files with 362 additions and 105 deletions
+2 -2
View File
@@ -371,10 +371,10 @@ func (c *Config) LibcCFlags() []string {
"-isystem", filepath.Join(root, "lib", "musl", "include"),
}
case "wasi-libc":
root := goenv.Get("TINYGOROOT")
path := c.LibcPath("wasi-libc")
return []string{
"-nostdlibinc",
"-isystem", root + "/lib/wasi-libc/sysroot/include",
"-isystem", filepath.Join(path, "include"),
}
case "wasmbuiltins":
// nothing to add (library is purely for builtins)