.\" This manpage has been automatically generated by docbook2man
.\" from a DocBook document. This tool can be found at:
.\"
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng .
.TH "RPMBUILD" "8" "09 June 2002" "Red Hat, Inc."
.SH NAME
rpmbuild \- Build RPM Package(s)
.SH SYNOPSIS
.SS "BUILDING PACKAGES:"
.PP
\fBrpmbuild\fR {\fB-ba|-bb|-bp|-bc|-bi|-bl|-bs|-br\fR} [\fBrpmbuild-options\fR] \fB\fISPECFILE\fB\fR\fI ...\fR
\fBrpmbuild\fR {\fB-ra|-rb|-rp|-rc|-ri|-rl|-rs|-rr\fR} [\fBrpmbuild-options\fR] \fB\fISOURCEPACKAGE\fB\fR\fI ...\fR
\fBrpmbuild\fR {\fB-ta|-tb|-tp|-tc|-ti|-tl|-ts|-tr\fR} [\fBrpmbuild-options\fR] \fB\fITARBALL\fB\fR\fI ...\fR
\fBrpmbuild\fR {\fB--rebuild|--recompile\fR} \fB\fISOURCEPKG\fB\fR\fI ...\fR
.SS "MISCELLANEOUS:"
.PP
\fBrpmbuild\fR \fB--showrc\fR
.SS "rpmbuild-options"
.PP
[\fB--buildroot \fIDIRECTORY\fB\fR] [\fB--clean\fR] [\fB--nobuild\fR]
[\fB--rmsource\fR] [\fB--rmspec\fR] [\fB--short-circuit\fR] [\fB--build-in-place\fR]
[\fB--noprep\fR] [\fB--noclean\fR] [\fB--nocheck\fR]
[\fB--rpmfcdebug\fR]
[\fB--target \fIPLATFORM\fB\fR]
[\fB--with \fIOPTION\fB\fR] [\fB--without \fIOPTION\fB\fR]
.SH "DESCRIPTION"
.PP
\fBrpmbuild\fR is used to build both binary and source software packages.
A \fBpackage\fR consists of an archive of files and
meta-data used to install and erase the archive files. The meta-data
includes helper scripts, file attributes, and descriptive information
about the package.
\fBPackages\fR come in two varieties: binary packages,
used to encapsulate software to be installed, and source packages,
containing the source code and recipe necessary to produce binary
packages.
.PP
One of the following basic modes must be selected:
\fBBuild Package\fR,
\fBBuild Package from Tarball\fR,
\fBRecompile Package\fR,
\fBShow Configuration\fR.
.SS "GENERAL OPTIONS"
.PP
These options can be used in all the different modes.
.TP
\fB-?, --help\fR
Print a longer usage message then normal.
.TP
\fB--version\fR
Print a single line containing the version number of \fBrpm\fR
being used.
.TP
\fB--quiet\fR
Print as little as possible - normally only error messages will
be displayed.
.TP
\fB-v\fR
Print verbose information - normally routine progress messages will be
displayed.
.TP
\fB-vv\fR
Print lots of ugly debugging information.
.TP
\fB--rpmfcdebug\fR
Enables to debug dependencies generation.
.TP
\fB--rcfile \fIFILELIST\fB\fR
Each of the files in the colon separated
\fIFILELIST\fR
is read sequentially by \fBrpm\fR for configuration
information.
Only the first file in the list must exist, and tildes will be
expanded to the value of \fB$HOME\fR.
The default \fIFILELIST\fR is
\fI/usr/lib/rpm/rpmrc\fR:\fI/usr/lib/rpm//rpmrc\fR:\fI/etc/rpmrc\fR:\fI~/.rpmrc\fR.
.TP
\fB--pipe \fICMD\fB\fR
Pipes the output of \fBrpm\fR to the command \fICMD\fR.
.TP
\fB--dbpath \fIDIRECTORY\fB\fR
Use the database in \fIDIRECTORY\fR rather
than the default path \fI/var/lib/rpm\fR
.TP
\fB--root \fIDIRECTORY\fB\fR
Use the file system tree rooted at \fIDIRECTORY\fR for all operations.
Note that this means the database within
\fIDIRECTORY\fR
will be used for dependency checks and any scriptlet(s) (e.g.
\fB%post\fR if installing, or
\fB%prep\fR if building, a package)
will be run after a chroot(2) to
\fIDIRECTORY\fR.
.TP
\fB-D, --define='\fIMACRO EXPR\fB'\fR
Defines \fIMACRO\fR with value \fIEXPR\fR.
.TP
\fB--scm=\fISCM\fR
Select the \fISCM\fR to use with %autosetup, if one is not set in the spec file.
Note that not all values for \fISCM\fR, e.g., \fBpatch\fR (the default) and
\fBgendiff\fR, \fBgit\fR, or \fBquilt\fR work interchangeably with all
other patches and options stated in the %autosetup line, especially
option \fB-p\fIN\fR.
.SS "BUILD OPTIONS"
.PP
The general form of an rpm build command is
.PP
\fBrpmbuild\fR {\fB-b\fISTAGE\fB|-r\fISTAGE\fB|-t\fISTAGE\fB\fR} [\fBrpmbuild-options\fR] \fB\fIFILE\fB\fR\fI ...\fR
.PP
The argument used is \fB-b\fR if a spec file is being
used to build the package, \fB-r\fR if a source package is to be rebuilt
and \fB-t\fR if \fBrpmbuild\fR
should look inside of a (possibly compressed) tar file for
the spec file to use.
.PP
Packages are built in a number of stages.
The first six correspond to the following sections in a spec file: \fB%prep\fR,
\fB%generate_buildrequires\fR, \fB%build\fR, \fB%install\fR, \fB%check\fR and
\fB%clean\fR.
Finally, binary and source packages are created in an assembly stage.
.PP
The \fISTAGE\fR character specifies the stage to finish with (after doing all
the stages preceding it), and is one of:
.TP
\fB-ba\fR
Perform a full build - executes up to and including the assembly stage.
In most cases, this is the option to choose.
.TP
\fB-bb\fR
Build just the binary packages - executes up to and including the assembly
stage, but without creating the source package.
.TP
\fB-bp\fR
Unpack the sources and apply any patches - executes the %prep stage only.
.TP
\fB-bc\fR
Compile the sources - executes up to and including the %build stage.
This generally involves the equivalent of a "make".
.TP
\fB-bi\fR
Install the binaries into the build root - executes up to and including the
%check stage.
This generally involves the equivalent of a "make install" and "make check".
.TP
\fB-bl\fR
Do a "list check" - the %files section from the spec file is macro expanded,
and checks are made to verify that each file exists.
.TP
\fB-bs\fR
Build just the source package - skips straight to the assembly stage, without
executing any of the preceding stages or creating binary packages.
.TP
\fB-br\fR
Build just the source package, but also parse and include dynamic build
dependencies - executes up to and including the %generate_buildrequires stage
and then skips straight to the assembly stage, without creating binary
packages.
This command can be used to fully resolve dynamic build dependencies.
See the DYNAMIC BUILD DEPENDENCIES section for details.
.PP
The following options may also be used:
.TP
\fB--buildroot \fIDIRECTORY\fB\fR
When building a package, override the BuildRoot tag with directory
\fIDIRECTORY\fR.
.TP
\fB--clean\fR
Remove the build tree after the packages are made.
.TP
\fB--nobuild\fR
Do not execute any build stages. Useful for testing out spec files.
.TP
\fB--noprep\fR
Do not execute %prep build stage even if present in spec.
.TP
\fB--noclean\fR
Do not execute %clean build stage even if present in spec.
.TP
\fB--nocheck\fR
Do not execute %check build stage even if present in spec.
.TP
\fB--nodebuginfo\fR
Do not generate debuginfo packages.
.TP
\fB--nodeps\fR
Do not verify build dependencies.
.TP
\fB--rmsource\fR
Remove the sources after the build (may also be
used standalone, e.g. "\fBrpmbuild\fR \fB--rmsource foo.spec\fR").
.TP
\fB--rmspec\fR
Remove the spec file after the build (may also be
used standalone, eg. "\fBrpmbuild\fR \fB--rmspec foo.spec\fR").
.TP
\fB--short-circuit\fR
Skip straight to specified stage (i.e., skip all stages leading
up to the specified stage). Only valid with \fB-bc\fR, \fB-bi\fR,
and \fB-bb\fR. Useful for local testing only. Packages built this
way will be marked with an unsatisfiable dependency to prevent
their accidental use.
.TP
\fB--build-in-place\fR
Build from locally checked out sources. Sets _builddir to current working
directory. Skips handling of -n and untar in the %setup and the deletion of
the buildSubdir.
.TP
\fB--target \fIPLATFORM\fB\fR
When building the package, interpret \fIPLATFORM\fR
as \fBarch-vendor-os\fR and set the macros
\fB%_target\fR,
\fB%_target_cpu\fR, and
\fB%_target_os\fR
accordingly.
.TP
\fB--with \fIOPTION\fB\fR
Enable configure \fIOPTION\fR for build.
.TP
\fB--without \fIOPTION\fB\fR
Disable configure \fIOPTION\fR for build.
.SS "REBUILD AND RECOMPILE OPTIONS"
.PP
There are two other ways to invoke building with rpm:
.PP
\fBrpmbuild\fR \fB--rebuild|--recompile\fR \fB\fISOURCEPKG\fB\fR\fI ...\fR
.PP
When invoked this way, \fBrpmbuild\fR installs the named source
package, and does a prep, compile and install. In addition,
\fB--rebuild\fR builds a new binary package. When the build
has completed, the build directory is removed (as in
\fB--clean\fR) and the the sources and spec file for
the package are removed.
These options are now superseded by the \fB-r*\fR options which allow
much more fine control over what stages of the build to run.
.SS "DYNAMIC BUILD DEPENDENCIES"
.PP
When the %generate_buildrequires stage runs and some of the newly generated
BuildRequires are not satisfied, \fBrpmbuild\fR creates an intermediate source
package ending in \fIbuildreqs.nosrc.rpm\fR, which has the new BuildRequires,
and exits with code 11.
This package can then be used in place of the original source package to
resolve and install the missing build dependencies in the usual way, such as
with \fBdnf-builddep(8)\fR.
.PP
Multiple layers of dynamic build dependencies may exist in a spec file; the
presence of specific BuildRequires on the system may yield new BuildRequires
next time a build is performed with the same source package.
The easiest way to ensure that all dynamic build dependencies are satisfied is
to run the \fB-br\fR command, install the new dependencies of the
\fIbuildreqs.nosrc.rpm\fR package and repeat the whole procedure until
\fBrpmbuild\fR no longer exits with code 11.
.PP
If the \fB-br\fR command is coupled with \fB\-\-nodeps\fR, exit code 11 is
always returned and a \fIbuildreqs.nosrc.rpm\fR package is always created.
.SS "SHOWRC"
.PP
The command
.PP
\fBrpmbuild\fR \fB--showrc\fR
.PP
shows the values \fBrpmbuild\fR will use for all of the
options are currently set in
\fIrpmrc\fR and
\fImacros\fR
configuration file(s).
.SH "FILES"
.SS "rpmrc Configuration"
.PP
.nf
\fI/usr/lib/rpm/rpmrc\fR
\fI/usr/lib/rpm//rpmrc\fR
\fI/etc/rpmrc\fR
\fI~/.rpmrc\fR
.fi
.SS "Macro Configuration"
.PP
.nf
\fI/usr/lib/rpm/macros\fR
\fI/usr/lib/rpm//macros\fR
\fI/etc/rpm/macros\fR
\fI~/.rpmmacros\fR
.fi
.SS "Temporary"
.PP
\fI/var/tmp/rpm*\fR
.SH "SEE ALSO"
.nf
\fBgendiff\fR(1),
\fBpopt\fR(3),
\fBrpm\fR(8),
\fBrpm2cpio\fR(8),
\fBrpmkeys\fR(8)
\fBrpmspec\fR(8),
\fBrpmsign\fR(8),
.fi
\fBrpmbuild --help\fR - as rpm supports customizing the options via popt
aliases it's impossible to guarantee that what's described in the manual
matches what's available.
\fBhttp://www.rpm.org/
\fR
.SH "AUTHORS"
.nf
Marc Ewing
Jeff Johnson
Erik Troan
.fi