@@ -160,22 +160,56 @@ The index repo is simultaneously (a) the package index and (b) a mcpp workspace
160160whose members really *use and test* every recipe — driven entirely by `mcpp`, no
161161` .sh` . "基于 mcpp 自包含" achieved.
162162
163- # # 6. Typed `import mcpp;` library (task #20) — same 0.0.79
163+ # # 6. Typed `import mcpp;` library (task #20) — DEFERRED (own follow-up)
164164
165- Independent of Phase 1; ships in the same release. Per the build.mcpp design doc's
166- forward note : a typed module **bundled in the mcpp binary**, emitting the existing
167- stdout `mcpp:` wire protocol, implemented with C-level I/O so neither it nor
168- ` build.mcpp` needs `import std;`. Converts the `build.mcpp` examples/docs to the
169- modules-first `import mcpp;` form. The `build-mcpp` mcpp-index member adopts it in
170- Phase 2.
165+ A typed module **bundled in the mcpp binary**, emitting the existing stdout
166+ ` mcpp:` wire protocol, implemented with C-level I/O so neither it nor `build.mcpp`
167+ needs `import std;`. **De-risking confirmed the module itself works** (GCC 16) :
168+
169+ ` ` ` cpp
170+ module; #include <cstdio>
171+ export module mcpp;
172+ export namespace mcpp {
173+ inline void cxxflag(const char* f) { std::printf("mcpp:cxxflag=%s\n ", f); }
174+ inline void link_lib(const char* n) { std::printf("mcpp:link-lib=%s\n ", n); }
175+ // ...
176+ }
177+ ` ` `
178+ ` g++ -std=c++23 --sysroot=… -fmodules -c mcpp.cppm -o mcpp.o` → `gcm.cache/mcpp.gcm`
179+ + `mcpp.o`; then `g++ … -fmodules -x c++ build.mcpp -x none mcpp.o -o bin` (run
180+ **from the dir containing `gcm.cache/`**) → `import mcpp;` resolves; the binary
181+ emits the directives. No `import std;` needed.
182+
183+ **Why deferred (not in 0.0.79):** sound delivery needs two pieces this release
184+ won't rush :
185+ 1. **cwd-capable spawn.** GCC C++ finds modules only via `gcm.cache/<m>.gcm`
186+ *relative to the compile CWD* — the named `-fmodule-file=mcpp=<path>` form is
187+ rejected ("valid for D but not for C++"), and `-fmodule-output=` is absent on
188+ GCC 16. So compiling `build.mcpp` must run with `cwd = target/.build-mcpp/`;
189+ ` platform::process::capture_exec` has no `cwd` parameter yet (add one — child
190+ ` chdir` after fork on POSIX / `lpCurrentDirectory` on Windows).
191+ 2. **Clang path.** Clang uses `.pcm` + `--precompile` + `-fmodule-file=mcpp=<pcm>`
192+ (different ABI/flags), untested here. Without it, `build.mcpp` using
193+ ` import mcpp;` on a Clang host (macOS/Windows) would fail to compile — a partial
194+ feature. Both compiler paths must land together.
195+
196+ Plus : embed the module source in the binary, compile it **once** into
197+ ` target/.build-mcpp/` keyed on the toolchain (cache; don't rebuild), then convert
198+ the build.mcpp docs/examples/test + the mcpp-index `build-mcpp` member to
199+ ` import mcpp;` . Tracked as task # 20 for a focused 0.0.80. The string-protocol
200+ substrate already ships `build.mcpp` today, so this is a pure ergonomic layer — no
201+ functionality is blocked by deferring it.
171202
172203# # 7. Sequencing & releases
173204
174- 1. **mcpp PR A** — Phase 1 (workspace-aware test) + e2e + docs.
175- 2. **mcpp PR B** — typed `import mcpp;` library + convert build.mcpp docs/examples/test.
176- 3. **Release mcpp 0.0.79** (A+B) → full ecosystem loop (mirror → index → verify → pin).
177- 4. **mcpp-index PR C** — Phase 2 restructure on 0.0.79; delete all shell; CI =
178- ` mcpp test --workspace` → its CI green → merge.
205+ 1. **mcpp PR A** — Phase 1 (workspace-aware test) + e2e + docs → **release 0.0.79**
206+ → full ecosystem loop (mirror → index → verify → pin).
207+ 2. **mcpp-index PR B** — Phase 2 restructure on 0.0.79; delete all shell; CI =
208+ `mcpp test --workspace` → its CI green → merge. (Primary user goal : zero-shell,
209+ self-contained, `-p`-addressable index.)
210+ 3. **(follow-up) mcpp 0.0.80** — typed `import mcpp;` library (§6), with the
211+ cwd-capable spawn + Clang `.pcm` path; then convert build.mcpp docs/examples and
212+ the mcpp-index `build-mcpp` member to `import mcpp;`.
179213
180214# # 8. Risks / soundness notes
181215
0 commit comments