[squeak-dev] International text input on X11

Yoshiki Ohshima Yoshiki.Ohshima at acm.org
Mon May 16 23:44:51 UTC 2016


My suggested change to /usr/bin/scratch would look like attached diff.
Basically, it brings in the part to figure out the right
LD_LIBRARY_PATH based on the VM's architecture, add a way to specify
the display vm module, add a way to specify display module options,
and finally figures out the need for -compositioninput based on the
XMODIFIERS environment variable.

On Mon, May 16, 2016 at 3:28 PM, Yoshiki Ohshima
<Yoshiki.Ohshima at acm.org> wrote:
> On Mon, May 16, 2016 at 1:23 PM, David T. Lewis <lewis at mail.msen.com> wrote:
>> I have not actually looked at the /usr/bin/scratch script, but I do know
>> that the use of /usr/bin/squeak (or /usr/local/bin/squeak) is already
>> overloaded depending on what flavor of VM was installed most recently. I
>> suspect that it would be better to have a /usr/bin/scratch script that
>> does exactly what you want it to do, possibly not relying at all on the
>> /usr/bin/squeak script.
>>
>> Tim, when someone installs Scratch on their Pi, does that installation
>> include the VM? Or does it expect a VM to be installed separately? I am
>> assuming that the Scratch installation would include a VM and with the
>> Scratch plugins, and that you would not want other installations of VMs to
>> affect the Scratch application. Is that right?
>
> The "nuscratch" package comes with the following files (besides some
> other files).  The thing is that the package seems to have dependency
> on the scratch package, which in turn has dependency on squeak-vm.
> Note that both /usr/bin/squeak and /usr/bin/scratch are replaced with
> the ones that come in the nuscratch package and old ones are renamed
> to /usr/bin/squeak.old and /usr/bin/scratch.old.
>
> Yes, I think it is good that the nuscratch package only replaces
> /usr/bin/scratch, and not depend on the squeak-vm package.
>
> nuscratch: /usr/bin/scratch
> nuscratch: /usr/bin/squeak
> nuscratch: /usr/lib/squeak/5.0-3663/LocalePlugin
> nuscratch: /usr/lib/squeak/5.0-3663/Squeak3D
> nuscratch: /usr/lib/squeak/5.0-3663/SqueakFFIPrims
> nuscratch: /usr/lib/squeak/5.0-3663/SqueakSSL
> nuscratch: /usr/lib/squeak/5.0-3663/UUIDPlugin
> nuscratch: /usr/lib/squeak/5.0-3663/UnicodePlugin
> nuscratch: /usr/lib/squeak/5.0-3663/UnixOSProcessPlugin
> nuscratch: /usr/lib/squeak/5.0-3663/WeDoPlugin
> nuscratch: /usr/lib/squeak/5.0-3663/XDisplayControlPlugin
> nuscratch: /usr/lib/squeak/5.0-3663/squeak
> nuscratch: /usr/lib/squeak/5.0-3663/vm-display-X11
> nuscratch: /usr/lib/squeak/5.0-3663/vm-display-null
> nuscratch: /usr/lib/squeak/5.0-3663/vm-sound-ALSA
> nuscratch: /usr/lib/squeak/5.0-3663/vm-sound-OSS
> nuscratch: /usr/lib/squeak/5.0-3663/vm-sound-null
> nuscratch: /usr/share/scratch/NuScratch02052016.image
> ...
>
>
>
> --
> -- Yoshiki



-- 
-- Yoshiki
-------------- next part --------------
*** /usr/bin/scratch	Fri Jan 15 03:07:43 2016
--- scratch	Mon May 16 23:13:52 2016
***************
*** 5,13 ****
  # Adapted by:      Miriam Ruiz, Alex Bradbury, tim at Rowledge.org
  # tim - trying to simplify a bit but good grief, shell script is incomprehensible
  
! VM="/usr/bin/squeak"
  IMAGE="/usr/share/scratch/NuScratch15012016.image"
  IMOPTIONS=""
  DOCUMENT=""
  WRAPPER="sudo -E "
  # prevent wiringPi from terminating  brutally
--- 5,14 ----
  # Adapted by:      Miriam Ruiz, Alex Bradbury, tim at Rowledge.org
  # tim - trying to simplify a bit but good grief, shell script is incomprehensible
  
! VM=`echo /usr/lib/squeak/5.0-*/squeak|sort -r | head -1`
  IMAGE="/usr/share/scratch/NuScratch15012016.image"
  IMOPTIONS=""
+ DISPLAYMODULE=-vm-display-X11
  DOCUMENT=""
  WRAPPER="sudo -E "
  # prevent wiringPi from terminating  brutally
***************
*** 28,34 ****
  {
      echo "Usage: scratch [--param value] [-vmopt value] [arg value]"
      echo "       where --param is --vm, --image, or --document;"
!     echo "       -vmopt is an option passed to the Squeak VM;"
      echo "       and args are passed to the Squeak image."
  }
  
--- 29,36 ----
  {
      echo "Usage: scratch [--param value] [-vmopt value] [arg value]"
      echo "       where --param is --vm, --image, or --document;"
!     echo "       -display-module is an option to specify a vm display module;"
!     echo "       -displayopt is an option passed to the display module;"
      echo "       and args are passed to the Squeak image."
  }
  
***************
*** 58,64 ****
  			    *) DOCUMENT="$PWD/$2"
  				;;
  			esac
!  			shift
  			;;
  	        --image)
  			case "$2" in
--- 60,66 ----
  			    *) DOCUMENT="$PWD/$2"
  				;;
  			esac
! 			shift
  			;;
  	        --image)
  			case "$2" in
***************
*** 67,73 ****
  			    *) IMAGE="$PWD/$2"
  				;;
  			esac
!  			shift
  			;;
  	        --vm)
  			case "$2" in
--- 69,79 ----
  			    *) IMAGE="$PWD/$2"
  				;;
  			esac
! 			shift
! 			;;
! 	        -vmopt)
! 			 VMOPTIONS="$VMOPTIONS $2"
! 			shift
  			;;
  	        --vm)
  			case "$2" in
***************
*** 78,84 ****
  			esac
   			shift
  			;;
! 		-*) VMOPTIONS="$VMOPTIONS $1 $2"
  			shift
  			;;
  		*)  IMOPTIONS="$IMOPTIONS $1 $2"
--- 84,93 ----
  			esac
   			shift
  			;;
! 		-display-module) DISPLAYMODULE="$2"
! 			shift
! 			;;
! 		-displayopt) DISPLAYOPTIONS="$DISPLAYOPTIONS $2"
  			shift
  			;;
  		*)  IMOPTIONS="$IMOPTIONS $1 $2"
***************
*** 99,105 ****
  	sudo modprobe i2c-dev
  fi
  
  # VM, Image, and Document are non-optional
  # Document has to be present even if empty for IMOPTIONS to work
! echo Executing: $WRAPPER "$VM" "$IMAGE" "$DOCUMENT" $IMOPTIONS
! exec $WRAPPER "$VM" "$IMAGE" "$DOCUMENT" $IMOPTIONS
--- 108,141 ----
  	sudo modprobe i2c-dev
  fi
  
+ BIN=`/usr/bin/dirname $VM`
+ # At least on linux LD_LIBRARY_PATH's components must be absolute path names
+ case "$BIN" in
+ /*) PLUGINS="$BIN";;
+ *) PLUGINS="`pwd`/$BIN"
+ esac
+ 
+ # 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/squeak" | /bin/fgrep /libc. | sed 's/^.*=> \([^ ]*\).*/\1/'`"
+ case "$LIBC_SO" in
+ /lib/arm-linux-gnueabihf/libc*)	\
+ 	SVMLLP="/lib/arm-linux-gnueabihf:/lib:/usr/lib/arm-linux-gnueabihf:/usr/lib";;
+ "")	case `/bin/uname -m || /usr/bin/uname -m` in
+ 	*)	echo "/usr/bin/ldd didn't produce any output. Can't infer base LD_LIBRARY_PATH. Aborting." 1>&2
+ 	esac
+ 	exit 1;;
+ *)	echo "Can't infer base LD_LIBRARY_PATH. Aborting. Try adding a line for $LIBC_SO to $0. Please report your edit to squeak vm-dev." 1>&2
+ 	exit 1
+ esac
+ 
+ if echo $XMODIFIERS | grep '@im='; then
+     DISPLAYOPTIONS="$DISPLAYOPTIONS -compositioninput"
+ fi
+ 
  # VM, Image, and Document are non-optional
  # Document has to be present even if empty for IMOPTIONS to work
! echo Executing: env LD_LIBRARY_PATH="$PLUGINS:$SVMLLP:${LD_LIBRARY_PATH}" $WRAPPER $VM $VMOPTIONS $DISPLAYMODULE $DISPLAYOPTIONS $IMAGE $DOCUMENT $IMOPTIONS
! exec env LD_LIBRARY_PATH="$PLUGINS:$SVMLLP:${LD_LIBRARY_PATH}" $WRAPPER "$VM" $VMOPTIONS $DISPLAYMODULE $DISPLAYOPTIONS "$IMAGE" "$DOCUMENT" $IMOPTIONS


More information about the Squeak-dev mailing list