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.2||The root of the Tcl sources. This contains a README and license_terms file, and several subdirectories.|
|tcl8.2/compat||This 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/doc||This 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/generic||This contains the generic .c and .h source files that are shared among Unix, Windows, and Macintosh.|
|tcl8.2/mac||This contains the .c and .h source files that are specific to Macintosh. It also contains Code Warrior project files.|
|tcl8.2/library||This contains init.tcl and other Tcl files in the standard Tcl script library.|
|tcl8.2/library/encoding||This contains the Unicode conversion tables.|
|tcl8.2/library/package||There are several subdirectories (e.g., http2.0) that contain Tcl script packages.|
|tcl8.2/test||This contains the Tcl test suite. These are Tcl scripts that exercise the Tcl implementation.|
|tcl8.2/tools||This is a collection of scripts used to help build the Tcl distribution.|
|tcl8.2/unix||This 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/dltest||This contains test files for dynamic loading.|
|tcl8.2/unix/platform||These can be used to build Tcl for several different platforms. You create the package directories yourself.|
|tcl8.2/win||This 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/bin||This 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/lib||This contains platform-specific binary libraries on UNIX systems (e.g., libtcl8.2.so)|
|bin||This contains platform-independent applications (e.g., Tcl script applications).|
|doc||This contains documentation.|
|include||This contains public .h files|
|lib||This 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.2||This contains the contents of the tcl8.2/library source directory, including subdirectories.|
|lib/package||This contains Tcl scripts for package. Example package directories include tk8.2 and itcl3.0.1.|
|man||This 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.