author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 30 Jun 2016 17:14:29 +0100 | |
branch | jv |
changeset 1447 | 0b149293564f |
parent 1445 | 88a4f36a6912 |
child 1450 | 58a390b93aa3 |
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 |
|
401 | 86 |
if test -z "$STX_TOPDIR" |
87 |
then |
|
88 |
if [ -f ../lib/smalltalk.rc ] |
|
89 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
90 |
STX_TOPDIR=`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 [ -f $STX_LIBDIR/../lib/smalltalk.rc ] |
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_TOPDIR=`cd $STX_LIBDIR/.. ; 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_TOPDIR=`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 |
401 | 101 |
fi |
102 |
fi |
|
383 | 103 |
|
434
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
104 |
# echo STX_LIBDIR is $STX_LIBDIR |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
105 |
# echo STX_TOPDIR is $STX_TOPDIR |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
106 |
|
1445
88a4f36a6912
Issue #98: Removed use of STX_PACKAGEDIR from startup scripts
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1435
diff
changeset
|
107 |
export STX_LIBDIR STX_TOPDIR |
452 | 108 |
|
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
109 |
# echo STX is $STX_EXE |
277 | 110 |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
111 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
112 |
if [ "$1" = "--help" ] |
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 |
echo " |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
115 |
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
|
116 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
117 |
args to startup script: |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
118 |
-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
|
119 |
-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
|
120 |
--ldd .................. show which shared libraries are used |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
121 |
--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
|
122 |
--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
|
123 |
--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
|
124 |
use this to profile some benchmark |
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
125 |
--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
|
126 |
- use this to profile VM startup |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
127 |
--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
|
128 |
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
|
129 |
" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
130 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
131 |
|
193 | 132 |
if [ "$1" = "-x" ] |
192 | 133 |
then |
134 |
shift |
|
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
135 |
STX_EXE=$1 |
192 | 136 |
shift |
277 | 137 |
fi |
138 |
||
139 |
if [ "$1" = "-X" ] |
|
140 |
then |
|
141 |
shift |
|
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
142 |
STX_EXE=$1/stx |
277 | 143 |
shift |
192 | 144 |
fi |
145 |
||
482 | 146 |
if [ "$1" = "--gdb" ] |
439 | 147 |
then |
148 |
shift |
|
1432
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
149 |
DEBUGGER="gdb --args" |
439 | 150 |
fi |
151 |
||
1133
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
152 |
if [ "$1" = "--cgdb" ] |
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
153 |
then |
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
154 |
shift |
1432
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
155 |
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
|
156 |
fi |
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
157 |
|
1274
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
158 |
if [ "$1" = "--callgrind" ] |
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
159 |
then |
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
160 |
shift |
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
161 |
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
|
162 |
fi |
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
163 |
|
1432
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
164 |
if [ "$1" = "--callgrind-startup" ] |
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
165 |
then |
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
166 |
shift |
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
167 |
DEBUGGER="valgrind --tool=callgrind" |
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
168 |
fi |
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
169 |
|
1e235b190ee3
Added --callgrind-startup option
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1326
diff
changeset
|
170 |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
171 |
if [ "$1" = "--stap" ] |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
172 |
then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
173 |
shift |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
174 |
if [ -z "$1" ]; then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
175 |
echo "--stap requires systemtap script to run" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
176 |
exit 1 |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
177 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
178 |
if [ ! -r "$1" ]; then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
179 |
echo "$1 is not a readable systemtap script" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
180 |
echo "--stap requires systemtap script to run" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
181 |
exit 1 |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
182 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
183 |
STAPSCRIPT=$1 |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
184 |
shift |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
185 |
fi |
1274
d087caa28ae3
Added --callgrind option to run under callgrind profiler
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1133
diff
changeset
|
186 |
|
1133
c4e732341636
Added --cgdb option to run St/X under CGDB
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
482
diff
changeset
|
187 |
|
482 | 188 |
if [ "$1" = "--ldd" ] |
262 | 189 |
then |
190 |
shift |
|
341 | 191 |
DEBUGLIB=yes |
262 | 192 |
fi |
193 |
||
192 | 194 |
# |
195 |
# |
|
164 | 196 |
# some have Xlibs in /usr/openwin/lib ... |
197 |
# |
|
157 | 198 |
if [ -d /usr/openwin/lib ] |
199 |
then |
|
234
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
200 |
if [ "$LD_LIBRARY_PATH" != "" ] |
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
201 |
then |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
202 |
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
|
203 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
204 |
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
|
205 |
fi |
315 | 206 |
if [ "$SHLIB_PATH" != "" ] |
207 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
208 |
SHLIB_PATH=$SHLIB_PATH:/usr/openwin/lib:/usr/local/lib/smalltalk/lib |
315 | 209 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
210 |
SHLIB_PATH=/usr/openwin/lib:/usr/local/lib/smalltalk/lib |
315 | 211 |
fi |
157 | 212 |
else |
234
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
213 |
if [ "$LD_LIBRARY_PATH" != "" ] |
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
214 |
then |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
215 |
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
|
216 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
217 |
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
|
218 |
fi |
315 | 219 |
if [ "$SHLIB_PATH" != "" ] |
220 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
221 |
SHLIB_PATH=$SHLIB_PATH:/usr/local/lib/smalltalk/lib |
315 | 222 |
else |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
223 |
SHLIB_PATH=/usr/local/lib/smalltalk/lib |
315 | 224 |
fi |
157 | 225 |
fi |
164 | 226 |
|
227 |
# |
|
228 |
# my own libs may be found in STX_LIBDIR/lib |
|
247 | 229 |
# STX_LIBDIR is to be set to the top of the smalltalk installation |
230 |
# (i.e. where all the .rc files are located) |
|
164 | 231 |
# |
242 | 232 |
|
164 | 233 |
if [ "$STX_LIBDIR" != "" ] |
234 |
then |
|
243 | 235 |
if [ "$STX_LIBDIR" != "/usr/local/smalltalk" ] |
236 |
then |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
237 |
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
|
238 |
SHLIB_PATH=$STX_LIBDIR:$STX_LIBDIR/lib:$SHLIB_PATH |
243 | 239 |
fi |
452 | 240 |
else |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
241 |
STX_LIBDIR=$STX_BIN_DIR |
452 | 242 |
fi |
243 |
||
244 |
# |
|
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
245 |
# and in STX_BIN_DIR |
452 | 246 |
# |
247 |
||
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
248 |
if [ "$STX_BIN_DIR" != "" ] |
452 | 249 |
then |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
250 |
if [ "$STX_BIN_DIR" != "/usr/local/bin" ] |
452 | 251 |
then |
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
252 |
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
|
253 |
SHLIB_PATH=$STX_BIN_DIR:$SHLIB_PATH |
452 | 254 |
fi |
164 | 255 |
fi |
256 |
||
276 | 257 |
LD_LIBRARY_PATH=.:./lib:$LD_LIBRARY_PATH |
315 | 258 |
SHLIB_PATH=.:./lib:$SHLIB_PATH |
155 | 259 |
export LD_LIBRARY_PATH |
315 | 260 |
export SHLIB_PATH |
247 | 261 |
|
262 |
# |
|
314
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
263 |
# 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
|
264 |
# (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
|
265 |
# |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
266 |
case $0 in |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
267 |
./*) |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
268 |
PATH=.:$PATH |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
269 |
export PATH |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
270 |
;; |
314
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
271 |
esac |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
272 |
|
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
273 |
# |
280 | 274 |
# debugging which stx & shared libs are used ... |
247 | 275 |
# |
344 | 276 |
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
|
277 |
if [ "$STX_EXE" = "stx" ] |
341 | 278 |
then |
279 |
if [ -f stx ] |
|
280 |
then |
|
281 |
whichOne=`/bin/sh -c "type stx"` |
|
282 |
if [ "$whichOne" != "stx is ./stx" ] |
|
283 |
then |
|
284 |
echo "************* WARNING the executed" $whichOne |
|
285 |
echo "************* (may not be appropriate for used shared libs)" |
|
286 |
echo "************* Try './smalltalk -ldd' for more details" |
|
287 |
echo "************* or force the local stx to be used with" |
|
288 |
echo "************* './smalltalk -x ./stx'" |
|
289 |
echo |
|
290 |
fi |
|
291 |
fi |
|
292 |
fi |
|
293 |
||
280 | 294 |
if [ "$DEBUGLIB" = "yes" ] |
277 | 295 |
then |
344 | 296 |
echo "used " $whichOne |
341 | 297 |
echo "used LD_LIBRARY_PATH is " $LD_LIBRARY_PATH |
298 |
echo "used SHLIB_PATH is " $SHLIB_PATH |
|
299 |
echo "used STX_LIBDIR is " $STX_LIBDIR |
|
300 |
case `uname` in |
|
301 |
HP-UX*) |
|
302 |
chatr $STX |
|
303 |
;; |
|
277 | 304 |
|
341 | 305 |
*) |
306 |
ldd -r $STX |
|
307 |
;; |
|
308 |
esac |
|
262 | 309 |
fi |
247 | 310 |
|
316 | 311 |
# |
312 |
# how did HP mess up things so badly ? |
|
313 |
# It takes a veeeery long time for stx to start |
|
314 |
# (the spinning wheel is shown when stx's main |
|
315 |
# starts to run - all the time in between is |
|
316 |
# spent in the systems loader ...) |
|
317 |
# |
|
449 | 318 |
# if [ "`uname`" = "HP-UX" ] |
319 |
# then |
|
320 |
# echo "Please be patient - hp systems are very slow." |
|
321 |
# fi |
|
316 | 322 |
|
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
323 |
PATH=$PATH:$STX_BIN_DIR |
269 | 324 |
export PATH |
452 | 325 |
# echo PATH is $PATH |
326 |
# echo DISPLAY is $DISPLAY |
|
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
327 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
328 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
329 |
|
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
330 |
if [ ! -z "$STAPSCRIPT" ]; then |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
331 |
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
|
332 |
CMD="$STX_EXE $@" |
1326
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
333 |
echo "$CMD" |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
334 |
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
|
335 |
fi |
e6197baf42c8
Initial support for systemtap.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1274
diff
changeset
|
336 |
|
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 |
|
1435
9a1f18933e40
Merged code from jv-branch's 'distutils' package
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1432
diff
changeset
|
339 |
exec $DEBUGGER $STX_EXE ${1+"$@"} |