3.2. The Debian package source tree

The source archive scheme described later is intended to allow a Debian package source tree with some associated control information to be reproduced and transported easily. The Debian package source tree is a version of the original program with certain files added for the benefit of the packaging process, and with any other changes required made to the rest of the source code and installation scripts.

The extra files created for Debian are in the subdirectory debian of the top level of the Debian package source tree. They are described below.

3.2.1. debian/rules - the main building script

See Main building script: debian/rules.

3.2.2. debian/substvars and variable substitutions

See Variable substitutions: debian/substvars.

3.2.3. debian/files

See Generated files list: debian/files.

3.2.4. debian/tmp

This is the default temporary location for the construction of binary packages by the binary target. The directory tmp serves as the root of the file system tree as it is being constructed (for example, by using the package’s upstream makefiles install targets and redirecting the output there), and it also contains the DEBIAN subdirectory. See Creating package files - dpkg-deb.

This is only a default and can be easily overridden. Most packaging tools no longer use debian/tmp, instead preferring debian/pkg for the common case of a source package building only one binary package. Such tools usually only use debian/tmp as a temporary staging area for built files and do not construct packages from it.

If several binary packages are generated from the same source tree, it is usual to use a separate debian/pkg directory for each binary package as the temporary construction locations.

Whatever temporary directories are created and used by the binary target must of course be removed by the clean target.