Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions CuisVM.app/Contents/Linux-x86_64/squeak
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#!/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/squeak/5.0-202312181441-64bit
GDB=
BIN=`dirname "$0"`/lib/squeak/5.0-202312181441-64bit
if [ "${SQUEAK_PLUGINS-unset}" = unset ]; then
export SQUEAK_PLUGINS="$BIN"
fi
if [ "$1" = '-gdb' ]; then
GDB=gdb
GDB="gdb --args"
shift
echo;echo run $@; echo
set --
echo;echo run "$@"; echo
fi
# At least on linux LD_LIBRARY_PATH's components must be absolute path names
case "$BIN" in
Expand All @@ -26,24 +24,24 @@ fi
# 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/squeak" | /bin/fgrep /libc. | sed 's/^.*=> \([^ ]*\).*/\1/'`"
LIBC_SO="`ldd "$BIN/squeak" | grep -F /libc. | sed 's/^.*=> \([^ ]*\).*/\1/'`"
PLATFORMLIBDIR=`expr "$LIBC_SO" : '\(.*\)/libc.*'`

if [ "$PLATFORMLIBDIR" = "" ]; then
{
echo "Error. Could not determine platform's libc path for VM. "
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 squeak [vm-dev] mail list."
echo "Please report what works to squeak [vm-dev] mail list."
echo " LIBC_SO="$LIBC_SO
cat /etc/*-release* | grep -v // | sed 's/^/ /'
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
exit 1
} 1>&2
fi
# prepending is less flexible but safer because it ensures we find the plugins
Expand All @@ -53,4 +51,4 @@ 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/squeak" "$@"
LD_LIBRARY_PATH="$PLUGINS:$SVMLLP:${LD_LIBRARY_PATH}" exec $GDB $LOADER "$BIN/squeak" "$@"
2 changes: 2 additions & 0 deletions RunCuisOnGuix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env -S guix shell bash coreutils grep sed glibc util-linux:lib pulseaudio libsm libxrender mesa libxext libx11 libsm libice gdb -- bash
LOADER=$GUIX_ENVIRONMENT/lib/ld-linux-x86-64.so.2 LD_LIBRARY_PATH=$GUIX_ENVIRONMENT/lib "`dirname $0`/RunCuisOnLinux.sh" "$@"
13 changes: 7 additions & 6 deletions RunCuisOnLinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,20 @@ else # all-in-one bundle
fi

VM="${BINDIR}${APP}"
VMOPTIONS="-encoding UTF-8"
STARGS=()

# separate vm and script arguments
while [[ -n "$1" ]] ; do
case "$1" in
*.image) break;;
*.st|*.cs) STARGS+=("$1");;
-gdb) DBGOPTIONS=-gdb;;
--) break;;
*) VMARGS="${VMARGS} $1";;
*) VMARGS+=" $1";;
esac
shift
done
VMOPTIONS+=" -encoding UTF-8"
while [[ -n "$1" ]]; do
case "$1" in
*.image) IMAGE="$1";;
Expand Down Expand Up @@ -151,9 +152,9 @@ ensure_image() {
detect_sound() {
if pulseaudio --check 2>/dev/null ; then
if "${VM}" --help 2>/dev/null | grep -q vm-sound-pulse ; then
VMOPTIONS="${VMOPTIONS} -vm-sound-pulse"
VMOPTIONS+=" -vm-sound-pulse"
else
VMOPTIONS="${VMOPTIONS} -vm-sound-oss"
VMOPTIONS+=" -vm-sound-oss"
if padsp true 2>/dev/null; then
SOUNDSERVER=padsp
fi
Expand All @@ -168,7 +169,7 @@ detect_sound

# Enable per-monitor scaling to work around memory leak:
# https://github.com/OpenSmalltalk/opensmalltalk-vm/issues/642
export SQUEAK_DISPLAY_PER_MONITOR_SCALE=1
export SQUEAK_DISPLAY_PER_MONITOR_SCALE=1

echo "Using ${VM} ..."
exec ${SOUNDSERVER} "${VM}" ${VMOPTIONS} ${VMARGS} "${IMAGE}" -u "${STARGS[@]}"
exec ${SOUNDSERVER} "${VM}" ${DBGOPTIONS} ${VMOPTIONS} ${VMARGS} "${IMAGE}" -u "${STARGS[@]}"