-
Notifications
You must be signed in to change notification settings - Fork 68
/
pharo
executable file
·56 lines (53 loc) · 2.07 KB
/
pharo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
# Run the VM, setting SQUEAK_PLUGINS if unset to the VM's containing directory
# if unset, and ensuring LD_LIBRARY_PATH includes the VM's containing directory.
BIN=`/usr/bin/dirname "$0"`/lib/
GDB=
if [ "${SQUEAK_PLUGINS-unset}" = unset ]; then
export SQUEAK_PLUGINS="$BIN"
fi
if [ "$1" = '-gdb' ]; then
GDB=gdb
shift
echo;echo run $@; echo
set --
fi
# At least on linux LD_LIBRARY_PATH's components must be absolute path names
case "$BIN" in
/*) PLUGINS="$BIN";;
*) PLUGINS="`pwd`/$BIN"
esac
if [ $(uname -s) = "OpenBSD" ]; then
LD_LIBRARY_PATH="$PLUGINS:${LD_LIBRARY_PATH}" exec $GDB "$BIN/pharo" "$@"
fi
# On some linuxes there multiple versions of the C library. If the image uses
# libc (e.g. through the FFI) then it must use the same version that the VM uses
# and so it should take precedence over /lib libc. This is done by setting
# LD_LIBRARY_PATH appropriately, based on ldd's idea of the libc use by the VM.
LIBC_SO="`/usr/bin/ldd "$BIN/pharo" | /bin/fgrep /libc. | sed 's/^.*=> \([^ ]*\).*/\1/'`"
PLATFORMLIBDIR=`expr "$LIBC_SO" : '\(.*\)/libc.*'`
if [ "$PLATFORMLIBDIR" = "" ]; then
{
echo "Error. Could not determine platform's libc path for VM. "
echo "Try forcing \$PLATFORMLIBDIR in $0, based on LIBC_SO."
echo "Please report what works to pharo [vm-dev] mail list."
echo " LIBC_SO="$LIBC_SO
cat /etc/*-release* | grep -v // | sed 's/^/ /'
echo -n " UNAME=" ; uname -a
MACHINE=`uname -m`
case "$MACHINE" in
*64*)
echo " System seems to be 64 bit. You may need to (re)install the 32-bit libraries."
;;
esac
exit 1
} 1>&2
fi
# prepending is less flexible but safer because it ensures we find the plugins
# in the same directory as the VM. We must include at least /lib and /usr/lib
# if libraries there-in are to be found. These directories are not implicit.
case $PLATFORMLIBDIR in
/lib|/usr/lib) SVMLLP=/lib:/usr/lib;;
*) SVMLLP="$PLATFORMLIBDIR:/lib:/usr$PLATFORMLIBDIR:/usr/lib"
esac
LD_LIBRARY_PATH="$PLUGINS:$SVMLLP:${LD_LIBRARY_PATH}" exec $GDB "$BIN/pharo" "$@"