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) <noreply@anthropic.com>
This commit is contained in:
Darryl L. Miles 2026-07-23 12:54:36 +00:00 committed by R. Timothy Edwards
parent 752d80ba01
commit 1adce493eb
1 changed files with 11 additions and 0 deletions

View File

@ -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)))