diff --git a/CuisVM.app/Contents/Linux-x86_64/squeak b/CuisVM.app/Contents/Linux-x86_64/squeak index 99b057b29..a44d798fc 100755 --- a/CuisVM.app/Contents/Linux-x86_64/squeak +++ b/CuisVM.app/Contents/Linux-x86_64/squeak @@ -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 @@ -26,16 +24,16 @@ 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 @@ -43,7 +41,7 @@ if [ "$PLATFORMLIBDIR" = "" ]; then 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 @@ -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" "$@" diff --git a/RunCuisOnGuix.sh b/RunCuisOnGuix.sh new file mode 100755 index 000000000..0388e0685 --- /dev/null +++ b/RunCuisOnGuix.sh @@ -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" "$@" diff --git a/RunCuisOnLinux.sh b/RunCuisOnLinux.sh index dd519e77a..0382be5a8 100755 --- a/RunCuisOnLinux.sh +++ b/RunCuisOnLinux.sh @@ -45,7 +45,6 @@ else # all-in-one bundle fi VM="${BINDIR}${APP}" -VMOPTIONS="-encoding UTF-8" STARGS=() # separate vm and script arguments @@ -53,11 +52,13 @@ 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";; @@ -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 @@ -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[@]}"