This chapter describes how to install and use the Tom system.
9.1 Requirements
Tom is a Java application written with JDK 1.4. Tom is platform
independent and runs on various systems. It has been used successfully
on many platforms, including Linux (Mandrake, Debian), FreeBSD, NetBSD,
MacOS X, and Windows XP.
The only requirement to run Tom is to have a recent Java Runtime
Environment installed (version 1.4.x or newer) and/or the Eclipse
platform (3.2 or newer). In addition, Ant can be useful to
compile the system and the examples:
9.2 Installing Tom
The binary distribution of Tom consists of the following directory layout:
tom
+--- bin // contains launcher scripts
+--- lib // contains Tom jars and necessary dependencies
+--- share
+--- contrib
+--- man
+--- tom // contains predefined mapping
+--- adt
+--- c
+--- caml
+--- java
To install Tom, choose a directory and copy the distribution files there.
This directory will be designed in the following by TOM_HOME.
JDK 1.4.2 or newer is required.
9.2.1 Windows
We assume that Tom is installed in c:\tom. The following steps are needed for
setting up the environment:
-
set environment variable TOM_HOME=c:\tom
- add %TOM_HOME%\bin to your PATH variable
- check that JAVA_HOME is correctly defined, and that %JAVA_HOME%\bin is in your PATH variable
For a detailed description of setting environment variables in
Windows, please refer to Windows documentation. For Windows XP, some
information can be found here:
http://support.microsoft.com/default.aspx?scid=kb;en-us;310519&sd=tech
9.2.2 Windows with Cygwin
We assume that Tom is installed in
c:\tom\. Please issue the following
for setting up Tom:
export TOM_HOME=/cygdrive/c/tom
export PATH=${PATH}:${TOM_HOME}/bin
We also suggest you to define a TOM_LIB variable and update your
CLASSPATH accordingly:
TOM_LIB=`echo ${TOM_HOME}/lib/*.jar | tr ' ' ':'`
export CLASSPATH=${TOM_LIB}:${CLASSPATH}
Note: we recommend to add current directory . in your CLASSPATH.
9.2.3 Unix
Assuming Tom is installed in /usr/local/tom. The following
sets up the environment:
(bash)
export TOM_HOME=/usr/local/tom
export PATH=${PATH}:${TOM_HOME}/bin
(csh)
setenv TOM_HOME /usr/local/tom
set path=( $path ${TOM_HOME}/bin )
We also suggest you to define a TOM_LIB variable and update your
CLASSPATH accordingly:
(bash)
TOM_LIB=`echo ${TOM_HOME}/lib/*.jar | tr ' ' ':'`
export CLASSPATH=${TOM_LIB}:${CLASSPATH}
(csh)
set TOM_LIB=`echo ${TOM_HOME}/lib/*.jar | tr ' ' ':'`
setenv CLASSPATH ${TOM_LIB}:${CLASSPATH}
Note: we recommend to add current directory . in your CLASSPATH.
9.2.4 Eclipse plugin
The Tom eclipse plugin is available directly from the Eclipse
platform via the update link:
http://tom.loria.fr/plugin.php
From the Help menu, choose Help Content and look at the Tom Section.
You will find there everything to use Tom in a very simple way.
9.3 Getting some examples
Many examples have been written to test or illustrate some particular
behaviors. This collection of examples is available at the
http://tom.loria.fr/download.php page.
The Tom and Gom compilers are written in Tom itself. The compiler is
certainly the most complex program written in Tom. Most of the constructs
provided by Tom are used and tested in the project itself.
9.4 Compiling Tom from sources
9.4.1 Getting the sources
The Tom and Gom sources are available through anonymous cvs(1).
To get them, use the commands:
cvs -d :pserver:anonymous@scm.gforge.inria.fr:/cvsroot/tom login
cvs -d :pserver:anonymous@scm.gforge.inria.fr:/cvsroot/tom checkout -P jtom
Developer access is possible via ssh. See
Gforge for detailed
instructions.
The cvs checkout will get a new repertory in your current working
directory, called jtom. We will call this directory
${TOM_BASE}.
9.4.2 Prepare for the build
First of all, please read ${TOM_BASE}/INSTALL. Even if the current
guide should be enough, this file may contain useful information.
The Tom build process uses apache ant to
automate the all parts of the process. This build process is
specified by the ${TOM_BASE}/build.xml file. You will need to
install apache ant and java 1.4 in order to compile Tom.
Note: for Windows, you should include in your PATH variable the bin folder of the
apache ant distribution
The build process requires apache ant 1.6 or more, and a Java environment
compatible with Java 1.4.
Optionally, to customize the build environment, you will have to copy the
template configuration file ${TOM_BASE}/local.properties_template
to ${TOM_BASE}/local.properties, and edit the latter it to reflect
your setup. The most common is to set build.compiler=jikes to use the
jikes Java compiler, and build.compiler.emacs=true to get
errors in a format the emacs editor can handle.
9.4.3 Build the Tom distribution
To compile the stable distribution of Tom, you have to use the
${TOM_BASE}/build.sh script. To use it, first make sure to
cd(1) to ${TOM_BASE}. Then you can build the stable distribution.
$ ./build.sh stable
This creates the stable distribution in the directory
${TOM_BASE}/stable/dist.
To build and install the source distribution, you have to do the following:
$ ./build.sh stable
$ ./build.sh src.dist
This creates the src distribution in the directory
${TOM_BASE}/src/dist.
To list all the available targets for the build:
$ ./build.sh -projecthelp
Note:
for Windows, just use build.bat instead of build.sh
9.4.4 Setup
To setup Tom after a source build, you can simply follow the configuration
instructions for the binary distribution found in Section
9, using either ${TOM_BASE}/stable/dist or
${TOM_BASE}/src/dist for value for the TOM_HOME environment
variable.