Reverted about half of pull request #41 because it breaks compatibility
with qflow, which wants to launch applications from symbolic links. The portability of magic now depends only on setting environment variable CAD_ROOT, but the portability should still be ensured.
This commit is contained in:
parent
c66a460053
commit
c0867ef71e
|
|
@ -32,11 +32,6 @@ TCL_FILES = \
|
|||
readspice.tcl \
|
||||
magic.tcl
|
||||
|
||||
TCL_DIR_REL_OR_ABS = $(shell ${MAGICDIR}/tcltk/relpath.sh "$(DESTDIR)${INSTALL_BINDIR}" ${TCLDIR})
|
||||
ifeq ($(TCL_DIR_REL_OR_ABS),)
|
||||
TCL_DIR_REL_OR_ABS = ${TCLDIR}
|
||||
endif
|
||||
|
||||
BIN_FILES = \
|
||||
$(DESTDIR)${INSTALL_BINDIR}/magic.sh \
|
||||
$(DESTDIR)${INSTALL_BINDIR}/ext2spice.sh \
|
||||
|
|
@ -70,16 +65,16 @@ magic.tcl: magic.tcl.in ${MAGICDIR}/defs.mak ${MAGICDIR}/VERSION
|
|||
magic.tcl.in > magic.tcl
|
||||
|
||||
magic.sh: magic.sh.in ${MAGICDIR}/defs.mak
|
||||
sed -e /TCL_DIR_REL_OR_ABS/s%TCL_DIR_REL_OR_ABS%${TCL_DIR_REL_OR_ABS}%g \
|
||||
sed -e /TCL_DIR/s%TCL_DIR%${TCLDIR}%g \
|
||||
-e /TCLLIB_DIR/s%TCLLIB_DIR%${TCL_LIB_DIR}%g \
|
||||
-e /WISH_EXE/s%WISH_EXE%${WISH_EXE}%g magic.sh.in > magic.sh
|
||||
|
||||
ext2spice.sh: ext2spice.sh.in ${MAGICDIR}/defs.mak
|
||||
sed -e /TCL_DIR_REL_OR_ABS/s%TCL_DIR_REL_OR_ABS%${TCL_DIR_REL_OR_ABS}%g \
|
||||
sed -e /TCL_DIR/s%TCL_DIR%${TCLDIR}%g \
|
||||
ext2spice.sh.in > ext2spice.sh
|
||||
|
||||
ext2sim.sh: ext2sim.sh.in ${MAGICDIR}/defs.mak
|
||||
sed -e /TCL_DIR_REL_OR_ABS/s%TCL_DIR_REL_OR_ABS%${TCL_DIR_REL_OR_ABS}%g \
|
||||
sed -e /TCL_DIR/s%TCL_DIR%${TCLDIR}%g \
|
||||
ext2sim.sh.in > ext2sim.sh
|
||||
|
||||
$(DESTDIR)${INSTALL_TCLDIR}/%: %
|
||||
|
|
|
|||
|
|
@ -14,14 +14,12 @@ for i in $@; do
|
|||
*) esargs="$esargs $i" ;;
|
||||
esac
|
||||
done
|
||||
TCL_REL_OR_ABS=TCL_DIR_REL_OR_ABS
|
||||
if [ "${TCL_REL_OR_ABS:0:1}" = "/" ]; then
|
||||
TCL_DIR=$TCL_REL_OR_ABS
|
||||
else
|
||||
TCL_DIR=$(cd $(dirname ${BASH_SOURCE[0]})/$TCL_REL_OR_ABS; pwd -P)
|
||||
TCL_MAG_DIR=${CAD_ROOT}/magic/tcl
|
||||
if [ "${TCL_MAG_DIR}" = "/magic/tcl" ]; then
|
||||
TCL_MAG_DIR=TCL_DIR
|
||||
fi
|
||||
#
|
||||
eval ${TCL_DIR}/magicdnull -dnull -noconsole -nowrapper $mgargs <<EOF
|
||||
eval ${TCL_MAG_DIR}/magicdnull -dnull -noconsole -nowrapper $mgargs <<EOF
|
||||
drc off
|
||||
box 0 0 0 0
|
||||
ext2sim $esargs
|
||||
|
|
|
|||
|
|
@ -14,14 +14,12 @@ for i in $@; do
|
|||
*) esargs="$esargs $i" ;;
|
||||
esac
|
||||
done
|
||||
TCL_REL_OR_ABS=TCL_DIR_REL_OR_ABS
|
||||
if [ "${TCL_REL_OR_ABS:0:1}" = "/" ]; then
|
||||
TCL_DIR=$TCL_REL_OR_ABS
|
||||
else
|
||||
TCL_DIR=$(cd $(dirname ${BASH_SOURCE[0]})/$TCL_REL_OR_ABS; pwd -P)
|
||||
TCL_MAG_DIR=${CAD_ROOT}/magic/tcl
|
||||
if [ "${TCL_MAG_DIR}" = "/magic/tcl" ]; then
|
||||
TCL_MAG_DIR=TCL_DIR
|
||||
fi
|
||||
#
|
||||
eval ${TCL_DIR}/magicdnull -dnull -noconsole -nowrapper $mgargs <<EOF
|
||||
eval ${TCL_MAG_DIR}/magicdnull -dnull -noconsole -nowrapper $mgargs <<EOF
|
||||
drc off
|
||||
box 0 0 0 0
|
||||
ext2spice $esargs
|
||||
|
|
|
|||
|
|
@ -11,11 +11,9 @@
|
|||
# Parse for the argument "-c[onsole]". If it exists, run magic
|
||||
# with the TkCon console. Strip this argument from the argument list.
|
||||
|
||||
TCL_REL_OR_ABS=TCL_DIR_REL_OR_ABS
|
||||
if [ "${TCL_REL_OR_ABS:0:1}" = "/" ]; then
|
||||
TCL_DIR=$TCL_REL_OR_ABS
|
||||
else
|
||||
TCL_DIR=$(cd $(dirname ${BASH_SOURCE[0]})/$TCL_REL_OR_ABS; pwd -P)
|
||||
TCL_MAG_DIR=${CAD_ROOT}/magic/tcl
|
||||
if [ "${TCL_MAG_DIR}" = "/magic/tcl" ]; then
|
||||
TCL_MAG_DIR=TCL_DIR
|
||||
fi
|
||||
TKCON=true
|
||||
DNULL=
|
||||
|
|
@ -43,12 +41,12 @@ done
|
|||
if [ $TKCON ]; then
|
||||
|
||||
if [ $DNULL ]; then
|
||||
exec $TCL_DIR/tkcon.tcl -eval "source $TCL_DIR/console.tcl" \
|
||||
-slave "set argc $#; set argv [list $*]; source $TCL_DIR/magic.tcl"
|
||||
exec $TCL_MAG_DIR/tkcon.tcl -eval "source $TCL_MAG_DIR/console.tcl" \
|
||||
-slave "set argc $#; set argv [list $*]; source $TCL_MAG_DIR/magic.tcl"
|
||||
else
|
||||
exec $TCL_DIR/tkcon.tcl -eval "source $TCL_DIR/console.tcl" \
|
||||
exec $TCL_MAG_DIR/tkcon.tcl -eval "source $TCL_MAG_DIR/console.tcl" \
|
||||
-slave "package require Tk; set argc $#; set argv [list $arglist]; \
|
||||
source $TCL_DIR/magic.tcl"
|
||||
source $TCL_MAG_DIR/magic.tcl"
|
||||
fi
|
||||
|
||||
else
|
||||
|
|
@ -63,8 +61,8 @@ else
|
|||
# only, efficient for running in batch mode).
|
||||
#
|
||||
if [ $DNULL ]; then
|
||||
exec $TCL_DIR/magicdnull -nowrapper "$@"
|
||||
exec $TCL_MAG_DIR/magicdnull -nowrapper "$@"
|
||||
else
|
||||
exec $TCL_DIR/magicexec -- "$@"
|
||||
exec $TCL_MAG_DIR/magicexec -- "$@"
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
#!/bin/bash
|
||||
# From https://stackoverflow.com/questions/2564634/convert-absolute-path-into-relative-path-given-a-current-directory-using-bash
|
||||
# both $1 and $2 are absolute paths beginning with /
|
||||
# returns relative path to $2/$target from $1/$source
|
||||
source=$1
|
||||
target=$2
|
||||
|
||||
common_part=$source # for now
|
||||
result="" # for now
|
||||
|
||||
while [[ "${target#$common_part}" == "${target}" ]]; do
|
||||
# no match, means that candidate common part is not correct
|
||||
# go up one level (reduce common part)
|
||||
common_part="$(dirname $common_part)"
|
||||
# and record that we went back, with correct / handling
|
||||
if [[ -z $result ]]; then
|
||||
result=".."
|
||||
else
|
||||
result="../$result"
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $common_part == "/" ]]; then
|
||||
# special case for root (no common path)
|
||||
result="$result/"
|
||||
fi
|
||||
|
||||
# since we now have identified the common part,
|
||||
# compute the non-common part
|
||||
forward_part="${target#$common_part}"
|
||||
|
||||
# and now stick all parts together
|
||||
if [[ -n $result ]] && [[ -n $forward_part ]]; then
|
||||
result="$result$forward_part"
|
||||
elif [[ -n $forward_part ]]; then
|
||||
# extra slash removal
|
||||
result="${forward_part:1}"
|
||||
fi
|
||||
|
||||
echo $result
|
||||
Loading…
Reference in New Issue