RPM requires a set of directories in which to perform the build. While the directories' locations and names can be changed, unless there's a reason to do so, it's best to use the default layout. Note that if you've installed RPM, the build directories are most likely in place already.
The normal directory layout consists of a single top-level directory (The default name is /usr/src/redhat), with five subdirectories. The five subdirectories and their functions are:
In general, there are no special requirements that need to be met when creating these directories. In fact, the only important requirement is that the BUILD directory be part of a filesystem with sufficient free space to build the largest package expected. Here is a directory listing showing a typical build directory tree:
# ls -lF /usr/src/redhat total 5 drwxr-xr-x 3 root root 1024 Aug 5 13:12 BUILD/ drwxr-xr-x 3 root root 1024 Jul 17 17:51 RPMS/ drwxr-xr-x 4 root root 1024 Aug 4 22:31 SOURCES/ drwxr-xr-x 2 root root 1024 Aug 5 13:12 SPECS/ drwxr-xr-x 2 root root 1024 Aug 4 22:28 SRPMS/ #
Now that we have the directories ready to go, it's time to prepare for the build. For the remainder of this chapter, we'll be building a fictional piece of software known as cdplayer.1