Author: piumarta Date: 2010-05-13 13:36:19 -0700 (Thu, 13 May 2010) New Revision: 2207 Modified: trunk/platforms/unix/CMakeLists.txt trunk/platforms/unix/ChangeLog trunk/platforms/unix/cmake/squeak.in trunk/platforms/unix/npsqueak/README.npsqueak trunk/platforms/unix/npsqueak/npsqueak.c trunk/platforms/unix/npsqueak/npsqueakregister.in trunk/platforms/unix/npsqueak/npsqueakrun.in Log: CMakeLists builds npsqueak; merge latest npsqueak changes from Bert Modified: trunk/platforms/unix/CMakeLists.txt =================================================================== --- trunk/platforms/unix/CMakeLists.txt 2010-05-12 00:02:20 UTC (rev 2206) +++ trunk/platforms/unix/CMakeLists.txt 2010-05-13 20:36:19 UTC (rev 2207) @@ -1,6 +1,6 @@ # Yes, it's true: you can write makefiles in COBOL. # -# Last edited: 2010-04-09 04:23:35 by piumarta on ubuntu +# Last edited: 2010-05-13 12:54:20 by piumarta on emilia-2.local PROJECT (squeak) @@ -137,6 +137,8 @@ BUILD_PLUGINS () +ADD_SUBDIRECTORY (${unix}/npsqueak) + SET (cmake ${unix}/../../cmake) IF (EXISTS ${cmake}/Packages.cmake) Modified: trunk/platforms/unix/ChangeLog =================================================================== --- trunk/platforms/unix/ChangeLog 2010-05-12 00:02:20 UTC (rev 2206) +++ trunk/platforms/unix/ChangeLog 2010-05-13 20:36:19 UTC (rev 2207) @@ -1,3 +1,20 @@ +2010-05-13 Ian Piumarta <com -dot- gmail -at- piumarta (backwards)> + + * CMakeLists.txt: Add subdir npsqueak. + + * npsqueak.c: Cosmetic improvements to error messages. + + * npsqueak/README.npsqueak: Updated for CMake. + + * npsqueak/npsqueakrun.in: New version from Bert. + + * npsqueak/npsqueakregister.in (NPSQUEAK_SO): Construct from + substituted cmake variables. + + * cmake/squeak.in (PATH): realpath() prepends dir to link target + iff target is relative. Only echo environment if SQUEAK_DEBUG is + nonzero. + 2010-05-11 Ian Piumarta <com -dot- gmail -at- piumarta (backwards)> * vm-display-X11/sqUnixX11.c: Add option -closequit and Modified: trunk/platforms/unix/cmake/squeak.in =================================================================== --- trunk/platforms/unix/cmake/squeak.in 2010-05-12 00:02:20 UTC (rev 2206) +++ trunk/platforms/unix/cmake/squeak.in 2010-05-13 20:36:19 UTC (rev 2207) @@ -3,7 +3,7 @@ # Launch squeakvm from the command line or a menu script, with a good # plugin path, text encodings and pulseaudio kludge # -# Last edited: 2010-04-29 02:52:25 by piumarta on margaux1 +# Last edited: 2010-05-13 13:27:12 by piumarta on emilia-2.local PATH=/usr/bin:/bin @@ -14,7 +14,9 @@ dir=`cd "${dir}" && pwd -P` path=`basename "${path}"` path=`ls -l "${dir}/${path}" | sed 's,.* -> ,,'` - path="${dir}/${path}" + if test `expr "${path}" : "/"` -eq 0; then + path="${dir}/${path}" + fi done if test -d "${path}"; then (cd "${path}" && pwd -P) @@ -91,6 +93,13 @@ export LC_ALL fi +# debug output + +if test "0$SQUEAK_DEBUG" -gt "0"; then + set | fgrep SQUEAK_ + set -x +fi + # run the vm set | fgrep SQUEAK_ Modified: trunk/platforms/unix/npsqueak/README.npsqueak =================================================================== --- trunk/platforms/unix/npsqueak/README.npsqueak 2010-05-12 00:02:20 UTC (rev 2206) +++ trunk/platforms/unix/npsqueak/README.npsqueak 2010-05-13 20:36:19 UTC (rev 2207) @@ -4,13 +4,12 @@ Author: Bert Freudenberg -Version: @VM_VERSION@ -Last edited: 2005-02-28 15:50:31 by jens on impara.de +Last edited: 2010-05-11 17:30:59 by bert ================================================================ Files: - Makefile + CMakeLists.txt README.npsqueak npsqueak.c npunix.c (modified copy from Netscape Plugin SDK) @@ -23,15 +22,15 @@ The Squeak plugin should be automatically compiled and installed with the normal squeak build process. This installs squeak into (probably) - imgdir=/usr/local/lib/squeak + squeakdir=/usr/local/lib/squeak - You will need an image. Copy it to + You will need an image. Copy it (or symlink) to - ${imgdir}/SqueakPlugin.image + ${squeakdir}/SqueakPlugin.image A good place to look for an image suited as plugin is - http://squeakland.org/plugin/installers/files.html + http://squeakland.org/download To register the plugin run ${imgdir}/npsqueakregister. It looks for various browsers @@ -39,17 +38,16 @@ your browser is not found, hack the npsqueakregister script or symlink the plugin manually: - ln -s ${imgdir}/@VM_VERSION@/npsqueak.so \ + ln -s ${squeakdir}/@VM_VERSION@/npsqueak.so \ /usr/lib/mybrowser/plugins/ - Exit and restart the browser. Check if the Squeak plugin was recognized by selecting the Help>>About Plugins menu item. Open the html file in the test/ directory. This should activate the Squeak plugin. Since this is the first time the plugin is executed, a .npsqueak folder will be created in your - home directory and the plugin image is installed into it. + home directory. ================================================================= @@ -63,41 +61,50 @@ DOCUMENTATION -* On the first run for each user, the npsqueakrun will create a directory - structure like this: +* How the plugin works: + - npsqueak.so needs to be symlinked where the browser expects plugins + - when the browser wants to display a page with an embedded Etoys + project, it launches the plugin + - the plugin executes the "npsqueakrun" script, passing some parameters + to establish a communication channel between the plugin and squeak + - that script runs the Squeak VM with an image, instructing the VM to + redirect the output into the plugin's window + - the image then loads the project + +* On the first run for each user, npsqueakrun will create a directory + structure like this (unless overridden by variables, see below): + $(HOME)/ | +--- .npsqueak/ - | - +--- SqueakPlugin.image - | - |--- *.image - | - +--- secure/ - | - +--- My Squeak/ + | | + | +--- secure/ + | + +--- Squeak/ - $(imgdir)/ - | - +--- SqueakPlugin.image - * Environment Variables: SQUEAK_USERDIR Identifies the sandbox directory, e.g., a place which can be accessed from any (potentially unsafe) Squeaklet. - * path must be absolute + * Default: "$(HOME)/Squeak" - * Default: "~/.npsqueak/My Squeak" - + SQUEAK_SECUREDIR + Identifies the directory to store private information + like signing keys. + * should not be accessible by other users + + * Default: "$(HOME)/.npsqueak/secure" + NPSQUEAK_DEBUG - logs debug info to /tmp/npsqueak.log - Default: don't log + If set, logs debug info to /tmp/npsqueak.log + * Default: unset + * Mimetypes: application/x-squeak-source:sts:Squeak source @@ -121,12 +128,25 @@ * loop on read() and write() until all data is sent and received. * make plugin not wait for browser when the url is loaded into a target. -* use autoconf ================================================================= Change log +May 2010: + * use CMake + * default to ~/Squeak + * do not copy image to ~/.npsqueak anymore + +Aug 2009: + * (ikp) BSD-friendly Makefile + +Sep 2007: + * (bf) use "find -H" in npsqueakregister + +Sep 2006: + * (ikp) use libtool to build + Jan 2005: * npsqueak checks for image file in system and home dir * modified npsqueakrun, runs with bash, other shells untested Modified: trunk/platforms/unix/npsqueak/npsqueak.c =================================================================== --- trunk/platforms/unix/npsqueak/npsqueak.c 2010-05-12 00:02:20 UTC (rev 2206) +++ trunk/platforms/unix/npsqueak/npsqueak.c 2010-05-13 20:36:19 UTC (rev 2207) @@ -4,7 +4,7 @@ * * Author: Bert Freudenberg * - * Last edited: 2005-03-17 12:15:48 by piumarta on squeak.hpl.hp.com + * Last edited: 2010-05-11 20:31:45 by bert * * History: * Jan 2005 - looking for image and npsqueakrun in system and home dir @@ -283,7 +283,7 @@ char* bin_dir_v[PATH_MAX]= {user_bin_dir, SYSTEM_BIN_DIR"/"}; if (findFileInPaths(plugin->vmName, NPSQUEAKRUN, 2 , bin_dir_v) == 0){ - fprintf(stderr, "Squeak Plugin: npsqueakrun not found!\n"); + fprintf(stderr, "Squeak Plugin: "NPSQUEAKRUN" not found!\n"); return NPERR_GENERIC_ERROR; } } @@ -298,7 +298,7 @@ failureUrl); plugin->failureUrl= NPN_StrDup(failureUrl); }else { - fprintf(stderr, "Squeak Plugin: no failure URL: \n"); + fprintf(stderr, "Squeak Plugin: no failure URL.\n"); return NPERR_GENERIC_ERROR; } } Modified: trunk/platforms/unix/npsqueak/npsqueakregister.in =================================================================== --- trunk/platforms/unix/npsqueak/npsqueakregister.in 2010-05-12 00:02:20 UTC (rev 2206) +++ trunk/platforms/unix/npsqueak/npsqueakregister.in 2010-05-13 20:36:19 UTC (rev 2207) @@ -7,7 +7,7 @@ # Rerun after you installed a new browser! # Parameters: -u unregister -NPSQUEAK_SO=@NPSQUEAK_SO@ +NPSQUEAK_SO=@prefix@/@plgdir@/npsqueak.so BROWSERS="netscape mozilla mozilla-firefox opera MozillaFirefox/lib" BROWSER_DIRS="/usr/local/lib /usr/lib /opt" SYSTEM_BROWSER_DIR="/usr/lib/browser-plugins" @@ -19,7 +19,7 @@ echo "Registers the Squeak browser plugin for known browsers" echo " -u unregister plugin" echo " PLUGIN absolute path to npsqueak.so" - echo " (default is @NPSQUEAK_SO@)" + echo " (default is $NPSQUEAK_SO)" exit } Modified: trunk/platforms/unix/npsqueak/npsqueakrun.in =================================================================== --- trunk/platforms/unix/npsqueak/npsqueakrun.in 2010-05-12 00:02:20 UTC (rev 2206) +++ trunk/platforms/unix/npsqueak/npsqueakrun.in 2010-05-13 20:36:19 UTC (rev 2207) @@ -2,19 +2,39 @@ # File: npsqueakrun # Author: Bert Freudenberg -# Last edited: 2005-02-28 18:42:20 by jens on impara.de # Description: Script to start the Squeak VM binary # from the Browser Plugin (npsqueak.so) -# If necessary, sets up $HOME/.npsqueak/* first. +# If necessary, sets up $HOME/.npsqueak first. +# Arguments: +# $0 = @prefix@/@imgdir@/npsqueakrun +# $1,$2 = -display :0.0 +# $3-$5 = -browserPipes 9 12 +# $6 = /path/to/some.image +# $7 = '' +# $8,$9 = key1 value1 (tags as given in the html page) +# etc. = key2 value2 -VM_VERSION=@VM_VERSION@ -imgdir=@imgdir@ - -IMAGE=${imgdir}/SqueakPlugin.image -VM=squeak -VMOPTIONS=" -mmap 1024 -vm-display-x11 -swapbtn " +VM=@prefix@/@bindir@/squeak +VMOPTIONS= LOGFILE=/tmp/npsqueak.log +realpath () { + path="$1" + while test -L "${path}"; do + dir=`dirname "${path}"` + dir=`cd "${dir}" && pwd -P` + path=`basename "${path}"` + path=`ls -l "${dir}/${path}" | sed 's,.* -> ,,'` + done + if test -d "${path}"; then + (cd "${path}" && pwd -P) + else + dir=`dirname "${path}"` + base=`basename "${path}"` + (cd "${dir}" && echo "`pwd -P`/${base}") + fi +} + pdebug() { if [ ! -z $NPSQUEAK_DEBUG ]; then @@ -31,18 +51,6 @@ fi } -# is there a clever way to determine if you are local? -if [ $DISPLAY = ":0.0" ]; then - VMOPTIONS=$VMOPTIONS" -xshm " - pdebug "using x shared memory" -else - pdebug "disabling x shared memory, because we are not local" -fi - -if [ -e /usr/bin/squeakvm ]; then - VM=squeakvm -fi - ensuredir() { if [ ! -d "${1}" ] ; then @@ -57,49 +65,8 @@ fi } -ensurefile() +parameter_to_array() { - if [ ! -e "${1}" ] ; then - if cp "${2}" "${1}" ; then - pdebug "Created ${1}" - else - perror "Could not create ${1}" - if [ ! -r "${2}" ] ; then - perror "because ${2} is missing" - fi - fi - fi -} - -ensureimage() -{ - if [ `dirname "${1}"` = "${HOME}/.npsqueak" ] ; then - IMAGE=$1 - else - IMAGE="${HOME}/.npsqueak/"`basename "$1"` - ensurefile "$IMAGE" "$1" - fi -} - -ensure() -{ - if [ `dirname "${1}"` = "${HOME}/.npsqueak" ] ; then - IMAGE=$1 - else - IMAGE="${HOME}/.npsqueak/"`basename "$1"` - ensurefile "$IMAGE" "$1" - fi -} - -if [ -e "${HOME}/.npsqueak" ] ; then - pdebug "don't create MySqueak link on desktop," - pdebug "because ${HOME}/.npsqueak exists" -else - pdebug "create MySqueak link on desktop" - ln -s "${HOME}/.npsqueak/My Squeak" "${HOME}/Desktop/My Squeak" -fi - -parameter_to_array(){ i=0 for p in "$@"; do i=$(( $i + 1 )) @@ -107,27 +74,17 @@ done } -ensuredir "${HOME}/.npsqueak" -ensuredir "${HOME}/.npsqueak/secure" 700 -if [ ! -z "$SQUEAK_USERDIR" ]; then - pdebug "using SQUEAK_USERDIR" - pdebug "My Squeak -> $SQUEAK_USERDIR" -else - pdebug "My Squeak -> ${HOME}/.npsqueak/My Squeak" - ensuredir "${HOME}/.npsqueak/My Squeak" -fi +[ -z "$SQUEAK_USERDIR" ] && export SQUEAK_USERDIR="$HOME/Squeak" +[ -z "$SQUEAK_SECUREDIR" ] && export SQUEAK_SECUREDIR="$HOME/.npsqueak/secure" -if [ -z "$1" ]; then - pdebug "start squeak direct" - ensureimage $IMAGE - $VM $VMOPTIONS $IMAGE -else - pdebug "start squeak from plugin" - IMAGE="${6}" - ensureimage $IMAGE - parameter_to_array "$@" - parameter[6]=$IMAGE - $VM $VMOPTIONS "${parameter[@]}" -fi +ensuredir "$SQUEAK_USERDIR" +ensuredir "$SQUEAK_SECUREDIR" 700 +# resolve image symlink so Smalltalk imagePath is correct +IMAGE="${6}" +parameter_to_array "$@" +parameter[6]=`realpath "$IMAGE"` + +$VM $VMOPTIONS "${parameter[@]}" + |
Free forum by Nabble | Edit this page |