From 1adce493ebeea9b1e7c5121688fe59832d479382 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Thu, 23 Jul 2026 12:54:36 +0000 Subject: [PATCH] wasm: embed scmos display styles/colour maps (fix out-of-source init) The WASM link embeds ${MAGICDIR}/scmos (the build tree) at the VFS sys dir, which out of source holds only the *generated* tech files. A technology's "styles" section (styletype mos) also needs the display styles and colour maps -- scmos ${FILES}: mos.*.dstyle / mos.*.cmap -- which are *source* files absent from the build tree. So magic_wasm_init failed: Couldn't open color map file "mos.7bit.std.cmap" ... minimum.tech ... [styles] ... Cannot load technology "minimum" (In-tree this never showed because build == source. It was also masked until now behind the wasmBinary/INCOMING_MODULE_JS_API abort.) Embed each display file from the source tree into the same VFS dir via $(wildcard), which matches only files that exist -- so a stale/typo'd name in ${FILES} (e.g. the non-existent mos.7bit.mraster_dstyle) can't break the link. Verified on emsdk 6.0.3, both variants: smoke tests now pass 4/4 (notcl) and 5/5 (tcl). Co-Authored-By: Claude Opus 4.8 (1M context) --- toolchains/emscripten/defs.mak | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/toolchains/emscripten/defs.mak b/toolchains/emscripten/defs.mak index daed4da7..60cd86f6 100644 --- a/toolchains/emscripten/defs.mak +++ b/toolchains/emscripten/defs.mak @@ -59,3 +59,14 @@ TOP_EXTRA_LIBS += \ --embed-file ${MAGICDIR}/scmos@/magic/sys/current \ --embed-file ${MAGICSRC}/windows/windows7.glyphs@/magic/sys/windows7.glyphs \ --embed-file ${MAGICSRC}/windows/windows7.glyphs@/magic/sys/bw.glyphs + +# The ${MAGICDIR}/scmos dir embed above supplies the *generated* tech files, but a +# technology's "styles" section also needs the display styles + colour maps +# (scmos ${FILES}: mos.*.dstyle / mos.*.cmap). Those are *source* files, so out +# of source they are not in the build tree and the embed misses them -- init then +# fails with "Couldn't open color map file mos.7bit.std.cmap" / "Cannot load +# technology". Embed each from the source tree into the same VFS dir. $(wildcard) +# matches only files that exist, so a stale/typo'd name in ${FILES} (e.g. the +# non-existent mos.7bit.mraster_dstyle) can never break the link. +SCMOS_DISPLAY := $(wildcard ${MAGICSRC}/scmos/mos.*.dstyle ${MAGICSRC}/scmos/mos.*.cmap) +TOP_EXTRA_LIBS += $(foreach f,$(SCMOS_DISPLAY),--embed-file $(f)@/magic/sys/current/$(notdir $(f)))