magic/scripts/run_magic.sh.in

37 lines
1.7 KiB
Bash

#!/usr/bin/env bash
#
# run_magic.sh -- launch magic with its GUI straight from the build tree.
# Generated by configure from scripts/run_magic.sh.in.
#
# PURPOSE
# Run the just-built magic *without* `make install`. On first run it stages
# ${builddir}/CAD_DIR (a tree of symlinks into the build and source trees) and
# exports CAD_ROOT so magic finds its tech/glyphs/styles and Tcl runtime there.
# Because it symlinks (never copies), a rebuild is picked up with no re-staging.
#
# USAGE
# ./run_magic.sh [magic-args...] # opens the default graphics device
# ./run_magic.sh -d XR foo.mag # pick a device / load a layout
# ./run_magic.sh -T scmos # start with a given technology
# (needs an X display; for batch/no-GUI use run_magicnull.sh instead.)
#
# This launches the self-contained "magicexec" (a wish replacement linked
# against this build's Tcl/Tk), so it needs no external wish. If magic opens
# its Tk console internally it uses $MAGIC_WISH (see below).
#
# ENVIRONMENT OVERRIDES (all optional; each wins over the baked default)
# CAD_ROOT reuse an alternate runtime tree instead of staging $builddir/CAD_DIR
# MAGIC_WISH wish for the Tk console (default: the configure-matched wish)
# WISH TCLSH wish/tclsh matching this build's Tcl/Tk (--with-tk / --with-tcl)
# MAGIC_BUILDDIR MAGIC_SRCDIR build/source tops (default: baked-in absolutes)
# 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"
magic_require_built
magic_stage
exec "$MAGIC_TCL/magicexec" -- "$@"