magic/tcltk
Enno Schnackenberg 6b3b2f5162 Add TCL-embedded WASM build variant alongside the existing non-TCL build
Bump VERSION to 8.3.645.

magic.wasm can now be built as two variants packaged in the same npm
release: notcl/ (legacy, magic's own parser) and tcl/ (intubun/tcl 9.x
statically linked, commands evaluated by Tcl_EvalEx). The TCL fork is
pinned via npm/tcl.ref and cloned/built by magic itself — the tcl/
checkout is treated as read-only and built out-of-source into
magic/build-tcl-wasm/.

Configure layer:
- New usingTk variable decoupled from usingTcl in scripts/configure.in
  + scripts/configure, so --with-tcl --without-tk is finally a valid
  combination. Native Linux Tcl+Tk builds keep their previous behaviour
  (both flags default to enabled).
- When usingTk is empty, configure passes -DMAGIC_NO_TK so the small
  number of remaining Tk callsites in tcltk/tclmagic.{h,c} compile out,
  and TKCOMMON_SRCS / USE_TK_STUBS are omitted from the link.

WASM build orchestration:
- toolchains/emscripten/build-tcl-wasm.sh builds libtcl9.x.a + libtclstub.a
  + tclConfig.sh out-of-source from a pristine intubun/tcl checkout.
- npm/build.sh grew a --variant=<tcl|notcl|both> flag and writes its
  outputs into npm/tcl/ and npm/notcl/. It also clones intubun/tcl with
  autocrlf=false at the SHA pinned by npm/tcl.ref.
- magic/Makefile (WASM block only): magicWasm.o is now compiled with
  DFLAGS_NOSTUB so Tcl_CreateInterp resolves to libtcl9.x directly
  before tclStubsPtr is set. magic.js link pulls in LIB_SPECS_NOSTUB
  and -ltclstub. After rules.mak include, magic: is a phony alias for
  magic.js so the generic ${MODULE} recipe doesn't fight it.
- toolchains/emscripten/defs.mak: add -sUSE_ZLIB=1 (libtcl9 references
  zlib), replace -sSTACK_SIZE=N with -Wl,-z,stack-size=N (emcc >=5
  rejects the setting form).
- magic/magicWasm.c bootstraps the embedded interp under MAGIC_WRAPPER
  (Tcl_CreateInterp -> Tcl_Init -> Tclmagic_Init) and routes
  run_command through Tcl_EvalEx.
- magic/magicTop.c: gate MagicVersion/Revision/CompileTime on
  !MAGIC_WRAPPER so they don't collide with the copies in
  tcltk/tclmagic.c when both objects land in the same wasm binary.

npm package:
- Subpath exports: ".", "./tcl", "./notcl". Default import keeps the
  pre-existing non-TCL behaviour for backward compatibility.
- examples/smoke-tcl.mjs exercises the TCL variant.

CI:
- main-wasm.yml clones intubun/tcl at the pinned ref, builds both
  variants via npm/build.sh --variant=both, runs the existing notcl
  test suite and the new TCL smoke test, and publishes only on a
  v<x.y.z>... git tag. Tag name (minus the leading v) becomes the
  npm version.
2026-05-21 12:42:43 +02:00
..
Makefile Add TCL-embedded WASM build variant alongside the existing non-TCL build 2026-05-21 12:42:43 +02:00
bsitools.tcl Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
cellmgr.tcl Modified the "tag" command to add an optional subcommand "add" or 2025-10-08 17:11:27 -04:00
console.tcl Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
drcmgr.tcl Quick fix to the script use of "units", which needs to expand the 2026-02-24 16:40:07 -05:00
ext2sim.sh.in Allow for bash in locations other than /bin 2023-04-22 14:13:57 -04:00
ext2spice.sh.in Allow for bash in locations other than /bin 2023-04-22 14:13:57 -04:00
libmgr.tcl Modified the "tag" command to add an optional subcommand "add" or 2025-10-08 17:11:27 -04:00
magic.sh.in Allow for bash in locations other than /bin 2023-04-22 14:13:57 -04:00
magic.tcl.in A few minor changes to message reporting, plus some additional 2025-12-19 09:30:35 -05:00
magicdnull.c Rewrote the configuration scripts, makefiles, and some initialization 2017-10-13 10:28:07 -04:00
magicexec.c Removed the "macosx" definition from the configuration file, which 2017-10-14 18:42:24 -04:00
mazeroute.tcl Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
readspice.tcl Made a simple but important change to "readspice.tcl" to unexpand 2023-03-08 11:14:22 -05:00
reorderLayers.tcl EDIT: wrapper maketoolbar method refactored into a separate script, with changes to the toolbar. Reorder layers functionality added as well 2023-12-15 15:54:05 -05:00
socketcmd.tcl Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
strip_reflibs.tcl Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
tclmagic.c Add TCL-embedded WASM build variant alongside the existing non-TCL build 2026-05-21 12:42:43 +02:00
tclmagic.h Add TCL-embedded WASM build variant alongside the existing non-TCL build 2026-05-21 12:42:43 +02:00
techbuilder.tcl Create techbuilder.tcl 2021-08-28 12:58:58 -04:00
texthelper.tcl Solved three issues: 2026-04-01 21:17:54 -04:00
tkcon.tcl Handled the case in which environment variable HOME is not set. 2026-05-13 08:51:16 -04:00
tkshell.tcl Initial commit at Tue Apr 25 08:41:48 EDT 2017 by tim on stravinsky 2017-04-25 08:41:48 -04:00
toolbar.tcl Finally got around to restoring the behavior of the toolbar with 2024-10-01 16:01:28 -04:00
toolkit.tcl Ensure all cells are loaded into memory in netlist_to_spice to avoid file corruption during save 2026-05-06 11:37:52 -04:00
toolkit_rev0.tcl Updates from running the fix-ending-whitespace script. 2020-05-23 17:13:14 -04:00
tools.tcl Fixed issues with the "macro" command that have existed since the 2026-04-13 12:26:42 -04:00
wrapper.tcl Ensure layer name compatibility in wrapper.tcl 2026-05-06 11:43:32 -04:00