author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 27 May 2016 09:11:55 +0100 | |
branch | jv |
changeset 1435 | 9a1f18933e40 |
parent 1432 | 1e235b190ee3 |
child 1445 | 88a4f36a6912 |
permissions | -rwxr-xr-x |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
1 |
#!/bin/bash |
151 | 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 |
||
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
30 |
STX_EXE=stx |
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
31 |
STX_BIN_DIR=$(dirname $0) |
439 | 32 |
DEBUGGER= |
33 |
||
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
34 |
if ! test -f "$STX_BIN_DIR/Make.proto"; then |
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
35 |
# Running in Smalltalk/X jv-branch deployment mode |
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
36 |
VERSION=6.2.5 |
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
37 |
STX_HOME="$STX_BIN_DIR/.." |
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
38 |
STX_TOPDIR="$STX_HOME/lib/smalltalkx/$VERSION" |
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
39 |
STX_LIBDIR="$STX_TOPDIR/lib" |
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
40 |
STX_PACKAGEDIR="$STX_TOPDIR%/packages" |
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
41 |
STX_EXE="$STX_TOPDIR/bin/stx-bin" |
452 | 42 |
fi |
43 |
||
476
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
44 |
if [ "$STX_LIBDIR" != "" ] |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
45 |
then |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
46 |
if [ ! -f $STX_LIBDIR/smalltalk.rc ] |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
47 |
then |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
48 |
echo "smalltalk [warning]: ignore wrong STX_LIBDIR setting ($STX_LIBDIR)" |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
49 |
STX_LIBDIR="" |
476
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
50 |
fi |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
51 |
fi |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
52 |
|
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
53 |
|
383 | 54 |
# notice: STXLIBDIR is filled in here by install-sh script |
319 | 55 |
if test -z "$STX_LIBDIR" |
56 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
57 |
bindir=`dirname $0` |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
58 |
case "$bindir" in |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
59 |
/* ) |
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 |
.* ) |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
62 |
bindir=`( cd $bindir; pwd ) 2> /dev/null` |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
63 |
;; |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
64 |
esac |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
65 |
if [ -d ${bindir}/../lib ] |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
66 |
then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
67 |
STX_LIBDIR=`cd ${bindir}/../lib ; pwd` |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
68 |
fi |
319 | 69 |
fi |
452 | 70 |
|
476
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
71 |
if [ -z "$STX_LIBDIR" ] |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
72 |
then |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
73 |
if [ -d ../lib ] |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
74 |
then |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
75 |
STX_LIBDIR=`cd ../lib ; pwd` |
476
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
76 |
fi |
25c3df1d5c43
ignore invalid STX_LIBDIR setting
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
77 |
fi |
435 | 78 |
if [ ! -d "$STX_LIBDIR" ] |
383 | 79 |
then |
80 |
if [ -d ../lib ] |
|
81 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
82 |
STX_LIBDIR=`cd ../lib ; pwd` |
383 | 83 |
fi |
84 |
fi |
|
452 | 85 |
|
399 | 86 |
if test -z "$STX_PACKAGEDIR" |
87 |
then |
|
88 |
if [ -d ../packages ] |
|
89 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
90 |
STX_PACKAGEDIR=`cd .. ; pwd` |
434
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
91 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
92 |
if [ -d $STX_LIBDIR/../packages ] |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
93 |
then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
94 |
STX_PACKAGEDIR=`cd $STX_LIBDIR/../packages ; pwd` |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
95 |
else |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
96 |
if [ -f $STX_BIN_DIR/smalltalk.rc ] |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
97 |
then |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
98 |
STX_PACKAGEDIR=`cd $STX_BIN_DIR/../../.. ; pwd` |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
99 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
100 |
fi |
399 | 101 |
fi |
102 |
fi |
|
452 | 103 |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
104 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
105 |
|
401 | 106 |
if test -z "$STX_TOPDIR" |
107 |
then |
|
108 |
if [ -f ../lib/smalltalk.rc ] |
|
109 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
110 |
STX_TOPDIR=`cd .. ; pwd` |
434
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
111 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
112 |
if [ -f $STX_LIBDIR/../lib/smalltalk.rc ] |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
113 |
then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
114 |
STX_TOPDIR=`cd $STX_LIBDIR/.. ; pwd` |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
115 |
else |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
116 |
if [ -f $STX_BIN_DIR/smalltalk.rc ] |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
117 |
then |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
118 |
STX_TOPDIR=`cd $STX_BIN_DIR/../.. ; pwd` |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
119 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
120 |
fi |
401 | 121 |
fi |
122 |
fi |
|
383 | 123 |
|
434
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
124 |
# echo STX_LIBDIR is $STX_LIBDIR |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
125 |
# echo STX_TOPDIR is $STX_TOPDIR |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
126 |
# echo STX_PACKAGEDIR is $STX_PACKAGEDIR |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
127 |
|
401 | 128 |
export STX_LIBDIR STX_PACKAGEDIR STX_TOPDIR |
452 | 129 |
|
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
130 |
# echo STX is $STX_EXE |
277 | 131 |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
132 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
133 |
if [ "$1" = "--help" ] |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
134 |
then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
135 |
echo " |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
136 |
usage: $(basename $0) [-x prog] [-X dir] [--ldd] [--gdb] |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
137 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
138 |
args to startup script: |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
139 |
-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
|
140 |
-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
|
141 |
--ldd .................. show which shared libraries are used |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
142 |
--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
|
143 |
--cgdb ................. run with cgdb-Debugger (type r in debugger to start) |
1432
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
144 |
--callgrind ............ run under callgrind profiler tool with profiling off - |
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
145 |
use this to profile some benchmark |
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
146 |
--callgrind-startup .... run under callgrind profiler tool with profiling on |
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
147 |
- use this to profile VM startup |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
148 |
--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
|
149 |
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
|
150 |
" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
151 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
152 |
|
193 | 153 |
if [ "$1" = "-x" ] |
192 | 154 |
then |
155 |
shift |
|
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
156 |
STX_EXE=$1 |
192 | 157 |
shift |
277 | 158 |
fi |
159 |
||
160 |
if [ "$1" = "-X" ] |
|
161 |
then |
|
162 |
shift |
|
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
163 |
STX_EXE=$1/stx |
277 | 164 |
shift |
192 | 165 |
fi |
166 |
||
482 | 167 |
if [ "$1" = "--gdb" ] |
439 | 168 |
then |
169 |
shift |
|
1432
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
170 |
DEBUGGER="gdb --args" |
439 | 171 |
fi |
172 |
||
1133
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
173 |
if [ "$1" = "--cgdb" ] |
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
174 |
then |
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
175 |
shift |
1432
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
176 |
DEBUGGER="cgdb --args" |
1133
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
177 |
fi |
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
178 |
|
1274
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
179 |
if [ "$1" = "--callgrind" ] |
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
180 |
then |
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
181 |
shift |
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
182 |
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
|
183 |
fi |
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
184 |
|
1432
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
185 |
if [ "$1" = "--callgrind-startup" ] |
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
186 |
then |
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
187 |
shift |
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
188 |
DEBUGGER="valgrind --tool=callgrind" |
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
189 |
fi |
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
190 |
|
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
191 |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
192 |
if [ "$1" = "--stap" ] |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
193 |
then |
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 |
if [ -z "$1" ]; then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
196 |
echo "--stap requires systemtap script to run" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
197 |
exit 1 |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
198 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
199 |
if [ ! -r "$1" ]; then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
200 |
echo "$1 is not a readable systemtap script" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
201 |
echo "--stap requires systemtap script to run" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
202 |
exit 1 |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
203 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
204 |
STAPSCRIPT=$1 |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
205 |
shift |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
206 |
fi |
1274
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
207 |
|
1133
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
208 |
|
482 | 209 |
if [ "$1" = "--ldd" ] |
262 | 210 |
then |
211 |
shift |
|
341 | 212 |
DEBUGLIB=yes |
262 | 213 |
fi |
214 |
||
192 | 215 |
# |
216 |
# |
|
164 | 217 |
# some have Xlibs in /usr/openwin/lib ... |
218 |
# |
|
157 | 219 |
if [ -d /usr/openwin/lib ] |
220 |
then |
|
234
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
221 |
if [ "$LD_LIBRARY_PATH" != "" ] |
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
222 |
then |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
223 |
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
|
224 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
225 |
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
|
226 |
fi |
315 | 227 |
if [ "$SHLIB_PATH" != "" ] |
228 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
229 |
SHLIB_PATH=$SHLIB_PATH:/usr/openwin/lib:/usr/local/lib/smalltalk/lib |
315 | 230 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
231 |
SHLIB_PATH=/usr/openwin/lib:/usr/local/lib/smalltalk/lib |
315 | 232 |
fi |
157 | 233 |
else |
234
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
234 |
if [ "$LD_LIBRARY_PATH" != "" ] |
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
235 |
then |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
236 |
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
|
237 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
238 |
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
|
239 |
fi |
315 | 240 |
if [ "$SHLIB_PATH" != "" ] |
241 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
242 |
SHLIB_PATH=$SHLIB_PATH:/usr/local/lib/smalltalk/lib |
315 | 243 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
244 |
SHLIB_PATH=/usr/local/lib/smalltalk/lib |
315 | 245 |
fi |
157 | 246 |
fi |
164 | 247 |
|
248 |
# |
|
249 |
# my own libs may be found in STX_LIBDIR/lib |
|
247 | 250 |
# STX_LIBDIR is to be set to the top of the smalltalk installation |
251 |
# (i.e. where all the .rc files are located) |
|
164 | 252 |
# |
242 | 253 |
|
164 | 254 |
if [ "$STX_LIBDIR" != "" ] |
255 |
then |
|
243 | 256 |
if [ "$STX_LIBDIR" != "/usr/local/smalltalk" ] |
257 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
258 |
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
|
259 |
SHLIB_PATH=$STX_LIBDIR:$STX_LIBDIR/lib:$SHLIB_PATH |
243 | 260 |
fi |
452 | 261 |
else |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
262 |
STX_LIBDIR=$STX_BIN_DIR |
452 | 263 |
fi |
264 |
||
265 |
# |
|
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
266 |
# and in STX_BIN_DIR |
452 | 267 |
# |
268 |
||
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
269 |
if [ "$STX_BIN_DIR" != "" ] |
452 | 270 |
then |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
271 |
if [ "$STX_BIN_DIR" != "/usr/local/bin" ] |
452 | 272 |
then |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
273 |
LD_LIBRARY_PATH=$STX_BIN_DIR:$LD_LIBRARY_PATH |
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
274 |
SHLIB_PATH=$STX_BIN_DIR:$SHLIB_PATH |
452 | 275 |
fi |
164 | 276 |
fi |
277 |
||
276 | 278 |
LD_LIBRARY_PATH=.:./lib:$LD_LIBRARY_PATH |
315 | 279 |
SHLIB_PATH=.:./lib:$SHLIB_PATH |
155 | 280 |
export LD_LIBRARY_PATH |
315 | 281 |
export SHLIB_PATH |
247 | 282 |
|
283 |
# |
|
314
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
284 |
# 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
|
285 |
# (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
|
286 |
# |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
287 |
case $0 in |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
288 |
./*) |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
289 |
PATH=.:$PATH |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
290 |
export PATH |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
291 |
;; |
314
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
292 |
esac |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
293 |
|
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
294 |
# |
280 | 295 |
# debugging which stx & shared libs are used ... |
247 | 296 |
# |
344 | 297 |
whichOne=`/bin/sh -c "type $STX"` |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
298 |
if [ "$STX_EXE" = "stx" ] |
341 | 299 |
then |
300 |
if [ -f stx ] |
|
301 |
then |
|
302 |
whichOne=`/bin/sh -c "type stx"` |
|
303 |
if [ "$whichOne" != "stx is ./stx" ] |
|
304 |
then |
|
305 |
echo "************* WARNING the executed" $whichOne |
|
306 |
echo "************* (may not be appropriate for used shared libs)" |
|
307 |
echo "************* Try './smalltalk -ldd' for more details" |
|
308 |
echo "************* or force the local stx to be used with" |
|
309 |
echo "************* './smalltalk -x ./stx'" |
|
310 |
echo |
|
311 |
fi |
|
312 |
fi |
|
313 |
fi |
|
314 |
||
280 | 315 |
if [ "$DEBUGLIB" = "yes" ] |
277 | 316 |
then |
344 | 317 |
echo "used " $whichOne |
341 | 318 |
echo "used LD_LIBRARY_PATH is " $LD_LIBRARY_PATH |
319 |
echo "used SHLIB_PATH is " $SHLIB_PATH |
|
320 |
echo "used STX_LIBDIR is " $STX_LIBDIR |
|
321 |
case `uname` in |
|
322 |
HP-UX*) |
|
323 |
chatr $STX |
|
324 |
;; |
|
277 | 325 |
|
341 | 326 |
*) |
327 |
ldd -r $STX |
|
328 |
;; |
|
329 |
esac |
|
262 | 330 |
fi |
247 | 331 |
|
316 | 332 |
# |
333 |
# how did HP mess up things so badly ? |
|
334 |
# It takes a veeeery long time for stx to start |
|
335 |
# (the spinning wheel is shown when stx's main |
|
336 |
# starts to run - all the time in between is |
|
337 |
# spent in the systems loader ...) |
|
338 |
# |
|
449 | 339 |
# if [ "`uname`" = "HP-UX" ] |
340 |
# then |
|
341 |
# echo "Please be patient - hp systems are very slow." |
|
342 |
# fi |
|
316 | 343 |
|
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
344 |
PATH=$PATH:$STX_BIN_DIR |
269 | 345 |
export PATH |
452 | 346 |
# echo PATH is $PATH |
347 |
# echo DISPLAY is $DISPLAY |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
348 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
349 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
350 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
351 |
if [ ! -z "$STAPSCRIPT" ]; then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
352 |
echo "$STX_TOPDIR/stx/hacking/tapset" |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
353 |
CMD="$STX_EXE $@" |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
354 |
echo "$CMD" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
355 |
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
|
356 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
357 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
358 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
359 |
|
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
360 |
exec $DEBUGGER $STX_EXE ${1+"$@"} |