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
Option
Usage
-ta
Build all, both a binary and source RPM
-tb
Build a binary RPM
-tc
Stop after the %build section
-tp
Stop after the %prep section
-ti
Stop after the %install section
-tl
Check the listing of files for the RPM
-ts
Build a source RPM only
Note
These command-line options work with a tar archive or a compressed tar archive.