author | manfred |
Wed, 10 Mar 1999 14:40:20 +0100 | |
changeset 328 | 447452eafa2f |
parent 319 | ad0e533985c9 |
child 329 | 060c874665b7 |
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 .) |
|
23 |
# [almost the same as above] |
|
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 |
|
319 | 31 |
if test -z "$STX_LIBDIR" |
32 |
then |
|
33 |
bindir=`dirname $0` |
|
34 |
case "$bindir" in |
|
35 |
/* ) |
|
36 |
;; |
|
37 |
.* ) |
|
38 |
bindir=`( cd $bindir; pwd ) 2> /dev/null` |
|
39 |
;; |
|
40 |
esac |
|
41 |
STX_LIBDIR=${bindir}/../lib |
|
42 |
fi |
|
328 | 43 |
export STX_LIBDIR |
277 | 44 |
|
286 | 45 |
if [ "$1" = "--help" ] |
46 |
then |
|
47 |
echo |
|
48 |
echo "usage: smalltalk [-x prog] [-X dir] [-ldd] stx-args" |
|
49 |
echo |
|
50 |
echo "Args to the smalltalk startup shell script:" |
|
51 |
echo " -x prog use prog instead of stx as executable" |
|
52 |
echo " -X dir use stx from dir instead of default (PATH)" |
|
53 |
echo " -ldd show which shared libraries are used" |
|
54 |
echo " stx-args stx arguments as follows." |
|
55 |
echo |
|
56 |
echo "STX args:" |
|
57 |
fi |
|
58 |
||
193 | 59 |
if [ "$1" = "-x" ] |
192 | 60 |
then |
61 |
shift |
|
62 |
STX=$1 |
|
63 |
shift |
|
277 | 64 |
fi |
65 |
||
66 |
if [ "$1" = "-X" ] |
|
67 |
then |
|
68 |
shift |
|
69 |
STX=$1/stx |
|
70 |
shift |
|
192 | 71 |
fi |
72 |
||
262 | 73 |
if [ "$1" = "-ldd" ] |
74 |
then |
|
75 |
shift |
|
76 |
DEBUGLIB="yes" |
|
77 |
fi |
|
78 |
||
192 | 79 |
# |
80 |
# |
|
164 | 81 |
# some have Xlibs in /usr/openwin/lib ... |
82 |
# |
|
157 | 83 |
if [ -d /usr/openwin/lib ] |
84 |
then |
|
234
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
85 |
if [ "$LD_LIBRARY_PATH" != "" ] |
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
86 |
then |
276 | 87 |
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
|
88 |
else |
276 | 89 |
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
|
90 |
fi |
315 | 91 |
if [ "$SHLIB_PATH" != "" ] |
92 |
then |
|
93 |
SHLIB_PATH=$SHLIB_PATH:/usr/openwin/lib:/usr/local/lib/smalltalk/lib |
|
94 |
else |
|
95 |
SHLIB_PATH=/usr/openwin/lib:/usr/local/lib/smalltalk/lib |
|
96 |
fi |
|
157 | 97 |
else |
234
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
98 |
if [ "$LD_LIBRARY_PATH" != "" ] |
861d75db3bec
do not clobber existing LD_LIBRARY_PATH
Claus Gittinger <cg@exept.de>
parents:
193
diff
changeset
|
99 |
then |
276 | 100 |
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
|
101 |
else |
276 | 102 |
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
|
103 |
fi |
315 | 104 |
if [ "$SHLIB_PATH" != "" ] |
105 |
then |
|
106 |
SHLIB_PATH=$SHLIB_PATH:/usr/local/lib/smalltalk/lib |
|
107 |
else |
|
108 |
SHLIB_PATH=/usr/local/lib/smalltalk/lib |
|
109 |
fi |
|
157 | 110 |
fi |
164 | 111 |
|
112 |
# |
|
113 |
# my own libs may be found in STX_LIBDIR/lib |
|
247 | 114 |
# STX_LIBDIR is to be set to the top of the smalltalk installation |
115 |
# (i.e. where all the .rc files are located) |
|
164 | 116 |
# |
242 | 117 |
|
164 | 118 |
if [ "$STX_LIBDIR" != "" ] |
119 |
then |
|
243 | 120 |
if [ "$STX_LIBDIR" != "/usr/local/smalltalk" ] |
121 |
then |
|
274 | 122 |
LD_LIBRARY_PATH=$STX_LIBDIR/lib:$LD_LIBRARY_PATH |
315 | 123 |
SHLIB_PATH=$STX_LIBDIR/lib:$SHLIB_PATH |
243 | 124 |
fi |
164 | 125 |
fi |
126 |
||
276 | 127 |
LD_LIBRARY_PATH=.:./lib:$LD_LIBRARY_PATH |
315 | 128 |
SHLIB_PATH=.:./lib:$SHLIB_PATH |
155 | 129 |
export LD_LIBRARY_PATH |
315 | 130 |
export SHLIB_PATH |
247 | 131 |
|
132 |
# |
|
314
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
133 |
# 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
|
134 |
# (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
|
135 |
# |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
136 |
case $0 in |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
137 |
./*) |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
138 |
PATH=.:$PATH |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
139 |
export PATH |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
140 |
;; |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
141 |
esac |
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
142 |
|
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
143 |
# |
280 | 144 |
# debugging which stx & shared libs are used ... |
247 | 145 |
# |
280 | 146 |
if [ "$DEBUGLIB" = "yes" ] |
277 | 147 |
then |
280 | 148 |
if [ "$STX" = "stx" ] |
149 |
then |
|
277 | 150 |
if [ -f stx ] |
151 |
then |
|
280 | 152 |
whichOne=`/bin/sh -c "type stx"` |
153 |
if [ "$whichOne" != "stx is ./stx" ] |
|
277 | 154 |
then |
280 | 155 |
echo "************* WARNING the executed" $whichOne |
277 | 156 |
echo "************* (may not be appropriate for used shared libs)" |
157 |
echo "************* Try './smalltalk -ldd' for more details" |
|
158 |
echo "************* or force the local stx to be used with" |
|
159 |
echo "************* './smalltalk -x ./stx'" |
|
160 |
echo |
|
161 |
fi |
|
162 |
fi |
|
163 |
||
314
7fbaf542c38c
prepend . to the path, if command was executed as ./xxxx
Claus Gittinger <cg@exept.de>
parents:
286
diff
changeset
|
164 |
echo "used " $whichOne |
262 | 165 |
echo "used LD_LIBRARY_PATH is " $LD_LIBRARY_PATH |
315 | 166 |
echo "used SHLIB_PATH is " $SHLIB_PATH |
167 |
case `uname` in |
|
168 |
HP-UX*) |
|
169 |
chatr $STX |
|
170 |
;; |
|
171 |
||
172 |
*) |
|
173 |
ldd -r $STX |
|
174 |
;; |
|
175 |
esac |
|
280 | 176 |
fi |
262 | 177 |
fi |
247 | 178 |
|
316 | 179 |
# |
180 |
# how did HP mess up things so badly ? |
|
181 |
# It takes a veeeery long time for stx to start |
|
182 |
# (the spinning wheel is shown when stx's main |
|
183 |
# starts to run - all the time in between is |
|
184 |
# spent in the systems loader ...) |
|
185 |
# |
|
186 |
if [ "`uname`" = "HP-UX" ] |
|
187 |
then |
|
188 |
echo "Please be patient - hp systems are very slow." |
|
189 |
fi |
|
190 |
||
269 | 191 |
PATH=$PATH:. |
192 |
export PATH |
|
192 | 193 |
exec $STX $* |