mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-09-08 03:41:33 +02:00
build: document run_magic* launchers, template WISH/TCLSH, validate the env
Expand each run_magic*.sh header to state its purpose, usage, and the full set
of environment overrides. Initialize every knob with ${VAR:-default} so a value
inherited from the environment always wins:
- CAD_ROOT is now overridable (was hardwired to $builddir/CAD_DIR); point it at
a shared/installed tree to skip staging.
- WISH/TCLSH default to the wish/tclsh configure detected for this build's
Tcl/Tk (@WISH_EXE@/@TCLSH_EXE@, matching --with-tk/--with-tcl), so a build
against a non-standard Tcl/Tk automatically uses the correct absolute paths.
MAGIC_WISH (what tkcon.tcl uses for the Tk console) defaults from WISH.
Add magic_check_env(): on source, sanity-check each value (directory / regular
file / executable, as appropriate) and print a non-fatal stderr warning naming
the offending variable and whether it came from the environment or the baked
default -- to make a bad override easy to diagnose. Empty optional values
(e.g. no tclsh configured) and a not-yet-created CAD_ROOT are not flagged.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
committed by
R. Timothy Edwards
co-authored by
Claude Opus 4.8
parent
201b27e4e9
commit
869e99f69e
@@ -1,11 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Launch magic in batch / no-GUI mode (-dnull) straight from the build tree.
|
||||
# run_magicnull.sh -- launch magic in batch / no-GUI mode (-dnull) from the build tree.
|
||||
# Generated by configure from scripts/run_magicnull.sh.in.
|
||||
#
|
||||
# Interactive use sources the Tcl startup (magic.tcl) automatically from CAD_ROOT.
|
||||
# For a non-interactive script piped on stdin, source magic.tcl yourself first:
|
||||
# printf 'source %s/magic.tcl\n<commands>\n' "$CAD_ROOT/magic/tcl" | ./run_magicnull.sh
|
||||
# PURPOSE
|
||||
# Run the just-built magic with the null graphics device -- no X display, fully
|
||||
# scriptable -- without `make install`. Like run_magic.sh it stages
|
||||
# ${builddir}/CAD_DIR (symlinks) on first run and exports CAD_ROOT so magic
|
||||
# finds its sys files and Tcl runtime there. Uses the self-contained
|
||||
# "magicdnull" (no external wish/Tk needed).
|
||||
#
|
||||
# USAGE
|
||||
# ./run_magicnull.sh # interactive Tcl prompt
|
||||
# ./run_magicnull.sh foo.mag # load a layout, batch
|
||||
# Interactive (tty) use sources the Tcl startup (magic.tcl) automatically from
|
||||
# CAD_ROOT. For a non-interactive script piped on stdin, source it yourself:
|
||||
# printf 'source %s/magic.tcl\n<commands>\n' "$CAD_ROOT/magic/tcl" \
|
||||
# | ./run_magicnull.sh
|
||||
#
|
||||
# ENVIRONMENT OVERRIDES (all optional; each wins over the baked default)
|
||||
# CAD_ROOT reuse an alternate runtime tree instead of staging $builddir/CAD_DIR
|
||||
# TCLSH tclsh matching this build's Tcl (--with-tcl); for diagnostics
|
||||
# MAGIC_BUILDDIR MAGIC_SRCDIR build/source tops (default: baked-in absolutes)
|
||||
# (WISH/MAGIC_WISH are irrelevant here -- there is no Tk in -dnull mode.)
|
||||
# Inherited values are sanity-checked; problems print as stderr warnings.
|
||||
# See magic_run_common.sh for the authoritative list and defaults.
|
||||
set -eu
|
||||
here="$(cd "$(dirname "$0")" && pwd)"
|
||||
. "$here/magic_run_common.sh"
|
||||
|
||||
Reference in New Issue
Block a user