Product SiteDocumentation Site

11.2. Building RPMs Without an External Spec File

Most of the options for the rpmbuild command require an RPM spec file. This file defines all the necessary parameters for the RPM to build. If you’ve downloaded an application, though, you may not have all the information needed to build a spec file. In addition, writing the spec file is the most time-consuming task when building RPMs. If you are lucky, the provider of a given application may have already created a spec file and included the spec file within the source distribution.

11.2.1. Options for working with tar archives

A special set of options aims toward building RPMs with spec files stored in tar archives, also called tarballs. Tarballs are files combined with the tar (tape archiver) utility and then optionally compressed, usually with the gzip command. Because this format is used so often for UNIX and Linux software, you can use a set of -t options to the rpmbuild command that mimic the -b options.
The basic syntax follows:
rpmbuild -tBuildStage compressed_tar_archive
The -t option is a lot like the -b option covered in Chapter 8, Creating RPMs: An Overview , except -t tells rpmbuild to build an RPM from a compressed tar archive instead of from an RPM spec file. You still need a spec file. These commands just assume that the spec file is located within the tar archive. The extra BuildStage option is a special code that tells the rpmbuild command how far to go when building. Table 12-2 lists these options:
Table 12-2 Options for building with rpmbuild with tar archives
Build all, both a binary and source RPM
Build a binary RPM
Stop after the %build section
Stop after the %prep section
Stop after the %install section
Check the listing of files for the RPM
Build a source RPM only
These command-line options work with a tar archive or a compressed tar archive.