initCommon(); $template->displayHeader(); ?>

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 9, 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.

11.2.2. The expected archive structure

To build a package this way, the tar archive must have enough of an expected structure, such as a configure script and a Makefile with the expected make targets. The most crucial element is that the tar archive must have the package spec file.That’s because the rpmbuild command doesn’t know how to build every program in the universe. Instead, rpmbuild expects to find a spec file to tell it what to do. If you see an error like the following, then your tar archive likely is missing the spec file:

$ rpmbuild -tc vixie-cron*tar.gz

error: Name field must be present in package: (main package)

error: Version field must be present in package: (main package)

error: Release field must be present in package: (main package)

error: Summary field must be present in package: (main package)

error: Group field must be present in package: (main package)

error: License field must be present in package: (main package)

These errors show expected tags from the missing spec file.

displayFooter('$Date: 2005/11/02 19:30:06 $'); ?>