author | Claus Gittinger <cg@exept.de> |
Fri, 29 Sep 2000 10:56:55 +0200 | |
changeset 449 | a9f1afb0ae1b |
parent 439 | 060918989239 |
child 452 | f1fc8e661543 |
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 |
||
341 | 30 |
if [ "$1" = "--help" ] |
31 |
then |
|
32 |
echo |
|
33 |
echo "usage: smalltalk [-x prog] [-X dir] [-ldd] stx-args" |
|
34 |
echo |
|
35 |
echo "Args to the smalltalk startup shell script:" |
|
36 |
echo " -x prog use prog instead of stx as executable" |
|
37 |
echo " -X dir use stx from dir instead of default (PATH)" |
|
38 |
echo " -ldd show which shared libraries are used" |
|
39 |
echo " stx-args stx arguments as follows." |
|
40 |
echo |
|
41 |
echo "STX args:" |
|
42 |
fi |
|
43 |
||
277 | 44 |
STX=stx |
439 | 45 |
DEBUGGER= |
46 |
||
383 | 47 |
# notice: STXLIBDIR is filled in here by install-sh script |
319 | 48 |
if test -z "$STX_LIBDIR" |
49 |
then |
|
50 |
bindir=`dirname $0` |
|
51 |
case "$bindir" in |
|
52 |
/* ) |
|
53 |
;; |
|
54 |
.* ) |
|
55 |
bindir=`( cd $bindir; pwd ) 2> /dev/null` |
|
56 |
;; |
|
57 |
esac |
|
434
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
58 |
if [ -d ${bindir}/../lib ] |
449 | 59 |
then |
60 |
STX_LIBDIR=`cd ${bindir}/../lib ; pwd` |
|
61 |
fi |
|
319 | 62 |
fi |
435 | 63 |
if [ ! -d "$STX_LIBDIR" ] |
383 | 64 |
then |
65 |
if [ -d ../lib ] |
|
66 |
then |
|
67 |
STX_LIBDIR=`cd ../lib ; pwd` |
|
68 |
fi |
|
69 |
fi |
|
399 | 70 |
if test -z "$STX_PACKAGEDIR" |
71 |
then |
|
72 |
if [ -d ../packages ] |
|
73 |
then |
|
74 |
STX_PACKAGEDIR=`cd .. ; pwd` |
|
434
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
75 |
else |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
76 |
if [ -d $STX_LIBDIR/../packages ] |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
77 |
then |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
78 |
STX_PACKAGEDIR=`cd $STX_LIBDIR/../packages ; pwd` |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
79 |
fi |
399 | 80 |
fi |
81 |
fi |
|
401 | 82 |
if test -z "$STX_TOPDIR" |
83 |
then |
|
84 |
if [ -f ../lib/smalltalk.rc ] |
|
85 |
then |
|
86 |
STX_TOPDIR=`cd .. ; pwd` |
|
434
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
87 |
else |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
88 |
if [ -f $STX_LIBDIR/../lib/smalltalk.rc ] |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
89 |
then |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
90 |
STX_TOPDIR=`cd $STX_LIBDIR/.. ; pwd` |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
91 |
fi |
401 | 92 |
fi |
93 |
fi |
|
383 | 94 |
|
434
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
95 |
# echo STX_LIBDIR is $STX_LIBDIR |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
96 |
# echo STX_TOPDIR is $STX_TOPDIR |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
97 |
# echo STX_PACKAGEDIR is $STX_PACKAGEDIR |
f073cdbe422f
oops - LIBDIR/TOPDIR & PACKAGEDIR detection failed,
Claus Gittinger <cg@exept.de>
parents:
401
diff
changeset
|
98 |
|
401 | 99 |
export STX_LIBDIR STX_PACKAGEDIR STX_TOPDIR |
329
060c874665b7
- Use "stx" executable from this script's directory, if existing.
manfred
parents:
328
diff
changeset
|
100 |
if test -x `dirname $0`/stx; then |
060c874665b7
- Use "stx" executable from this script's directory, if existing.
manfred
parents:
328
diff
changeset
|
101 |
STX=`dirname $0`/stx |
060c874665b7
- Use "stx" executable from this script's directory, if existing.
manfred
parents:
328
diff
changeset
|
102 |
fi |
277 | 103 |
|
193 | 104 |
if [ "$1" = "-x" ] |
192 | 105 |
then |
106 |
shift |
|
107 |
STX=$1 |
|
108 |
shift |
|
277 | 109 |
fi |
110 |
||
111 |
if [ "$1" = "-X" ] |
|
112 |
then |
|
113 |
shift |
|
114 |
STX=$1/stx |
|
115 |
shift |
|
192 | 116 |
fi |
117 |
||
439 | 118 |
if [ "$1" = "-gdb" ] |
119 |
then |
|
120 |
shift |
|
121 |
DEBUGGER=gdb |
|
122 |
fi |
|
123 |
||
262 | 124 |
if [ "$1" = "-ldd" ] |
125 |
then |
|
126 |
shift |
|
341 | 127 |
DEBUGLIB=yes |
262 | 128 |
fi |
129 |
||
192 | 130 |
# |
131 |
# |
|
164 | 132 |
# some have Xlibs in /usr/openwin/lib ... |
133 |
# |
|
157 | 134 |
if [ -d /usr/openwin/lib ] |
135 |
then |
|
234
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
136 |
if [ "$LD_LIBRARY_PATH" != "" ] |
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
137 |
then |
276 | 138 |
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
|
139 |
else |
276 | 140 |
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
|
141 |
fi |
315 | 142 |
if [ "$SHLIB_PATH" != "" ] |
143 |
then |
|
144 |
SHLIB_PATH=$SHLIB_PATH:/usr/openwin/lib:/usr/local/lib/smalltalk/lib |
|
145 |
else |
|
146 |
SHLIB_PATH=/usr/openwin/lib:/usr/local/lib/smalltalk/lib |
|
147 |
fi |
|
157 | 148 |
else |
234
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
149 |
if [ "$LD_LIBRARY_PATH" != "" ] |
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
150 |
then |
276 | 151 |
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
|
152 |
else |
276 | 153 |
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
|
154 |
fi |
315 | 155 |
if [ "$SHLIB_PATH" != "" ] |
156 |
then |
|
157 |
SHLIB_PATH=$SHLIB_PATH:/usr/local/lib/smalltalk/lib |
|
158 |
else |
|
159 |
SHLIB_PATH=/usr/local/lib/smalltalk/lib |
|
160 |
fi |
|
157 | 161 |
fi |
164 | 162 |
|
163 |
# |
|
164 |
# my own libs may be found in STX_LIBDIR/lib |
|
247 | 165 |
# STX_LIBDIR is to be set to the top of the smalltalk installation |
166 |
# (i.e. where all the .rc files are located) |
|
164 | 167 |
# |
242 | 168 |
|
164 | 169 |
if [ "$STX_LIBDIR" != "" ] |
170 |
then |
|
243 | 171 |
if [ "$STX_LIBDIR" != "/usr/local/smalltalk" ] |
172 |
then |
|
398 | 173 |
LD_LIBRARY_PATH=$STX_LIBDIR:$STX_LIBDIR/lib:$LD_LIBRARY_PATH |
174 |
SHLIB_PATH=$STX_LIBDIR:$STX_LIBDIR/lib:$SHLIB_PATH |
|
243 | 175 |
fi |
164 | 176 |
fi |
177 |
||
276 | 178 |
LD_LIBRARY_PATH=.:./lib:$LD_LIBRARY_PATH |
315 | 179 |
SHLIB_PATH=.:./lib:$SHLIB_PATH |
155 | 180 |
export LD_LIBRARY_PATH |
315 | 181 |
export SHLIB_PATH |
247 | 182 |
|
183 |
# |
|
314
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
184 |
# 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
|
185 |
# (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
|
186 |
# |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
187 |
case $0 in |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
188 |
./*) |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
189 |
PATH=.:$PATH |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
190 |
export PATH |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
191 |
;; |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
192 |
esac |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
193 |
|
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
194 |
# |
280 | 195 |
# debugging which stx & shared libs are used ... |
247 | 196 |
# |
344 | 197 |
whichOne=`/bin/sh -c "type $STX"` |
341 | 198 |
if [ "$STX" = "stx" ] |
199 |
then |
|
200 |
if [ -f stx ] |
|
201 |
then |
|
202 |
whichOne=`/bin/sh -c "type stx"` |
|
203 |
if [ "$whichOne" != "stx is ./stx" ] |
|
204 |
then |
|
205 |
echo "************* WARNING the executed" $whichOne |
|
206 |
echo "************* (may not be appropriate for used shared libs)" |
|
207 |
echo "************* Try './smalltalk -ldd' for more details" |
|
208 |
echo "************* or force the local stx to be used with" |
|
209 |
echo "************* './smalltalk -x ./stx'" |
|
210 |
echo |
|
211 |
fi |
|
212 |
fi |
|
213 |
fi |
|
214 |
||
280 | 215 |
if [ "$DEBUGLIB" = "yes" ] |
277 | 216 |
then |
344 | 217 |
echo "used " $whichOne |
341 | 218 |
echo "used LD_LIBRARY_PATH is " $LD_LIBRARY_PATH |
219 |
echo "used SHLIB_PATH is " $SHLIB_PATH |
|
220 |
echo "used STX_LIBDIR is " $STX_LIBDIR |
|
221 |
case `uname` in |
|
222 |
HP-UX*) |
|
223 |
chatr $STX |
|
224 |
;; |
|
277 | 225 |
|
341 | 226 |
*) |
227 |
ldd -r $STX |
|
228 |
;; |
|
229 |
esac |
|
262 | 230 |
fi |
247 | 231 |
|
316 | 232 |
# |
233 |
# how did HP mess up things so badly ? |
|
234 |
# It takes a veeeery long time for stx to start |
|
235 |
# (the spinning wheel is shown when stx's main |
|
236 |
# starts to run - all the time in between is |
|
237 |
# spent in the systems loader ...) |
|
238 |
# |
|
449 | 239 |
# if [ "`uname`" = "HP-UX" ] |
240 |
# then |
|
241 |
# echo "Please be patient - hp systems are very slow." |
|
242 |
# fi |
|
316 | 243 |
|
269 | 244 |
PATH=$PATH:. |
245 |
export PATH |
|
439 | 246 |
exec $DEBUGGER $STX ${1+"$@"} |