author | Claus Gittinger <cg@exept.de> |
Sat, 13 Oct 2018 18:17:08 +0200 | |
changeset 1583 | 825a2629e6d7 |
parent 1326 | e6197baf42c8 |
child 1432 | 1e235b190ee3 |
permissions | -rwxr-xr-x |
151 | 1 |
#!/bin/sh |
2 |
||
3 |
# $Header$ |
|
4 |
# |
|
5 |
# |
|
6 |
# startup script for smalltalk |
|
7 |
# actually, simply calls stx, passing all arguments. |
|
8 |
# |
|
9 |
||
10 |
# In previous versions, smalltalk used to be the executable itself. |
|
11 |
# This lead to problems on systems, where things like LD_LIBRARY_PATH |
|
12 |
# should be set in advance. |
|
13 |
# Now, here is a place to do such things ... |
|
14 |
||
164 | 15 |
# |
192 | 16 |
# -x name specifies an explicit executable |
277 | 17 |
# to avoid executing another stx from some directory along the PATH |
18 |
# (i.e to force use: ./smalltalk -x ./stx) |
|
192 | 19 |
# |
277 | 20 |
# -X name specifies an explicit path to the stx executable |
21 |
# to avoid executing another stx from some directory along the PATH |
|
22 |
# (i.e to force use: ./smalltalk -X .) |
|
341 | 23 |
# [almost the same as above] |
277 | 24 |
# |
25 |
# -ldd show ldd-output (to debug, which libs are loaded) |
|
26 |
# |
|
281 | 27 |
# all other args go to stx & the user classes |
277 | 28 |
# |
29 |
||
30 |
STX=stx |
|
452 | 31 |
STX_BINDIR=. |
439 | 32 |
DEBUGGER= |
33 |
||
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
34 |
|
452 | 35 |
if test -x `dirname $0`/stx; then |
36 |
STX_BINDIR=`dirname $0` |
|
454
e8676bb3d081
Don't do a cd to projects/smalltalk if called with absolute pathname
Stefan Vogel <sv@exept.de>
parents:
452
diff
changeset
|
37 |
STX=$STX_BINDIR/stx |
e8676bb3d081
Don't do a cd to projects/smalltalk if called with absolute pathname
Stefan Vogel <sv@exept.de>
parents:
452
diff
changeset
|
38 |
# cd $STX_BINDIR |
452 | 39 |
fi |
40 |
||
476
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
41 |
if [ "$STX_LIBDIR" != "" ] |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
42 |
then |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
43 |
if [ ! -f $STX_LIBDIR/smalltalk.rc ] |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
44 |
then |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
45 |
echo "smalltalk [warning]: ignore wrong STX_LIBDIR setting" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
46 |
STX_LIBDIR="" |
476
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
47 |
fi |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
48 |
fi |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
49 |
|
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
50 |
|
383 | 51 |
# notice: STXLIBDIR is filled in here by install-sh script |
319 | 52 |
if test -z "$STX_LIBDIR" |
53 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
54 |
bindir=`dirname $0` |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
55 |
case "$bindir" in |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
56 |
/* ) |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
57 |
;; |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
58 |
.* ) |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
59 |
bindir=`( cd $bindir; pwd ) 2> /dev/null` |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
60 |
;; |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
61 |
esac |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
62 |
if [ -d ${bindir}/../lib ] |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
63 |
then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
64 |
STX_LIBDIR=`cd ${bindir}/../lib ; pwd` |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
65 |
fi |
319 | 66 |
fi |
452 | 67 |
|
476
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
68 |
if [ -z "$STX_LIBDIR" ] |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
69 |
then |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
70 |
if [ -d ../lib ] |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
71 |
then |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
72 |
STX_LIBDIR=`cd ../lib ; pwd` |
476
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
73 |
fi |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
74 |
fi |
435 | 75 |
if [ ! -d "$STX_LIBDIR" ] |
383 | 76 |
then |
77 |
if [ -d ../lib ] |
|
78 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
79 |
STX_LIBDIR=`cd ../lib ; pwd` |
383 | 80 |
fi |
81 |
fi |
|
452 | 82 |
|
399 | 83 |
if test -z "$STX_PACKAGEDIR" |
84 |
then |
|
85 |
if [ -d ../packages ] |
|
86 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
87 |
STX_PACKAGEDIR=`cd .. ; pwd` |
434
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
88 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
89 |
if [ -d $STX_LIBDIR/../packages ] |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
90 |
then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
91 |
STX_PACKAGEDIR=`cd $STX_LIBDIR/../packages ; pwd` |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
92 |
else |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
93 |
if [ -f $STX_BINDIR/smalltalk.rc ] |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
94 |
then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
95 |
STX_PACKAGEDIR=`cd $STX_BINDIR/../../.. ; pwd` |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
96 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
97 |
fi |
399 | 98 |
fi |
99 |
fi |
|
452 | 100 |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
101 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
102 |
|
401 | 103 |
if test -z "$STX_TOPDIR" |
104 |
then |
|
105 |
if [ -f ../lib/smalltalk.rc ] |
|
106 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
107 |
STX_TOPDIR=`cd .. ; pwd` |
434
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
108 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
109 |
if [ -f $STX_LIBDIR/../lib/smalltalk.rc ] |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
110 |
then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
111 |
STX_TOPDIR=`cd $STX_LIBDIR/.. ; pwd` |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
112 |
else |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
113 |
if [ -f $STX_BINDIR/smalltalk.rc ] |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
114 |
then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
115 |
STX_TOPDIR=`cd $STX_BINDIR/../.. ; pwd` |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
116 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
117 |
fi |
401 | 118 |
fi |
119 |
fi |
|
383 | 120 |
|
434
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
121 |
# echo STX_LIBDIR is $STX_LIBDIR |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
122 |
# echo STX_TOPDIR is $STX_TOPDIR |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
123 |
# echo STX_PACKAGEDIR is $STX_PACKAGEDIR |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
124 |
|
401 | 125 |
export STX_LIBDIR STX_PACKAGEDIR STX_TOPDIR |
452 | 126 |
|
127 |
# echo STX is $STX |
|
277 | 128 |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
129 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
130 |
if [ "$1" = "--help" ] |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
131 |
then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
132 |
echo " |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
133 |
usage: smalltalk [-x prog] [-X dir] [--ldd] [--gdb] |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
134 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
135 |
args to startup script: |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
136 |
-x prog ................ use prog instead of stx as executable |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
137 |
-X dir ................. use stx from dir instead of default (PATH) |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
138 |
--ldd .................. show which shared libraries are used |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
139 |
--gdb .................. run with gdb-Debugger (type r in debugger to start) |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
140 |
--cgdb ................. run with cgdb-Debugger (type r in debugger to start) |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
141 |
--callgrind ............ run under callgrind profiler tool |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
142 |
--stap SCRIPT .......... run given systemtap script, passing stx command as |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
143 |
stap -c 'stx ...' Systemtap may not be compiled in. |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
144 |
" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
145 |
exec $STX --help |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
146 |
exit 0 |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
147 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
148 |
|
193 | 149 |
if [ "$1" = "-x" ] |
192 | 150 |
then |
151 |
shift |
|
152 |
STX=$1 |
|
153 |
shift |
|
277 | 154 |
fi |
155 |
||
156 |
if [ "$1" = "-X" ] |
|
157 |
then |
|
158 |
shift |
|
159 |
STX=$1/stx |
|
160 |
shift |
|
192 | 161 |
fi |
162 |
||
482 | 163 |
if [ "$1" = "--gdb" ] |
439 | 164 |
then |
165 |
shift |
|
166 |
DEBUGGER=gdb |
|
167 |
fi |
|
168 |
||
1133
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
169 |
if [ "$1" = "--cgdb" ] |
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
170 |
then |
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
171 |
shift |
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
172 |
DEBUGGER=cgdb |
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
173 |
fi |
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
174 |
|
1274
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
175 |
if [ "$1" = "--callgrind" ] |
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
176 |
then |
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
177 |
shift |
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
178 |
DEBUGGER="valgrind --tool=callgrind --instr-atstart=no" |
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
179 |
fi |
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
180 |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
181 |
if [ "$1" = "--stap" ] |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
182 |
then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
183 |
shift |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
184 |
if [ -z "$1" ]; then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
185 |
echo "--stap requires systemtap script to run" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
186 |
exit 1 |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
187 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
188 |
if [ ! -r "$1" ]; then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
189 |
echo "$1 is not a readable systemtap script" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
190 |
echo "--stap requires systemtap script to run" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
191 |
exit 1 |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
192 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
193 |
STAPSCRIPT=$1 |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
194 |
shift |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
195 |
fi |
1274
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
196 |
|
1133
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
197 |
|
482 | 198 |
if [ "$1" = "--ldd" ] |
262 | 199 |
then |
200 |
shift |
|
341 | 201 |
DEBUGLIB=yes |
262 | 202 |
fi |
203 |
||
192 | 204 |
# |
205 |
# |
|
164 | 206 |
# some have Xlibs in /usr/openwin/lib ... |
207 |
# |
|
157 | 208 |
if [ -d /usr/openwin/lib ] |
209 |
then |
|
234
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
210 |
if [ "$LD_LIBRARY_PATH" != "" ] |
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
211 |
then |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
212 |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/openwin/lib:/usr/local/lib/smalltalk/lib |
234
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
213 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
214 |
LD_LIBRARY_PATH=/usr/openwin/lib:/usr/local/lib/smalltalk/lib |
234
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
215 |
fi |
315 | 216 |
if [ "$SHLIB_PATH" != "" ] |
217 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
218 |
SHLIB_PATH=$SHLIB_PATH:/usr/openwin/lib:/usr/local/lib/smalltalk/lib |
315 | 219 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
220 |
SHLIB_PATH=/usr/openwin/lib:/usr/local/lib/smalltalk/lib |
315 | 221 |
fi |
157 | 222 |
else |
234
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
223 |
if [ "$LD_LIBRARY_PATH" != "" ] |
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
224 |
then |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
225 |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/smalltalk/lib |
234
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
226 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
227 |
LD_LIBRARY_PATH=/usr/local/lib/smalltalk/lib |
234
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
228 |
fi |
315 | 229 |
if [ "$SHLIB_PATH" != "" ] |
230 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
231 |
SHLIB_PATH=$SHLIB_PATH:/usr/local/lib/smalltalk/lib |
315 | 232 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
233 |
SHLIB_PATH=/usr/local/lib/smalltalk/lib |
315 | 234 |
fi |
157 | 235 |
fi |
164 | 236 |
|
237 |
# |
|
238 |
# my own libs may be found in STX_LIBDIR/lib |
|
247 | 239 |
# STX_LIBDIR is to be set to the top of the smalltalk installation |
240 |
# (i.e. where all the .rc files are located) |
|
164 | 241 |
# |
242 | 242 |
|
164 | 243 |
if [ "$STX_LIBDIR" != "" ] |
244 |
then |
|
243 | 245 |
if [ "$STX_LIBDIR" != "/usr/local/smalltalk" ] |
246 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
247 |
LD_LIBRARY_PATH=$STX_LIBDIR:$STX_LIBDIR/lib:$LD_LIBRARY_PATH |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
248 |
SHLIB_PATH=$STX_LIBDIR:$STX_LIBDIR/lib:$SHLIB_PATH |
243 | 249 |
fi |
452 | 250 |
else |
251 |
STX_LIBDIR=$STX_BINDIR |
|
252 |
fi |
|
253 |
||
254 |
# |
|
255 |
# and in STX_BINDIR |
|
256 |
# |
|
257 |
||
258 |
if [ "$STX_BINDIR" != "" ] |
|
259 |
then |
|
260 |
if [ "$STX_BINDIR" != "/usr/local/bin" ] |
|
261 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
262 |
LD_LIBRARY_PATH=$STX_BINDIR:$LD_LIBRARY_PATH |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
263 |
SHLIB_PATH=$STX_BINDIR:$SHLIB_PATH |
452 | 264 |
fi |
164 | 265 |
fi |
266 |
||
276 | 267 |
LD_LIBRARY_PATH=.:./lib:$LD_LIBRARY_PATH |
315 | 268 |
SHLIB_PATH=.:./lib:$SHLIB_PATH |
155 | 269 |
export LD_LIBRARY_PATH |
315 | 270 |
export SHLIB_PATH |
247 | 271 |
|
272 |
# |
|
314
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
273 |
# if started via ./smalltalk, prepend . to the PATH |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
274 |
# (to allow test of ./stx even when stx is found along the PATH) |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
275 |
# |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
276 |
case $0 in |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
277 |
./*) |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
278 |
PATH=.:$PATH |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
279 |
export PATH |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
280 |
;; |
314
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
281 |
esac |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
282 |
|
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
283 |
# |
280 | 284 |
# debugging which stx & shared libs are used ... |
247 | 285 |
# |
344 | 286 |
whichOne=`/bin/sh -c "type $STX"` |
341 | 287 |
if [ "$STX" = "stx" ] |
288 |
then |
|
289 |
if [ -f stx ] |
|
290 |
then |
|
291 |
whichOne=`/bin/sh -c "type stx"` |
|
292 |
if [ "$whichOne" != "stx is ./stx" ] |
|
293 |
then |
|
294 |
echo "************* WARNING the executed" $whichOne |
|
295 |
echo "************* (may not be appropriate for used shared libs)" |
|
296 |
echo "************* Try './smalltalk -ldd' for more details" |
|
297 |
echo "************* or force the local stx to be used with" |
|
298 |
echo "************* './smalltalk -x ./stx'" |
|
299 |
echo |
|
300 |
fi |
|
301 |
fi |
|
302 |
fi |
|
303 |
||
280 | 304 |
if [ "$DEBUGLIB" = "yes" ] |
277 | 305 |
then |
344 | 306 |
echo "used " $whichOne |
341 | 307 |
echo "used LD_LIBRARY_PATH is " $LD_LIBRARY_PATH |
308 |
echo "used SHLIB_PATH is " $SHLIB_PATH |
|
309 |
echo "used STX_LIBDIR is " $STX_LIBDIR |
|
310 |
case `uname` in |
|
311 |
HP-UX*) |
|
312 |
chatr $STX |
|
313 |
;; |
|
277 | 314 |
|
341 | 315 |
*) |
316 |
ldd -r $STX |
|
317 |
;; |
|
318 |
esac |
|
262 | 319 |
fi |
247 | 320 |
|
316 | 321 |
# |
322 |
# how did HP mess up things so badly ? |
|
323 |
# It takes a veeeery long time for stx to start |
|
324 |
# (the spinning wheel is shown when stx's main |
|
325 |
# starts to run - all the time in between is |
|
326 |
# spent in the systems loader ...) |
|
327 |
# |
|
449 | 328 |
# if [ "`uname`" = "HP-UX" ] |
329 |
# then |
|
330 |
# echo "Please be patient - hp systems are very slow." |
|
331 |
# fi |
|
316 | 332 |
|
452 | 333 |
PATH=$PATH:$STX_BINDIR |
269 | 334 |
export PATH |
452 | 335 |
# echo PATH is $PATH |
336 |
# echo DISPLAY is $DISPLAY |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
337 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
338 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
339 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
340 |
if [ ! -z "$STAPSCRIPT" ]; then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
341 |
echo "$STX_TOPDIR/stx/hacking/tapset" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
342 |
CMD="$STX $@" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
343 |
echo "$CMD" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
344 |
exec stap --unprivileged $STAPSCRIPT -I "$STX_TOPDIR/hacking/tapset" -c "$CMD" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
345 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
346 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
347 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
348 |
|
439 | 349 |
exec $DEBUGGER $STX ${1+"$@"} |