Updated configure to add both m4 and python3, then corrected the

python preprocessor script to execute "env python3" instead of
the hard-coded non-existent directory that was on the shebang
line.
This commit is contained in:
Tim Edwards 2017-08-24 16:51:45 -04:00
parent 9de99f8e1c
commit a55adf128f
15 changed files with 3781 additions and 372 deletions

1236
database/database.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -50,7 +50,7 @@ AR = ar
ARFLAGS = crv
LINK = ld -r
LD = /bin/ld
M4 = @M4@
M4 = /bin/m4
RANLIB = ranlib
SHDLIB_EXT = .so
LDDL_FLAGS = ${LDFLAGS} -shared -Wl,-soname,$@ -Wl,--version-script=${MAGICDIR}/magic/symbol.map
@ -59,14 +59,14 @@ LIB_SPECS = -L/usr/lib64 -ltk8.6 -L/usr/lib64 -ltcl8.6
WISH_EXE = /usr/bin/wish
TCL_LIB_DIR = /usr/lib
MAGIC_VERSION = 8.2
MAGIC_REVISION = 13
MAGIC_REVISION = 14
CC = gcc
CPP = /scripts/preproc.py
CXX = g++
CPPFLAGS = -I. -I${MAGICDIR}
DFLAGS = -DCAD_DIR=\"${LIBDIR}\" -DBIN_DIR=\"${BINDIR}\" -DTCL_DIR=\"${TCLDIR}\" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DMAGIC_VERSION=\"8.2\" -DMAGIC_REVISION=\"13\" -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_UNSIGNED_LONG_LONG=8 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_PATHS_H=1 -DHAVE_VA_COPY=1 -DHAVE___VA_COPY=1 -DFILE_LOCKS=1 -DCALMA_MODULE=1 -DCIF_MODULE=1 -DX11_BACKING_STORE=1 -DPLOT_MODULE=1 -DLEF_MODULE=1 -DROUTE_MODULE=1 -DUSE_NEW_MACROS=1 -DVECTOR_FONTS=1 -DHAVE_LIBCAIRO=1 -DMAGIC_WRAPPER=1 -Dlinux=1 -DSYSV=1 -DISC=1 -DNDEBUG -DGCORE=\"/bin/gcore\"
DFLAGS = -DCAD_DIR=\"${LIBDIR}\" -DBIN_DIR=\"${BINDIR}\" -DTCL_DIR=\"${TCLDIR}\" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DMAGIC_VERSION=\"8.2\" -DMAGIC_REVISION=\"14\" -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_UNSIGNED_LONG_LONG=8 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_PATHS_H=1 -DHAVE_VA_COPY=1 -DHAVE___VA_COPY=1 -DFILE_LOCKS=1 -DCALMA_MODULE=1 -DCIF_MODULE=1 -DX11_BACKING_STORE=1 -DPLOT_MODULE=1 -DLEF_MODULE=1 -DROUTE_MODULE=1 -DUSE_NEW_MACROS=1 -DHAVE_LIBGL=1 -DHAVE_LIBGLU=1 -DVECTOR_FONTS=1 -DHAVE_LIBCAIRO=1 -DMAGIC_WRAPPER=1 -DTHREE_D=1 -Dlinux=1 -DSYSV=1 -DISC=1 -DNDEBUG -DGCORE=\"/bin/gcore\"
DFLAGS += -DSHDLIB_EXT=\".so\"
CFLAGS = -g -m64 -fPIC -Wimplicit-int -fPIC
@ -78,9 +78,9 @@ DEPEND_FLAG = -MM
EXEEXT =
GR_CFLAGS =
GR_DFLAGS = -DX11 -DXLIB -DCAIRO -DNDEBUG
GR_LIBS = -lX11 -lcairo -lfontconfig -lfreetype ${X11_LDFLAGS}
GR_SRCS = ${TK_SRCS} ${TOGL_SRCS} ${TKCOMMON_SRCS}
GR_DFLAGS = -DX11 -DXLIB -DOGL -DCAIRO -DNDEBUG
GR_LIBS = -lX11 -lGL -lGLU -lXi -lXmu -lXext -lm -lcairo -lfontconfig -lfreetype -lstdc++ ${X11_LDFLAGS}
GR_SRCS = ${TK_SRCS} ${TOGL_SRCS} ${TOGL_SRCS} ${TKCOMMON_SRCS}
GR_HELPER_SRCS =
GR_HELPER_PROG =

View File

@ -117,6 +117,7 @@ static char *grDisplayTypes[] = {
extern bool x11SetDisplay();
extern bool oglSetDisplay();
extern bool nullSetDisplay();
extern bool cairoSetDisplay();
static bool (*(grInitProcs[]))() = {
#ifdef X11

1564
make.log Normal file

File diff suppressed because it is too large Load Diff

1
readline/readline Symbolic link
View File

@ -0,0 +1 @@
readline-4.3

File diff suppressed because it is too large Load Diff

View File

@ -417,7 +417,7 @@ $config_files
Report bugs to the package provider."
ac_cs_config="'--without-opengl' 'CFLAGS=-g'"
ac_cs_config="'CFLAGS=-g'"
ac_cs_version="\
config.status
configured by ./configure, generated by GNU Autoconf 2.69,
@ -496,7 +496,7 @@ if $ac_cs_silent; then
fi
if $ac_cs_recheck; then
set X /bin/sh './configure' '--without-opengl' 'CFLAGS=-g' $ac_configure_extra_args --no-create --no-recursion
set X /bin/sh './configure' 'CFLAGS=-g' $ac_configure_extra_args --no-create --no-recursion
shift
$as_echo "running CONFIG_SHELL=/bin/sh $*" >&6
CONFIG_SHELL='/bin/sh'
@ -588,15 +588,15 @@ S["INSTALL_TARGET"]="install-tcl"
S["ALL_TARGET"]="tcl"
S["OA_LIBS"]=""
S["OA"]=""
S["MAGIC_REVISION"]="13"
S["MAGIC_REVISION"]="14"
S["MAGIC_VERSION"]="8.2"
S["LD_RUN_PATH"]=""
S["SHLIB_CFLAGS"]="-Wimplicit-int -fPIC"
S["DEPEND_FLAG"]="-MM"
S["gr_hprog"]=""
S["gr_hsrcs"]=""
S["gr_srcs"]=" ${TK_SRCS} ${TOGL_SRCS} ${TKCOMMON_SRCS}"
S["gr_dflags"]=" -DX11 -DXLIB -DCAIRO"
S["gr_srcs"]=" ${TK_SRCS} ${TOGL_SRCS} ${TOGL_SRCS} ${TKCOMMON_SRCS}"
S["gr_dflags"]=" -DX11 -DXLIB -DOGL -DCAIRO"
S["gr_cflags"]=""
S["rl_libs"]=""
S["rl_defs"]=""
@ -614,7 +614,7 @@ S["extra_libs"]=" ${MAGICDIR}/ext2sim/libext2sim.o ${MAGICDIR}/ext2spice/libext2
"ter/librouter.o ${MAGICDIR}/irouter/libirouter.o ${MAGICDIR}/grouter/libgrouter.o ${MAGICDIR}/gcr/libgcr.o ${MAGICDIR}/tcltk/libtcltk.o"
S["SCRIPTS"]=""
S["PACKAGE"]="magic"
S["gr_libs"]=" -lX11 -lcairo -lfontconfig -lfreetype"
S["gr_libs"]=" -lX11 -lGL -lGLU -lXi -lXmu -lXext -lm -lcairo -lfontconfig -lfreetype -lstdc++"
S["TCL_LIB_DIR"]="/usr/lib"
S["TCLSH_EXE"]="/usr/bin/tclsh"
S["WISH_EXE"]="/usr/bin/wish"
@ -636,6 +636,7 @@ S["GCORE"]="/bin/gcore"
S["EGREP"]="/bin/grep -E"
S["GREP"]="/bin/grep"
S["PYTHON3"]="/bin/python3"
S["M4"]="/bin/m4"
S["RANLIB"]="ranlib"
S["INSTALL_DATA"]="${INSTALL} -m 644"
S["INSTALL_SCRIPT"]="${INSTALL}"
@ -666,16 +667,16 @@ S["build"]="x86_64-unknown-linux-gnu"
S["target_alias"]=""
S["host_alias"]=""
S["build_alias"]=""
S["LIBS"]="-lcairo "
S["LIBS"]="-lcairo -lGLU -lGL "
S["ECHO_T"]=""
S["ECHO_N"]="-n"
S["ECHO_C"]=""
S["DEFS"]="-DPACKAGE_NAME=\\\"\\\" -DPACKAGE_TARNAME=\\\"\\\" -DPACKAGE_VERSION=\\\"\\\" -DPACKAGE_STRING=\\\"\\\" -DPACKAGE_BUGREPORT=\\\"\\\" -DPACKAGE_URL=\\\"\\\" -DMAGIC_VERSION="\
"\\\"8.2\\\" -DMAGIC_REVISION=\\\"13\\\" -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -D"\
"\\\"8.2\\\" -DMAGIC_REVISION=\\\"14\\\" -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -D"\
"HAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_UNSIGNED_LONG_LONG"\
"=8 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_PATHS_H=1 -DHAVE_VA_COPY=1 -DHAVE___VA_COPY=1 -DFI"\
"LE_LOCKS=1 -DCALMA_MODULE=1 -DCIF_MODULE=1 -DX11_BACKING_STORE=1 -DPLOT_MODULE=1 -DLEF_MODULE=1 -DROUTE_MODULE=1 -DUSE_NEW_MACROS=1 -DVECTOR_FONTS=1"\
" -DHAVE_LIBCAIRO=1 -DMAGIC_WRAPPER=1 -Dlinux=1 -DSYSV=1 -DISC=1"
"LE_LOCKS=1 -DCALMA_MODULE=1 -DCIF_MODULE=1 -DX11_BACKING_STORE=1 -DPLOT_MODULE=1 -DLEF_MODULE=1 -DROUTE_MODULE=1 -DUSE_NEW_MACROS=1 -DHAVE_LIBGL=1 -"\
"DHAVE_LIBGLU=1 -DVECTOR_FONTS=1 -DHAVE_LIBCAIRO=1 -DMAGIC_WRAPPER=1 -DTHREE_D=1 -Dlinux=1 -DSYSV=1 -DISC=1"
S["mandir"]="${datarootdir}/man"
S["localedir"]="${datarootdir}/locale"
S["libdir"]="${exec_prefix}/lib"

51
scripts/configure vendored
View File

@ -672,6 +672,7 @@ GCORE
EGREP
GREP
PYTHON3
M4
RANLIB
INSTALL_DATA
INSTALL_SCRIPT
@ -4028,6 +4029,56 @@ else
fi
for ac_prog in gm4 gnum4 m4
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_M4+:} false; then :
$as_echo_n "(cached) " >&6
else
case $M4 in
[\\/]* | ?:[\\/]*)
ac_cv_path_M4="$M4" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_M4="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
M4=$ac_cv_path_M4
if test -n "$M4"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $M4" >&5
$as_echo "$M4" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$M4" && break
done
test -n "$M4" || M4="no"
if test x$M4 = xno; then
as_fn_error $? "M4 is required" "$LINENO" 5
fi
# Extract the first word of "python3", so it can be a program name with args.
set dummy python3; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5

View File

@ -28,6 +28,12 @@ AC_ISC_POSIX
AC_PROG_INSTALL
AC_PROG_RANLIB
dnl GNU M4 is preferred due to some of the option switches.
AC_PATH_PROGS([M4], [gm4 gnum4 m4], [no])
if test x$M4 = xno; then
AC_MSG_ERROR([M4 is required])
fi
dnl Python3 is preferred for running the preprocessor script
dnl but CPP can be used instead.
AC_PATH_PROG([PYTHON3], [python3], [no])

View File

@ -50,7 +50,7 @@ AR = ar
ARFLAGS = crv
LINK = ld -r
LD = /bin/ld
M4 = @M4@
M4 = /bin/m4
RANLIB = ranlib
SHDLIB_EXT = .so
LDDL_FLAGS = ${LDFLAGS} -shared -Wl,-soname,$@ -Wl,--version-script=${MAGICDIR}/magic/symbol.map
@ -59,14 +59,14 @@ LIB_SPECS = -L/usr/lib64 -ltk8.6 -L/usr/lib64 -ltcl8.6
WISH_EXE = /usr/bin/wish
TCL_LIB_DIR = /usr/lib
MAGIC_VERSION = 8.2
MAGIC_REVISION = 13
MAGIC_REVISION = 14
CC = gcc
CPP = /scripts/preproc.py
CXX = g++
CPPFLAGS = -I. -I${MAGICDIR}
DFLAGS = -DCAD_DIR=\"${LIBDIR}\" -DBIN_DIR=\"${BINDIR}\" -DTCL_DIR=\"${TCLDIR}\" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DMAGIC_VERSION=\"8.2\" -DMAGIC_REVISION=\"13\" -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_UNSIGNED_LONG_LONG=8 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_PATHS_H=1 -DHAVE_VA_COPY=1 -DHAVE___VA_COPY=1 -DFILE_LOCKS=1 -DCALMA_MODULE=1 -DCIF_MODULE=1 -DX11_BACKING_STORE=1 -DPLOT_MODULE=1 -DLEF_MODULE=1 -DROUTE_MODULE=1 -DUSE_NEW_MACROS=1 -DVECTOR_FONTS=1 -DHAVE_LIBCAIRO=1 -DMAGIC_WRAPPER=1 -Dlinux=1 -DSYSV=1 -DISC=1 -DNDEBUG -DGCORE=\"/bin/gcore\"
DFLAGS = -DCAD_DIR=\"${LIBDIR}\" -DBIN_DIR=\"${BINDIR}\" -DTCL_DIR=\"${TCLDIR}\" -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DMAGIC_VERSION=\"8.2\" -DMAGIC_REVISION=\"14\" -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_UNSIGNED_LONG_LONG=8 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DHAVE_SYS_MMAN_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_PATHS_H=1 -DHAVE_VA_COPY=1 -DHAVE___VA_COPY=1 -DFILE_LOCKS=1 -DCALMA_MODULE=1 -DCIF_MODULE=1 -DX11_BACKING_STORE=1 -DPLOT_MODULE=1 -DLEF_MODULE=1 -DROUTE_MODULE=1 -DUSE_NEW_MACROS=1 -DHAVE_LIBGL=1 -DHAVE_LIBGLU=1 -DVECTOR_FONTS=1 -DHAVE_LIBCAIRO=1 -DMAGIC_WRAPPER=1 -DTHREE_D=1 -Dlinux=1 -DSYSV=1 -DISC=1 -DNDEBUG -DGCORE=\"/bin/gcore\"
DFLAGS += -DSHDLIB_EXT=\".so\"
CFLAGS = -g -m64 -fPIC -Wimplicit-int -fPIC
@ -78,9 +78,9 @@ DEPEND_FLAG = -MM
EXEEXT =
GR_CFLAGS =
GR_DFLAGS = -DX11 -DXLIB -DCAIRO -DNDEBUG
GR_LIBS = -lX11 -lcairo -lfontconfig -lfreetype ${X11_LDFLAGS}
GR_SRCS = ${TK_SRCS} ${TOGL_SRCS} ${TKCOMMON_SRCS}
GR_DFLAGS = -DX11 -DXLIB -DOGL -DCAIRO -DNDEBUG
GR_LIBS = -lX11 -lGL -lGLU -lXi -lXmu -lXext -lm -lcairo -lfontconfig -lfreetype -lstdc++ ${X11_LDFLAGS}
GR_SRCS = ${TK_SRCS} ${TOGL_SRCS} ${TOGL_SRCS} ${TKCOMMON_SRCS}
GR_HELPER_SRCS =
GR_HELPER_PROG =

View File

@ -1,4 +1,4 @@
#!/ef/efabless/opengalaxy/venv/bin/python3
#!/bin/env python3
#--------------------------------------------------------------------
#
# preproc.py

64
tcltk/magic.sh Normal file
View File

@ -0,0 +1,64 @@
#!/bin/bash
#
# For installation, put this file (magic.sh) in a known executable path.
# Put startup script "magic.tcl", shared library "tclmagic.so", and
# "wish" replacement "magicexec" in ${CAD_ROOT}/magic/tcl/.
#
# This script starts magic under the Tcl interpreter,
# reading commands from a special startup script which
# launches magic and retains the Tcl interactive interpreter.
# Parse for the argument "-c[onsole]". If it exists, run magic
# with the TkCon console. Strip this argument from the argument list.
TKCON=true
DNULL=
MAGIC_WISH=/usr/bin/wish
export MAGIC_WISH
# Hacks for Cygwin
if [ "`uname | cut -d_ -f1`" = "CYGWIN" ]; then
export PATH="$PATH:/usr/lib"
export DISPLAY=${DISPLAY:=":0"}
fi
# Preserve quotes in arguments
arglist=''
for i in "$@" ; do
case $i in
-noc*) TKCON=;;
-dnull) DNULL=true;;
--version) TKCON=; DNULL=true;;
--prefix) TKCON=; DNULL=true;;
*) arglist="$arglist${arglist:+ }\"${i//\"/\\\"}\"";;
esac
done
if [ $TKCON ]; then
if [ $DNULL ]; then
exec /usr/local/lib/magic/tcl/tkcon.tcl -eval "source /usr/local/lib/magic/tcl/console.tcl" \
-slave "set argc $#; set argv [list $*]; source /usr/local/lib/magic/tcl/magic.tcl"
else
exec /usr/local/lib/magic/tcl/tkcon.tcl -eval "source /usr/local/lib/magic/tcl/console.tcl" \
-slave "package require Tk; set argc $#; set argv [list $arglist]; \
source /usr/local/lib/magic/tcl/magic.tcl"
fi
else
#
# Run the stand-in for wish (magicexec), which acts exactly like "wish"
# except that it replaces ~/.wishrc with magic.tcl. This executable is
# *only* needed when running without the console; the console itself is
# capable of sourcing the startup script.
#
# With option "-dnull" we set up for operation without Tk (simple interpreter
# only, efficient for running in batch mode).
#
if [ $DNULL ]; then
exec /usr/local/lib/magic/tcl/magicdnull -nowrapper "$@"
else
exec /usr/local/lib/magic/tcl/magicexec -- "$@"
fi
fi

406
tcltk/magic.tcl Normal file
View File

@ -0,0 +1,406 @@
# Wishrc startup for ToolScript (magic)
#
# For installation: Put this file and also magicwrap.so into
# directory /usr/local/lib/magic/tcl, and set the "load" line below
# to point to the location of magicwrap.so. Also see comments
# in shell script "magic.sh".
global Opts
# If we called magic via the non-console script, then we want to reset
# the environment variable HOME to its original value.
if {${tcl_version} >= 8.6} {
load -lazy /usr/local/lib/magic/tcl/tclmagic.so
} else {
load /usr/local/lib/magic/tcl/tclmagic.so
}
# It is important to make sure no magic commands overlap with Tcl built-in
# commands, because otherwise the namespace import will fail.
proc pushnamespace { name } {
set y [namespace eval ${name} info commands ::${name}::*]
set z [info commands]
# Watch especially for magic "wizard" commands, as we don't want to confuse
# the literal "*" with a regular expression *. "regsub" below takes care of it.
foreach v $y {
regsub -all {\*} $v {\\*} i
set x [namespace tail $i]
if {[lsearch $z $x] < 0} {
namespace import $i
}
}
}
proc popnamespace { name } {
set z [info commands]
set l [expr [string length ${name}] + 5]
while {[set v [lsearch $z ${name}_tcl_*]] >= 0} {
set y [lindex $z $v]
set w [string range $y $l end]
interp alias {} ::$w {}
rename ::$y ::$w
puts "Info: replacing ::$w with ::$y"
}
namespace forget ::${name}::*
}
#----------------------------------------------------------------------
# Define the drcstate procedure expected by the background DRC code.
proc magic::drcstate {option} {
# (Null proc---see wrapper.tcl for a useful version)
}
#-----------------------------------------------------------------
# Define these console routines so that they don't produce errors
# when Magic is run in batch mode
if {[catch {tkcon title}]} {
proc magic::suspendout {} {}
proc magic::resumeout {} {}
proc magic::dialog {} {}
proc magic::consolegeometry {} {}
proc magic::consolefocus {} {}
}
#----------------------------------------------------------------------
# Cross-Application section
#----------------------------------------------------------------------
# Check namespaces for existence of other applications
set UsingIRSIM 0
set UsingXCircuit 0
set UsingNetgen 0
set nlist [namespace children]
foreach i $nlist {
switch $i {
::irsim { set UsingIRSIM 1 }
::xcircuit { set UsingXCircuit 1 }
::netgen { set UsingNetgen 1 }
}
}
# Setup IRSIM assuming that the Tcl version is installed.
# We do not need to rename procedure irsim to NULL because it is
# redefined in a script, which simply overwrites the original.
proc irsim { args } {
global CAD_ROOT
set irsimscript [glob -nocomplain ${CAD_ROOT}/irsim/tcl/irsim.tcl]
if { ${irsimscript} == {} } {
puts stderr "\"irsim\" requires Tcl-based IRSIM version 9.6 or newer."
puts stderr "Could not find script \"irsim.tcl\". If IRSIM is installed in a"
puts stderr "place other than CAD_ROOT (=${CAD_ROOT}), use the command"
puts stderr "\"source <path>/irsim.tcl\" before doing \"irsim\"."
} else {
source $irsimscript
eval {irsim} $args
}
}
# Setup Xcircuit assuming that the Tcl version is installed.
proc xcircuit { args } {
global CAD_ROOT
global argc
global argv
set xcircscript [glob -nocomplain ${CAD_ROOT}/xcircuit*/xcircuit.tcl]
if { ${xcircscript} == {} } {
puts stderr "\"xcircuit\" requires Tcl-based XCircuit version 3.1 or newer."
puts stderr "Could not find script \"xcircuit.tcl\". If XCircuit is installed in a"
puts stderr "place other than CAD_ROOT (=${CAD_ROOT}), use the command"
puts stderr "\"source <path>/xcircuit.tcl\"."
} else {
# if there are multiple installed versions, choose the highest version.
if {[llength $xcircscript] > 1} {
set xcircscript [lindex [lsort -decreasing -dictionary $xcircscript] 0]
}
# execute script in the scope of magic, because its variable space is
# not modularized.
set argv $args
set argc [llength $args]
uplevel #0 source $xcircscript
}
}
# Setup Netgen assuming that the Tcl version is installed.
proc netgen { args } {
global CAD_ROOT
global argc
global argv
set netgenscript [glob -nocomplain ${CAD_ROOT}/netgen/tcl/netgen.tcl]
if { ${netgenscript} == {} } {
puts stderr "\"netgen\" requires Tcl-based Netgen version 1.2 or newer."
puts stderr "Could not find script \"netgen.tcl\". If Netgen is installed in a"
puts stderr "place other than CAD_ROOT (=${CAD_ROOT}), use the command"
puts stderr "\"source <path>/netgen.tcl\"."
} else {
set argv $args
set argc [llength $args]
uplevel #0 source $netgenscript
}
}
# Add the "echo" command
proc echo {args} {
puts stdout $args
}
# Parse argument list for "-c[onsole]" and "-now[rapper]".
set celllist {}
set do_wrapper true
set do_recover false
set argafter {magic::initialize}
set x {}
for {set i 0} {$i < $argc} {incr i 1} {
set x [lindex $argv $i]
#
# Command-line argument handling goes here
# We have to handle all of magic's command line arguments so we can
# figure out if a cell has been named for preloading.
#
switch -regexp -- $x {
^-now(rap)?(per)?$ { ;# This regexp accepts -now, -nowrap, and -nowrapper
set do_wrapper false
}
^-dnull {
set do_wrapper false
lappend argafter $x
}
^-r(e)?(cover)?$ {
set do_recover true
}
^-rc(file)?$ {
lappend argafter $x
incr i 1
lappend argafter [lindex $argv $i]
}
^-d -
^-g -
^-m -
^-i -
^-T {
lappend argafter $x
incr i 1
lappend argafter [lindex $argv $i]
}
^-F {
lappend argafter $x
incr i 1
lappend argafter [lindex $argv $i]
incr i 1
lappend argafter [lindex $argv $i]
}
^--version {
puts stdout "8.2.14"
exit 0
}
^--prefix {
puts stdout $CAD_ROOT
exit 0
}
^-D -
^-n* {
lappend argafter $x
}
default {
lappend celllist $x
lappend argafter $x
}
}
}
if {$do_wrapper} {
source ${CAD_ROOT}/magic/tcl/wrapper.tcl
lappend argafter "-nowindow" ;# Set no-initial-window option in magic.
}
unset x i do_wrapper
if {[catch {eval $argafter}]} { ;# magic::initialize ${argv}
exit 1
}
#----------------------------------------------------------------------
# Check for presence of padlist manager script and include it
if {[file exists ${CAD_ROOT}/magic/tcl/padlist.tcl]} {
source ${CAD_ROOT}/magic/tcl/padlist.tcl
set Opts(padlist) 0
}
#----------------------------------------------------------------------
# Check for presence of the miscellaneous tools script and include it
if {[file exists ${CAD_ROOT}/magic/tcl/tools.tcl]} {
source ${CAD_ROOT}/magic/tcl/tools.tcl
set Opts(tools) 0
}
#----------------------------------------------------------------------
# Check for presence of the mazerouter script and include it
if {[file exists ${CAD_ROOT}/magic/tcl/mazeroute.tcl]} {
source ${CAD_ROOT}/magic/tcl/mazeroute.tcl
set Opts(mazeroute) 0
}
#----------------------------------------------------------------------
# Check for presence of the toolkit script and include it
# NOTE: This supercedes the older toolkit which is now
# named toolkit_rev0.tcl, and the intermediate bsitools.tcl,
# which are folded into the newer toolkit.tcl.
if {[file exists ${CAD_ROOT}/magic/tcl/toolkit.tcl]} {
source ${CAD_ROOT}/magic/tcl/toolkit.tcl
set Opts(toolkit) 0
}
#----------------------------------------------------------------------
# Magic start function drops back to interpreter after initialization & setup
set auto_noexec 1 ;# don't EVER call UNIX commands w/o "shell" in front
# Have we called magic from tkcon or a clone thereof? If so, set MagicConsole
if {[lsearch [interp aliases] tkcon] != -1} {
set MagicConsole tkcon
catch {wm withdraw .}
# Get rid of some overlapping tkcon commands which are not needed.
if {[lsearch [info commands] orig_edit] < 0} {rename edit orig_edit}
if {[lsearch [info commands] orig_dump] < 0} {rename dump orig_dump}
if {[lsearch [info commands] orig_what] < 0} {rename what orig_what}
} else {
rename unknown tcl_unknown
proc unknown { args } {
# CAD tools special:
# Check for commands which were renamed to tcl_(command)
set cmd [lindex $args 0]
if {[lsearch [info commands] tcl_$cmd] >= 0} {
set arglist [concat tcl_$cmd [lrange $args 1 end]]
set ret [catch {eval $arglist} result]
if {$ret == 0} {
return $result
} else {
return -code $ret -errorcode $errorCode $result
}
}
return [eval [concat tcl_unknown $args]]
}
}
# Set up certain commands to act like they do in non-Tcl-based magic;
# These are the commands whose names have been extended so they don't
# conflict with existing Tcl/Tk commands. This renaming & importing
# *requires* the special code in the magic Tcl command dispatcher to
# find and deal with each of these renamed commands!
if {[lsearch [info commands] orig_clock] < 0} {rename clock orig_clock}
if {[lsearch [info commands] tcl_flush] < 0} {rename flush tcl_flush}
if {[lsearch [info commands] tcl_load] < 0} {rename load tcl_load}
if {[lsearch [info commands] tcl_array] < 0} {rename array tcl_array}
if {[lsearch [info commands] tcl_label] < 0} {catch {rename label tcl_label}}
if {[lsearch [info commands] tcl_grid] < 0} {catch {rename grid tcl_grid}}
namespace eval magic namespace export *
pushnamespace magic
#----------------------------------------------------------------------
# Read system startup files (mostly macro definitions)
# Read user startup file, if any
# Load initial cell, if any
magic::startup
if {![catch {set toptitle [wm title .]}]} {
if {[string range $toptitle 0 3] == "wish"} {
wm withdraw .
}
if {[string range $toptitle 0 8] == "magicexec"} {
wm withdraw .
}
unset toptitle
}
# After loading, magic will wander off and do a complete DRC check
# before executing the rest of the script unless we temporarily
# disable the DRC checker.
set drcstate [drc status]
drc off
# Initial window for wrapper, if defined.
# empty string is equivalent to passing NULL cell name.
#
# If a startup file has created a window, then don't make another one.
if {[info commands magic::openwrapper] != {}} {
if {[windownames layout] == {}} {
set winname [magic::openwrapper]
magic::techmanager initall
magic::scrollupdate $winname
foreach cellname $celllist {
set fext [file extension $cellname]
puts stdout "handling file entry $cellname extension $fext"
switch $fext {
.lef -
.LEF {lef read $cellname}
.def -
.DEF {def read $cellname}
.gds -
.GDS -
.gds2 -
.GDS2 -
.gdsii -
.GDSII {gds read $cellname}
.cif -
.CIF {cif read $cellname}
.tcl {source $cellname}
.mag -
"" {magic::load $cellname}
default {puts stderr "don't know how to load file $cellname"}
}
}
}
} else {
# Initial geometry handler for the default window, non-wrapper version
catch {wm geometry .magic1 ${Opts(geometry)}}
}
# Print the technology name and description
puts stdout "Using technology \"[tech name]\", version [lindex [tech version] 0]"
# Set a box, and set the view; if no cell has been loaded, choose a default
# view.
if {![box exists]} {
box 0 0 1 1 ;# create a unit box
}
if {[llength $celllist] > 0} {
view
} else {
view -9 -9 10 10
}
# The Tcl version handles the "-r" on the command line by calling
# command crash recover.
if {$do_recover} {crash recover}
# Unset global TCL variables so they don't conflict with magic nodes.
unset celllist nlist do_recover
if {$drcstate == 1} {
drc on
}
unset drcstate

BIN
tcltk/magicdnull Executable file

Binary file not shown.

BIN
tcltk/magicexec Executable file

Binary file not shown.