RPMBUILD(8) | RPMBUILD(8) |
rpmbuild - Build RPM Package(s)
rpmbuild {-ba|-bb|-bp|-bf|-bc|-bi|-bl|-bs|-br|-bd} [rpmbuild-options] SPECFILE ...
rpmbuild {-ra|-rb|-rp|-rf|-rc|-ri|-rl|-rs|-rr|-rd} [rpmbuild-options] SOURCEPACKAGE ...
rpmbuild {-ta|-tb|-tp|-tf|-tc|-ti|-tl|-ts|-tr|-td} [rpmbuild-options] TARBALL ...
rpmbuild {--rebuild|--recompile} SOURCEPKG ...
rpmbuild --showrc
[--buildroot DIRECTORY] [--clean] [--nobuild] [--rmsource] [--rmspec] [--short-circuit] [--build-in-place] [--noprep] [--noclean] [--nocheck] [--rpmfcdebug] [--target PLATFORM] [--with OPTION] [--without OPTION]
rpmbuild is used to build both binary and source software packages. A package 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. Packages 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.
One of the following basic modes must be selected: Build Package, Build Package from Tarball, Recompile Package, Show Configuration.
These options can be used in all the different modes.
The general form of an rpm build command is
rpmbuild {-bSTAGE|-rSTAGE|-tSTAGE} [rpmbuild-options] FILE ...
The argument used is -b if a spec file is being used to build the package, -r if a source package is to be rebuilt and -t if rpmbuild should look inside of a (possibly compressed) tar file for the spec file to use.
Packages are built in a number of stages. The first six correspond to the following sections in a spec file: %prep, %generate_buildrequires, %build, %install, %check and %clean. Finally, binary and source packages are created in an assembly stage.
The STAGE character specifies the stage to finish with (after doing all the stages preceding it), and is one of:
The following options may also be used:
There are two other ways to invoke building with rpm:
rpmbuild --rebuild|--recompile SOURCEPKG ...
When invoked this way, rpmbuild installs the named source package, and does a prep, compile and install. In addition, --rebuild builds a new binary package. When the build has completed, the build directory is removed (as in --clean) and the the sources and spec file for the package are removed.
These options are now superseded by the -r* options which allow much more fine control over what stages of the build to run.
When the %generate_buildrequires stage runs and some of the newly generated BuildRequires are not satisfied, rpmbuild creates an intermediate source package ending in buildreqs.nosrc.rpm, 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 dnf-builddep(8).
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 -br command, install the new dependencies of the buildreqs.nosrc.rpm package and repeat the whole procedure until rpmbuild no longer exits with code 11.
If the -br command is coupled with --nodeps, exit code 11 is always returned and a buildreqs.nosrc.rpm package is always created.
The command
rpmbuild --showrc
shows the values rpmbuild will use for all of the options are currently set in rpmrc and macros configuration file(s).
/usr/lib/rpm/rpmrc /usr/lib/rpm/<vendor>/rpmrc /etc/rpmrc ~/.rpmrc
/usr/lib/rpm/macros /usr/lib/rpm/<vendor>/macros /etc/rpm/macros ~/.rpmmacros
/var/tmp/rpm*
rpmbuild --help - 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.
http://www.rpm.org/ <URL:http://www.rpm.org/>
Marc Ewing <marc@redhat.com> Jeff Johnson <jbj@redhat.com> Erik Troan <ewt@redhat.com>
09 June 2002 |