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