.\" Generated by scdoc 1.11.5 .\" 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\-10\-04" "RPM 6.1.0" .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 An RPM package file (or \fIpackage\fR) consists of an archive of files and metadata used to install or erase the archived files.\& The metadata 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 \fISTAGE\fR is a single\-letter argument that specifies the target stage to build.\& This also executes all preceding stages unless stated (or configured) otherwise.\& Additional steps beyond the one specified, such as clean up, may also execute.\& See \fBBUILD PROCESS\fR and \fBOPTIONS\fR for details.\& .PP .SS Building packages .PP Use these \fISTAGE\fR arguments to produce RPM package files ready for installation and/or distribution.\& .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 Partial builds .PP Use these \fISTAGE\fR arguments to build or test the encapsulated software without producing RPM package files.\& Useful when packaging new software in RPM format and/or troubleshooting.\& .PP The corresponding spec sections are shown in parentheses 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) .RS 4 Install the binaries into the build root.\& This generally involves the equivalent of a \fBmake install\fR.\& .PP For historical reasons, this also includes the %check stage by default.\& .PP .RE \fBk\fR (%check) .RS 4 Run any checks specified in the spec.\& This generally involves the equivalent of \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 BUILD PROCESS .PP Packages are built in a number of logical steps, outlined below.\& The steps are executed from top to bottom, skipping any that aren'\&t applicable to the spec.\& .PP Those steps that produce (intermediate) build artifacts or diagnostic output are called \fIstages\fR.\& They are denoted by a single\-letter identifier in parentheses.\& You can tell \fBrpmbuild\fR to stop the build process at any stage (see \fBOPERATIONS\fR for details).\& .PP Some steps are implemented as build scriptlets whose contents is dumped in the \fBrpmbuild\fR output for diagnostic purposes.\& Their names are shown in parentheses following any stage identifier, prefixed with \fB%\fR if they correspond to a spec section or directive.\& .PP Binary packages are produced separately for one or more platforms, called \fIbuild targets\fR.\& By default, the current platform is the only build target.\& This can be overridden with \fB\-\-target\fR or by declaring a \fBBuildArch\fR in the spec.\& See also \fBBUGS\fR for some related known issues.\& .PP .PD 0 .IP \(bu 4 Unpack source package or tar archive if either is given .IP \(bu 4 Determine build targets and repeat following steps for each in turn .IP \(bu 4 Load \fBrpm\-config\fR(5), \fBrpm\-rpmrc\fR(5) and \fBrpmbuild\-config\fR(5) files for next build target .IP \(bu 4 Parse spec file .IP \(bu 4 Check static build dependencies .IP \(bu 4 Setup build workspace .RS 4 .IP \(bu 4 Create build directory and set \fB%builddir\fR to its path (\fBmkbuilddir\fR) .IP \(bu 4 Export build environment to \fB%builddir\fR/\fIrpmbuild.\&env\fR file .RE .IP \(bu 4 Execute build scriptlets to populate \fB%buildroot\fR .RS 4 .IP \(bu 4 Unpack sources and apply any patches (\fBp\fR, \fB%prep\fR) .IP \(bu 4 Generate dynamic build dependencies (\fBd\fR, \fB%generate_buildrequires\fR) .IP \(bu 4 Check dynamic build dependencies .IP \(bu 4 Configure sources (\fBf\fR, \fB%conf\fR) .IP \(bu 4 Compile sources (\fBc\fR, \fB%build\fR) .IP \(bu 4 Install binaries into \fB%buildroot\fR (\fBi\fR, \fB%install\fR) .IP \(bu 4 Read dynamic spec parts .IP \(bu 4 Execute tests (\fBk\fR, \fB%check\fR) .RE .IP \(bu 4 Process files to be packaged .RS 4 .IP \(bu 4 Populate file list for source packages .IP \(bu 4 Populate file list for binary packages based on \fB%files\fR manifest(s) .RS 4 .IP \(bu 4 Add regular entries from \fB%buildroot\fR .IP \(bu 4 Copy special entries to \fB%buildroot\fR (\fB%doc\fR, \fB%license\fR) .IP \(bu 4 Add special entries from \fB%buildroot\fR .RE .IP \(bu 4 Perform file classification .IP \(bu 4 Generate runtime dependencies using \fBrpm\-dependency\-generators\fR(7) .IP \(bu 4 Check file list against \fB%buildroot\fR (\fBl\fR) .RE .IP \(bu 4 Create packages .RS 4 .IP \(bu 4 Write binary packages to disk (\fBb\fR) .IP \(bu 4 Write source packages to disk (\fBs\fR) .RE .IP \(bu 4 Clean up .RS 4 .IP \(bu 4 OBSOLETE: Perform explicit clean up (\fB%clean\fR) .IP \(bu 4 Perform implicit clean up (\fBrmbuild\fR) .PD .PP .RE For more information on the syntax, see \fBrpm\-spec\fR(5).\& .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 BUGS .PP Building a spec that declares a \fBBuildArch\fR may cause unexpected behavior, in particular: .PP .PD 0 .IP \(bu 4 Macros defined before the \fBBuildArch\fR line will be expanded twice, which can yield unexpected results with \fB%global\fR in particular .PD .PP .PD 0 .IP \(bu 4 Using a \fB\-\-target\fR that disagrees with the \fBBuildArch\fR results in undefined behavior .PD .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