O'Reilly logo

Linux in a Nutshell, 6th Edition by Robert Love, Stephen Figgins, Ellen Siever, Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The rpmbuild Command

The rpmbuild command is used to build RPM packages. The syntax for rpmbuild is:

rpmbuild -[b|t] stage [build-options] spec-file ...

Specify -b to build a package directly from a spec file, or -t to open a tarred, gzipped file and use its spec file.

Both forms take the following single-character stage arguments, which specify the stages, or steps, required to build a package. The stages are listed in the order they would be performed:

p

Perform the prep stage, unpacking source files and applying patches.

l

Do a list check, expanding macros in the files section of the spec file and -verifying that each file exists.

c

Perform the prep and build stages; generally equivalent to doing a make.

i

Perform the prep, build, and install stages; generally equivalent to doing a make install.

b

Perform the prep, build, and install stages, then build a binary package.

s

Build a source package.

a

Perform the prep, build, and install stages, then build both binary and source packages.

The difference between the build stage, which is one of the early steps, and building a binary package in b or ais the difference between building a working binary for the software and putting all the pieces together into a final rpm package.

rpmbuild options

The general rpm options described under General options in General options can be used with rpmbuild.

The following additional options can also be used when building an rpm file with rpmbuild:

--buildroot dir

Override the BuildRoot tag with dir when building the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required