Previous Up Next

Chapter 14  Installation

This chapter describes how to install and use the Tom system.

14.1  Requirements

Tom is a Java application written with JDK 1.5. Tom is platform independent and runs on various systems. It has been used successfully on many platforms, including Linux (Debian, Mandrake, Ubuntu), FreeBSD, NetBSD, MacOS X, and Windows XP.

The only requirement to run Tom is to have a recent Java Runtime Environment installed (version 1.5 or newer) and/or the Eclipse platform (3.2 or newer). In addition, Ant can be useful to compile the system and the examples:

14.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
   |     +--- runtime (BSD Licence)
   |     +--- tom (GPL Licence)
   |     +--- tools
   |
   +--- 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.5 or newer is required.

14.2.1  Windows

For a painless process, please use the install kit provided. This will automatically update the environment as needed.

Anyway, if for any reason you want to do it all manually, here is the procedure you need to follow:

We assume that Tom is installed in c:\tom. The following steps are needed for setting up the environment:

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

14.2.2  Windows with Cygwin

If you installed Tom using the install kit, the installation is complete. If you want to install it manually (not recommended), please use the following instructions.

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:

  for i in "${TOM_HOME}"/lib/runtime/*.jar
  do
    TOM_LIB="$TOM_LIB:$i"
  done
  export CLASSPATH=${TOM_LIB}:${CLASSPATH}
Note: we recommend to add current directory . in your CLASSPATH.

14.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)
  for i in "${TOM_HOME}"/lib/runtime/*.jar
  do
    TOM_LIB="$TOM_LIB:$i"
  done
  export CLASSPATH=${TOM_LIB}:${CLASSPATH}

(csh)
  set TOM_LIB=`echo ${TOM_HOME}/lib/runtime/*.jar | tr ' ' ':'`
  setenv CLASSPATH ${TOM_LIB}:${CLASSPATH}
Note: we recommend to add current directory . in your CLASSPATH.

14.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.

14.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.

14.4  Compiling Tom from sources (*)

14.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}.

14.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.5 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.7 or more, and a Java environment compatible with Java 1.5.

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.

14.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

14.4.4  Setup

To setup Tom after a source build, you can simply follow the configuration instructions for the binary distribution found in Section 14, using either ${TOM_BASE}/stable/dist or ${TOM_BASE}/src/dist for value for the TOM_HOME environment variable.


Previous Up Next