[Vm-dev] RFC: Unix 3.11.3-2116 VM

David T. Lewis lewis at mail.msen.com
Mon Sep 14 01:00:54 UTC 2009


On 31.08.2009, at 11:08, Ian Piumarta wrote:
> 
> Unix VM hackers,
> 
> I've published a preview of the 3.11.3 Unix VM for the amusement of  
> alpha testers everywhere.  Lots of things are bound to be broken and/ 
> or forgotten and/or incomplete and/or begging for improvement.  I'm  
> not quite finished tweaking but comments and suggestions are  
> definitely welcome at this stage!

Hi Ian,

Attached is an updated platforms/cmake/configure script that does a
better job of building in a directory outside of the platforms tree.
It fixes the generation of VM_VERSION (and hence also the name of the
target install directory). It also causes --src=<directory> to do the
right thing for both VM_VERSION and for the cmake argument list when
specifying a source directory outside of the platforms tree. If the
"--src=<directory" option is not specified, it defaults to the sources
in platforms/unix/src.

For background, here is why this was a problem for me. My customary
directory layout is:

  ./SVN/squeak-svn-source-2127/platforms
  ./platforms -> ./SVN/squeak-svn-source-2127/platforms
  ./src32
  ./src64
  ./src -> ./src32
  ./build32
  ./build64

When using the config/configure script, I would work in the ./build32
(or ./build64) directory. When running configure without arguments,
the default ../src source location would follow my symlink to ../src32,
hence "cd build32; ..platforms/unix/config/configure; make; make install"
to build a VM.

When running the new cmake/configure script, I was expecting it to
find ../src32 but instead it used ../platforms/unix/src. In addition,
cmake had CMAKE_VERBOSE_MAKEFILE set to FALSE, so it cheerfully built
my VM from the wrong source directory, and I was none the wiser until
I noticed that changes to a plugin that I was debugging were not getting
included in the build.

Phew, how did I get off on that tangent? Oh, yes, I was going to look
into that "[Vm-dev] Bug in BitBlt. Need help" thing that Juan posted ;)

Dave

-------------- next part --------------
#!/bin/sh

# Last edited: 2009-08-31 13:23:58 by piumarta on ubuntu.piumarta.com

help() {
    cat <<EOF
Usage: $0 [options...]
Options include:
  --help                print this message and then exit
  --src=<directory>     look for generated interpreter sources in <directory>
  --prefix=<directory>  install into <prefix>/{bin,lib,man}
  --CFLAGS=<flags>      override default compiler flags
  --without-<plugin>    do not build the named plugin
  --without-gl          disable everything that depends on OpenGL
  --without-SUGAR       disable support for SUGAR environment
Notes:
1. By default the CFLAGS will be set to create optimised binaries.  If you are
   debugging the VM you probably want to use '--CFLAGS=-g' when invoking this
   script.
2. --CFLAGS and -without-* settings will be preserved in subsequent invocations
   of CMake, including those driven implicitly by changed dependencies.  If you
   need to turn off a seting (to re-enable a plugin or restore the default
   CFLAGS) just give the relevant options with empty arguments, like this:
     $0 --CFLAGS= --without-UUIDPlugin=
3. Wizards can set any CMake variable from the command line with the option:
     --<CMakeVariableName>=<value>
4. In case it isn't already obvious, this is NOT the autotools 'configure'
   script.  It is named so that 'configure; make' works in the expected way.
5. Bug reports, bug fixes and suggestions for improvement should be sent to the
   author (Ian Piumarta) at: <firstName> (at) <lastName> (dot) com
EOF
    stop=true
}

config="`dirname \"$0\"`"
unix="`dirname \"${config}\"`"
guess=`"${config}"/config.guess`
host=`"${config}"/config.sub ${guess}`
srcDir="${unix}/src" # default to platforms/unix/src

stop=false
debug_configure=false

error () {
    echo "$*" >&2
}

dump () {
    echo "VM_VERSION = ${VM_VERSION}"
    echo "unix       = ${unix}"
    echo "config     = ${config}"
    echo "host       = ${host}"
    echo "srcDir     = ${srcDir}"
    echo "args       = ${args}"
    stop=true
}

# Set srcDir to a fully specified path name, and update cmake args to match
setSrcDir() {
    srcDirChanged="true"
    path="`echo $1 | sed 's/--src=//'`"
    srcDir="`(cd ${path}; if test $? -ne 0; then echo BADPATH; else pwd; fi)`"
    if test ${srcDir} = "BADPATH"
    then
      echo problem resolving source path for $1 as ${unix}/${offset}
      exit 1
    fi
    args="${args} -DOPT--src=${srcDir}"
}

while [ $# -gt 0 ]; do
    case $1 in
	--help)			help; exit 0;;
	--debug-configure)	dump;;
	--src=*)		setSrcDir "${1}";;
	--*=*)			args="${args} -DOPT${1}";;
	--*)			args="${args} -DOPT${1}=1";;
	-*)			args="${args} ${1}";;
	*)			error "unknown option: $1";;
    esac
    shift
done

interp_h="${srcDir}/vm/interp.h"
if test ! -f "${interp_h}"
then
    echo problem locating generated source files: ${interp_h} not found
    echo use --src= parameter to specify source files path relative to ${unix}
    exit 1
fi

vmmversion="`tr '\015 ' '\012\012' < \"${interp_h}\" | sed '1,/VMMaker/d;q'`"
svnversion=`svn info "${unix}/ChangeLog" | fgrep Revision: | awk '{print $2}'`

VM_VERSION="${vmmversion}-${svnversion}"alpha

if ${stop}; then
    exit 1
fi

echo "-- Configuring squeak ${VM_VERSION} for ${host}"

cmake ${unix} \
  -DVM_HOST="${host}" \
  -DVM_VERSION="${VM_VERSION}" \
  $args "$@"

echo -- Build will use generated sources from: ${srcDir}
if test ! $srcDirChanged
then
    echo "   (use --src=<directory> to specify generated interpreter sources in another location)"
fi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: platforms-unix-cmake-configure.diff
Type: text/x-diff
Size: 2512 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20090913/de04a58a/platforms-unix-cmake-configure.bin


More information about the Vm-dev mailing list