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