.\" Generated by scdoc 1.11.4 .\" Complete documentation for this program is not available as a GNU info page .ie \n(.g .ds Aq \(aq .el .ds Aq ' .nh .ad l .\" Begin generated content: .TH "RPMBUILD" "1" "2026-01-08" "RPM 6.0.1" .PP .SH NAME rpmbuild - Build RPM Package(s) .PP .SH SYNOPSIS \fBrpmbuild\fR \fB-b\fR​\fISTAGE\fR [options] \fISPEC_FILE\fR .\&.\&.\& .PP \fBrpmbuild\fR \fB-r\fR​\fISTAGE\fR [options] \fISOURCE_PACKAGE\fR .\&.\&.\& .PP \fBrpmbuild\fR \fB-t\fR​\fISTAGE\fR [options] \fITAR_ARCHIVE\fR .\&.\&.\& .PP \fBrpmbuild\fR {\fB--rebuild\fR|\fB--recompile\fR} [options] \fISOURCE_PACKAGE\fR .\&.\&.\& .PP .SH DESCRIPTION \fBrpmbuild\fR is used to build software packages in the RPM format, in an automated and repeatable manner.\& .PP A \fIpackage\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.\& .PP 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.\& .PP .SH OPERATIONS \fB-b\fR​\fISTAGE\fR .RS 4 Build \fISTAGE\fR from a spec file.\& .PP .RE \fB-r\fR​\fISTAGE\fR .RS 4 Build \fISTAGE\fR from a source RPM package.\& .PP .RE \fB-t\fR​\fISTAGE\fR .RS 4 Build \fISTAGE\fR from a \fBtar\fR(5) archive.\& .PP .RE \fB--rebuild\fR, \fB--recompile\fR .RS 4 Compatibility aliases for \fB-ra\fR.\& .PP .RE Packages are built in four phases: parse, build, assembly and cleanup.\& The middle two are further divided into \fIstages\fR, listed below, which can be built separately.\& Building a \fISTAGE\fR means executing all the preceding stages up to (and including) the one specified, unless stated otherwise.\& .PP .SS Assembly stages The assembly stages produce packages and are the primary way of interacting with \fBrpmbuild\fR.\& If in doubt, choose one of these.\& .PP \fBa\fR .RS 4 Build both source and binary packages.\& This is not an actual stage but a combination of \fBb\fR and \fBs\fR, with the difference that packages built this way carry a "cookie" to indicate they came from the same build.\& On success, the build directory is removed.\& .PP .RE \fBb\fR .RS 4 Build just the binary packages.\& On success, the build directory is removed.\& .PP .RE \fBr\fR .RS 4 Build just the source package, checking for dynamic build dependencies.\& Executes the \fB%prep\fR and \fB%generate_buildrequires\fR stages before creating a package.\& See the \fBDYNAMIC BUILD DEPENDENCIES\fR section for details.\& .PP .RE \fBs\fR .RS 4 Build just the source package.\& No build stages are executed.\& .PP .RE .SS Build stages The build stages produce the artifacts to be packaged, typically by patching and compiling the sources, and installing the binaries into the buildroot.\& These stages generally correspond to spec sections such as \fB%prep\fR, \fB%build\fR or \fB%install\fR, but there are some which are implicit.\& .PP Building these stages separately is generally only useful when packaging new software in RPM format and/or troubleshooting.\& They are listed below in the order of execution, with the corresponding spec section in parenthesis where applicable.\& .PP \fBp\fR (%prep) .RS 4 Unpack the sources and apply any patches.\& .PP .RE \fBd\fR (%generate_buildrequires) .RS 4 Check dynamic build dependencies and build the \fIbuildreqs.\&nosrc.\&rpm\fR package if any are missing.\& Don'\&t build anything else.\& .PP .RE \fBf\fR (%conf) .RS 4 Configure the sources.\& This generally involves the equivalent of \fB.\&/configure\fR.\& .PP .RE \fBc\fR (%build) .RS 4 Compile the sources.\& This generally involves the equivalent of \fBmake\fR.\& .PP .RE \fBi\fR (%install and %check) .RS 4 Install the binaries into the build root.\& This generally involves the equivalent of a \fBmake install\fR and \fBmake check\fR.\& .PP .RE \fBl\fR .RS 4 Do a "list check" - the \fB%files\fR section from the spec file is macro expanded, and checks are made to verify that each file exists.\& This requires a previous build up to the \fB%install\fR stage to have taken place.\& .PP .RE .SH ARGUMENTS \fISPEC_FILE\fR .RS 4 An RPM spec file.\& .PP .RE \fISOURCE_PACKAGE\fR .RS 4 An RPM source package (with a \fI.\&src.\&rpm\fR extension) .PP .RE \fITAR_ARCHIVE\fR .RS 4 A \fBtar\fR(5) archive, optionally compressed.\& To be directly buildable with \fBrpmbuild\fR, an archive must contain a spec file either by the name \fISpecfile\fR or one with a \fI.\&spec\fR extension.\& .PP .RE .SH OPTIONS \fB--build-in-place\fR .RS 4 Build from locally checked out sources in the current working directory.\& The build tree is set up as if \fB%setup\fR was used, but \fB%builddir\fR/\fB%buildsubdir\fR points back to the current working directory.\& \fB%prep\fR is skipped entirely.\& .PP .RE \fB--clean\fR .RS 4 Remove the build tree after the packages are made (default).\& .PP .RE \fB--nobuild\fR .RS 4 Do not execute any build stages.\& Useful for testing out spec files.\& .PP .RE \fB--nocheck\fR .RS 4 Do not execute \fB%check\fR build stage even if present in spec.\& .PP .RE \fB--noclean\fR .RS 4 Do not execute \fB%clean\fR build stage even if present in spec.\& .PP .RE \fB--nodebuginfo\fR .RS 4 Do not generate debuginfo packages.\& .PP .RE \fB--nodeps\fR .RS 4 Do not verify build dependencies.\& .PP .RE \fB--noprep\fR .RS 4 Do not execute \fB%prep\fR build stage even if present in spec.\& This assumes there has been another \fBrpmbuild\fR run in which \fB%prep\fR has been already executed.\& .PP .RE \fB--rmsource\fR .RS 4 Remove the sources after the build (may also be used standalone, e.\&g.\& \fBrpmbuild\fR \fB--rmsource foo.\&spec\fR).\& Note that by definition, \fBNoSource\fR and \fBNoPatch\fR files are not sources and so, are not affected by this option.\& .PP .RE \fB--rmspec\fR .RS 4 Remove the spec file after the build (may also be used standalone, e.\&g.\& \fBrpmbuild\fR \fB--rmspec foo.\&spec\fR).\& .PP .RE \fB--rpmfcdebug\fR .RS 4 Print debug information on file classification and dependency generation.\& .PP .RE \fB--scm\fR=\fISCM\fR .RS 4 Select the \fISCM\fR to use with \fB%autosetup\fR, 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\fR\fBN\fR.\& .PP .RE \fB--short-circuit\fR .RS 4 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.\& .PP .RE \fB--with\fR \fIOPTION\fR .RS 4 Enable configure \fIOPTION\fR for build.\& .PP .RE \fB--without\fR \fIOPTION\fR .RS 4 Disable configure \fIOPTION\fR for build.\& .PP .RE See \fBrpm-common\fR(8) for the options common to all operations.\& .PP .SH DYNAMIC BUILD DEPENDENCIES When the \fB%generate_buildrequires\fR 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\fR(8).\& .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 option, 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 option is coupled with \fB--nodeps\fR, exit code 11 is always returned and a \fIbuildreqs.\&nosrc.\&rpm\fR package is always created.\& .PP .SH ENVIRONMENT \fBRPM_BUILD_NCPUS\fR .RS 4 Overrides autodetection for the number of CPUs to use for parallelized sections of the build.\& .PP .RE .SH EXIT STATUS On success, 0 is returned, a nonzero failure code otherwise.\& .PP Packages with a \fB%generate_buildrequires\fR section will return with code 11 when there are unmet \fBDYNAMIC BUILD DEPENDENCIES\fR.\& .PP .SH EXAMPLES \fBrpmbuild --rebuild hello-1.\&0-1.\&src.\&rpm\fR .RS 4 Build binary and source packages from the \fIhello-1.\&0-1.\&src.\&rpm\fR source package.\& .PP .RE \fBrpmbuild -bb --nocheck --with openssl hello.\&spec\fR .RS 4 Build binary packages from the \fIhello.\&spec\fR spec file, skipping the \fB%check\fR stage if present and enabling support for \fBopenssl\fR build conditional (assuming one is specified in the spec).\& .PP .RE \fBrpmbuild -ta hello-2.\&0.\&tar.\&gz\fR .RS 4 Build binary and source packages from the compressed \fIhello-2.\&0.\&tar.\&gz\fR tarball, assuming the archive contains a legitimate spec file (see \fITAR_ARCHIVE\fR for details).\& .PP .RE \fBrpmbuild -bc hello.\&spec\fR .RS 4 Build \fIhello.\&spec\fR up to and including the \fB%build\fR stage, ie.\& without producing actual packages.\& .PP .RE \fBrpmbuild -bi --short-circuit hello.\&spec\fR .RS 4 Only execute the \fB%install\fR stage of \fIhello.\&spec\fR, skipping all previous stages.\& This assumes a preceding run of at least up to the \fB%build\fR stage, see previous example.\& Useful to avoid full rebuilds when working on the \fB%files\fR section of a package.\& .PP .RE .SH FILES See \fBrpm-common\fR(8) .PP .SH SEE ALSO \fBgendiff\fR(1), \fBpopt\fR(3), \fBrpm\fR(8), \fBrpm-common\fR(8), \fBrpmbuild-config\fR(5), \fBrpm2cpio\fR(1), \fBrpmkeys\fR(8), \fBrpmspec\fR(1), \fBrpmsign\fR(1), \fBrpm-setup-autosign\fR(1) \fBrpm-macros\fR(7) .PP \fBhttp://www.\&rpm.\&org/\fR