Download the main build.xml script from here.
Create a new directory, and copy the newly download build.xml to it. This
  directory will be referred to as the ${tomcat.source} directory in the rest
  of this document.
Go to that directory, and do:
    cd ${tomcat.source}
    ant
NOTE: Users accessing the Internet through a proxy must use a properties
  file to indicate to Ant the proxy configuration. Read below.
WARNING: Running this command will checkout the Tomcat 5 sources from CVS, as
  well as download binaries to the /usr/share/java directory. 
  Make sure this is appropriate to do so on your computer. On Windows, 
  this usually corresponds to the C:\usr\share\java directory, 
  unless Cygwin is used. Read below to customize the directory used 
  to download the binaries.
The build can be controlled by creating a ${tomcat.source}/build.properties
  file, and adding the following content to it:
    # ----- Proxy setup -----
    # Uncomment if using a proxy server.
    #proxy.host=proxy.domain
    #proxy.port=8080
    #proxy.use=on
    # ----- Default Base Path for Dependent Packages -----
    # Replace this path with the directory path where
    # dependencies binaries should be downloaded.
    base.path=/usr/share/java