mirror of
https://github.com/RTimothyEdwards/magic.git
synced 2026-09-08 03:41:33 +02:00
build: add run_magic*.sh launchers to run magic from the build tree
Four configure-generated launch scripts let you run magic straight from the
build directory without `make install`:
* run_magic.sh -- GUI magic (Cairo/X11)
* run_magicnull.sh -- batch / no-GUI (-dnull)
* run_magic_gdb.sh -- magic under gdb
* run_magic_valgrind.sh -- magic under valgrind
magic resolves its runtime files through a single $CAD_ROOT root
($CAD_ROOT/magic/{sys,tcl}), but in the build tree they are scattered across
build/ (generated tech, .magicrc, magic.tcl, tclmagic, execs) and source/
(colormaps, dstyles, glyphs, fonts, tcl scripts). On first run each launcher
self-stages ${builddir}/CAD_DIR as a symlink tree in that layout (no copies,
always current) via the shared scripts/magic_run_common.sh, exports
CAD_ROOT=${builddir}/CAD_DIR, and execs the right binary. This pairs with the
preceding commit that made the C launchers honor CAD_ROOT.
magic_stage() is idempotent and re-runs on every launch. Most staged entries
are files, but the bitmaps entry links a *directory*, so it uses `ln -sfn`
(--no-dereference; also accepted by BSD ln): a plain `ln -sf` would, on a second
run, dereference the existing symlink-to-directory and drop the new link *inside*
the target -- a magic/bitmaps/bitmaps self-loop in the source tree that trips up
find/tar/cp -r.
Verified: ./run_magicnull.sh self-stages (30 sys + 24 tcl symlinks) and runs --
`tech load scmos` reports 13 planes -- straight from the build dir. gitignore
covers the generated scripts and the CAD_DIR tree.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
committed by
R. Timothy Edwards
co-authored by
Claude Opus 4.8
parent
aab3361858
commit
201b27e4e9
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Launch magic in batch / no-GUI mode (-dnull) straight 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
|
||||
set -eu
|
||||
here="$(cd "$(dirname "$0")" && pwd)"
|
||||
. "$here/magic_run_common.sh"
|
||||
|
||||
magic_require_built
|
||||
magic_stage
|
||||
|
||||
exec "$MAGIC_TCL/magicdnull" -dnull -nowrapper "$@"
|
||||
Reference in New Issue
Block a user