Building XFree86® from a Source Distribution : Using a shadow directory of symbolic links for the build
Previous: Configuring the source before building
Next: Building and installing the distribution

## 3. Using a shadow directory of symbolic links for the build

We recommend that you use a shadow directory of symbolic links to do the build of XFree86, because it allows you to keep the source directory unmodified during the build process. It has the following benefits:

- Foreign files not under CVS's control are not touched.
- Greater flexibility in building XFree86 for several different Operating Systems or hardware architectures from the same sources; shared by read-only NFS mounts.
- Different configuration options can be created by putting a real copy of the `host.def` file in each build tree and by customizing it separately in each build tree, and then customizing it separately.

To make a shadow directory of symbolic links, use the following steps:

- create the directory at the top of the build tree. This is often created at the same level that the `xc` directory.

  > `cd the directory containing the xc directory
  > mkdir build`

- use the "`lndir`" command to make the shadow tree:

  > `cd build
  > lndir ../xc`

  Note: You can refer to the `xc` directory by referencing it with an absolute path also.

  See the lndir(1) manual page for details.

If the `lndir` command is not already available on your system, you can build it manually from the XFree86 sources by running the following commands:

> `cd xc/config/util
> make -f Makefile.ini lndir
> cp lndir some directory in your PATH`

Occasionally there may be stale links in the build tree. This happens when files in the source tree are either removed or renamed. These stale links can be cleaned by running the "`cleanlinks`" script from the build directory (see the cleanlinks(1) manual page for further details).

Rarely will there be changes that require the build tree to be re-created from scratch. If you think that this may be the case, look for build problems, which could indicate that this is the problem. The best solution in this scenario is to remove the build tree,and then re-create it using the steps outlined above.

Building XFree86® from a Source Distribution : Using a shadow directory of symbolic links for the build
Previous: Configuring the source before building
Next: Building and installing the distribution