Previous section   Next section

Practical Programming in Tcl & Tk, Third Edition
By Brent B. Welch

Table of Contents
Chapter 45.  Compiling Tcl and Extensions

Standard Directory Structure

The Source Distribution

Table 45-1 describes the directory structure of the Tcl source distribution. The Tk distribution is similar, and you should model your own source distribution after this. It is also standard to place the Tcl, Tk, and other source packages under a common source directory (e.g., /usr/local/src or /home/welch/cvs). In fact, this may be necessary if the packages depend on each other.

Table 45-1. The Tcl source directory structure.
tcl8.2The root of the Tcl sources. This contains a README and license_terms file, and several subdirectories.
tcl8.2/compatThis contains .c files that implement procedures that are otherwise broken in the standard C library on some platforms. They are only used if necessary.
tcl8.2/docThis contains the reference documentation. Currently this is in nroff format suitable for use with the UNIX man program. The goal is to convert this to XML.
tcl8.2/genericThis contains the generic .c and .h source files that are shared among Unix, Windows, and Macintosh.
tcl8.2/macThis contains the .c and .h source files that are specific to Macintosh. It also contains Code Warrior project files.
tcl8.2/libraryThis contains init.tcl and other Tcl files in the standard Tcl script library.
tcl8.2/library/encodingThis contains the Unicode conversion tables.
tcl8.2/library/packageThere are several subdirectories (e.g., http2.0) that contain Tcl script packages.
tcl8.2/testThis contains the Tcl test suite. These are Tcl scripts that exercise the Tcl implementation.
tcl8.2/toolsThis is a collection of scripts used to help build the Tcl distribution.
tcl8.2/unixThis contains the .c and .h source files that are specific to UNIX. This also contains the configure script and the Makefile.in template.
tcl8.2/unix/dltestThis contains test files for dynamic loading.
tcl8.2/unix/platformThese can be used to build Tcl for several different platforms. You create the package directories yourself.
tcl8.2/winThis contains the .c and .h source files that are specific to Windows. This also contains the configure script and the Makefile.in template. This may contain a makefile.vc that is compatible with nmake.

The Installation Directory Structure

When you install Tcl, the files end up in a different arrangement than the one in the source distribution. The standard installation directory is organized so it can be shared by computers with different machine types (e.g., Windows, Linux, and Solaris). The Tcl scripts, include files, and documentation are all in shared directories. The applications and programming libraries (i.e., DLLs) are in platform-specific directories. You can choose where these two groups of files are installed with the --prefix and --exec-prefix options to configure, which is explained in detail in the next section. Table 45-2 shows the standard installation directory structure:

Table 45-2. The installation directory structure.
arch/binThis contains platform-specific applications. On Windows, this also contains binary libraries (i.e., DLLs). Typical arch names are solaris-sparc, linux-ix86, and win-ix86.
arch/libThis contains platform-specific binary libraries on UNIX systems (e.g., libtcl8.2.so)
binThis contains platform-independent applications (e.g., Tcl script applications).
docThis contains documentation.
includeThis contains public .h files
libThis contains subdirectories for platform-independent script packages. Packages stored here are found automatically by the Tcl auto loading mechanism described in Chapter 12.
lib/tcl8.2This contains the contents of the tcl8.2/library source directory, including subdirectories.
lib/packageThis contains Tcl scripts for package. Example package directories include tk8.2 and itcl3.0.1.
manThis contains reference documentation in UNIX man format.

If you are an expert in configure, you may be aware of other options that give you even finer control over where the different parts of the installation go. However, because of the way Tcl automatically searches for scripts and binary libraries, you should avoid deviating from the recommended structure.

      Previous section   Next section