selfhost: migrate tool sources to directory packages

Build w6a and w6l from package-main directories and expose the wcc backend through a narrow package API so w6c and wwdump no longer import implementation files. Retarget the remaining load-bearing fixtures and example sources to directory packages; retain the one intentional flat compiler collision as an explicitly composed raw unit.
This commit is contained in:
2026-08-12 17:12:03 +09:00
parent 90f9d60291
commit c7d9dc92de
38 changed files with 197 additions and 252 deletions

View File

@@ -112,13 +112,11 @@ main(void)
if (getcwd(cwd, sizeof cwd) == NULL) return 1;
/* #93 sep layout: the selfhost tools no longer leave a single
* next-to-source main.s. Self-build one real tool via the explicit
* main.ww compatibility root and feed EVERY emitted
* next-to-source main.s. Self-build one real directory package and
* feed EVERY emitted
* <tool>.sepwork/<pkg>.s as
* the generated-asm corpus — the root tool code plus each dep
* package's .s (richer than the old 3 monolithic main.s). The directory
* intentionally contains package main plus legacy file-import packages,
* so it is not a directory-package root. */
* package's .s (richer than the old 3 monolithic main.s). */
char stem[256], cmd[4096];
int fail = 0;
int n = 0;
@@ -126,11 +124,11 @@ main(void)
snprintf(stem, sizeof stem, "/tmp/wwa_%d_sh", getpid());
snprintf(cmd, sizeof cmd,
"timeout 400 %s/ww build -o %s "
"%s/selfhost/cmd/w6a/main.ww >/dev/null 2>&1",
"%s/selfhost/cmd/w6a >/dev/null 2>&1",
bin, stem, cwd);
if (runwait(cmd) != 0) {
fprintf(stderr,
"w6a_ww FAIL: cannot sep-build selfhost/cmd/w6a/main.ww\n");
"w6a_ww FAIL: cannot sep-build selfhost/cmd/w6a\n");
/* a failed build can leave a partial stem/.sepwork tree. */
fail = 1;
goto cleanup;