Debian Codegraph @

upstream/debian-unstable/man1/rpmbuild.1

raw
1 .\" Generated by scdoc 1.11.4
2 .\" Complete documentation for this program is not available as a GNU info page
3 .ie \n(.g .ds Aq \(aq
4 .el .ds Aq '
5 .nh
6 .ad l
7 .\" Begin generated content:
8 .TH "RPMBUILD" "1" "2026-04-10" "RPM 6.0.1"
9 .PP
10 .SH NAME
11 rpmbuild - Build RPM Package(s)
12 .PP
13 .SH SYNOPSIS
14 \fBrpmbuild\fR \fB-b\fR​\fISTAGE\fR [options] \fISPEC_FILE\fR .\&.\&.\&
15 .PP
16 \fBrpmbuild\fR \fB-r\fR​\fISTAGE\fR [options] \fISOURCE_PACKAGE\fR .\&.\&.\&
17 .PP
18 \fBrpmbuild\fR \fB-t\fR​\fISTAGE\fR [options] \fITAR_ARCHIVE\fR .\&.\&.\&
19 .PP
20 \fBrpmbuild\fR {\fB--rebuild\fR|\fB--recompile\fR} [options] \fISOURCE_PACKAGE\fR .\&.\&.\&
21 .PP
22 .SH DESCRIPTION
23 \fBrpmbuild\fR is used to build software packages in the RPM format, in
24 an automated and repeatable manner.\&
25 .PP
26 A \fIpackage\fR consists of an archive of files and meta-data used to
27 install and erase the archive files.\& The meta-data includes helper
28 scripts, file attributes, and descriptive information about the package.\&
29 .PP
30 Packages come in two varieties: binary packages, used to encapsulate
31 software to be installed, and source packages, containing the source
32 code and recipe necessary to produce binary packages.\&
33 .PP
34 .SH OPERATIONS
35 \fB-b\fR​\fISTAGE\fR
36 .RS 4
37 Build \fISTAGE\fR from a spec file.\&
38 .PP
39 .RE
40 \fB-r\fR​\fISTAGE\fR
41 .RS 4
42 Build \fISTAGE\fR from a source RPM package.\&
43 .PP
44 .RE
45 \fB-t\fR​\fISTAGE\fR
46 .RS 4
47 Build \fISTAGE\fR from a \fBtar\fR(5) archive.\&
48 .PP
49 .RE
50 \fB--rebuild\fR,
51 \fB--recompile\fR
52 .RS 4
53 Compatibility aliases for \fB-ra\fR.\&
54 .PP
55 .RE
56 Packages are built in four phases: parse, build, assembly and cleanup.\& The
57 middle two are further divided into \fIstages\fR, listed below, which can be built
58 separately.\& Building a \fISTAGE\fR means executing all the preceding stages up to
59 (and including) the one specified, unless stated otherwise.\&
60 .PP
61 .SS Assembly stages
62 The assembly stages produce packages and are the primary way of interacting with
63 \fBrpmbuild\fR.\& If in doubt, choose one of these.\&
64 .PP
65 \fBa\fR
66 .RS 4
67 Build both source and binary packages.\&
68 This is not an actual stage but a combination of \fBb\fR and \fBs\fR,
69 with the difference that packages built this way carry a "cookie" to
70 indicate they came from the same build.\&
71 On success, the build directory is removed.\&
72 .PP
73 .RE
74 \fBb\fR
75 .RS 4
76 Build just the binary packages.\&
77 On success, the build directory is removed.\&
78 .PP
79 .RE
80 \fBr\fR
81 .RS 4
82 Build just the source package, checking for dynamic build dependencies.\&
83 Executes the \fB%prep\fR and \fB%generate_buildrequires\fR stages before
84 creating a package.\& See the \fBDYNAMIC BUILD DEPENDENCIES\fR section for
85 details.\&
86 .PP
87 .RE
88 \fBs\fR
89 .RS 4
90 Build just the source package.\& No build stages are executed.\&
91 .PP
92 .RE
93 .SS Build stages
94 The build stages produce the artifacts to be packaged, typically by patching and
95 compiling the sources, and installing the binaries into the buildroot.\& These
96 stages generally correspond to spec sections such as \fB%prep\fR, \fB%build\fR or
97 \fB%install\fR, but there are some which are implicit.\&
98 .PP
99 Building these stages separately is generally only useful when packaging new
100 software in RPM format and/or troubleshooting.\& They are listed below in the
101 order of execution, with the corresponding spec section in parenthesis where
102 applicable.\&
103 .PP
104 \fBp\fR (%prep)
105 .RS 4
106 Unpack the sources and apply any patches.\&
107 .PP
108 .RE
109 \fBd\fR (%generate_buildrequires)
110 .RS 4
111 Check dynamic build dependencies and build the \fIbuildreqs.\&nosrc.\&rpm\fR
112 package if any are missing.\& Don'\&t build anything else.\&
113 .PP
114 .RE
115 \fBf\fR (%conf)
116 .RS 4
117 Configure the sources.\& This generally involves the equivalent of
118 \fB.\&/configure\fR.\&
119 .PP
120 .RE
121 \fBc\fR (%build)
122 .RS 4
123 Compile the sources.\& This generally involves the equivalent of \fBmake\fR.\&
124 .PP
125 .RE
126 \fBi\fR (%install and %check)
127 .RS 4
128 Install the binaries into the build root.\& This generally involves the
129 equivalent of a \fBmake install\fR and \fBmake check\fR.\&
130 .PP
131 .RE
132 \fBl\fR
133 .RS 4
134 Do a "list check" - the \fB%files\fR section from the spec file is macro
135 expanded, and checks are made to verify that each file exists.\&
136 This requires a previous build up to the \fB%install\fR stage to have
137 taken place.\&
138 .PP
139 .RE
140 .SH ARGUMENTS
141 \fISPEC_FILE\fR
142 .RS 4
143 An RPM spec file.\&
144 .PP
145 .RE
146 \fISOURCE_PACKAGE\fR
147 .RS 4
148 An RPM source package (with a \fI.\&src.\&rpm\fR extension)
149 .PP
150 .RE
151 \fITAR_ARCHIVE\fR
152 .RS 4
153 A \fBtar\fR(5) archive, optionally compressed.\& To be directly buildable
154 with \fBrpmbuild\fR, an archive must contain a spec file either by
155 the name \fISpecfile\fR or one with a \fI.\&spec\fR extension.\&
156 .PP
157 .RE
158 .SH OPTIONS
159 \fB--build-in-place\fR
160 .RS 4
161 Build from locally checked out sources in the current working
162 directory.\& The build tree is set up as if \fB%setup\fR was used,
163 but \fB%builddir\fR/\fB%buildsubdir\fR points back to the current working
164 directory.\& \fB%prep\fR is skipped entirely.\&
165 .PP
166 .RE
167 \fB--clean\fR
168 .RS 4
169 Remove the build tree after the packages are made (default).\&
170 .PP
171 .RE
172 \fB--nobuild\fR
173 .RS 4
174 Do not execute any build stages.\& Useful for testing out spec files.\&
175 .PP
176 .RE
177 \fB--nocheck\fR
178 .RS 4
179 Do not execute \fB%check\fR build stage even if present in spec.\&
180 .PP
181 .RE
182 \fB--noclean\fR
183 .RS 4
184 Do not execute \fB%clean\fR build stage even if present in spec.\&
185 .PP
186 .RE
187 \fB--nodebuginfo\fR
188 .RS 4
189 Do not generate debuginfo packages.\&
190 .PP
191 .RE
192 \fB--nodeps\fR
193 .RS 4
194 Do not verify build dependencies.\&
195 .PP
196 .RE
197 \fB--noprep\fR
198 .RS 4
199 Do not execute \fB%prep\fR build stage even if present in spec.\&
200 This assumes there has been another \fBrpmbuild\fR run in which
201 \fB%prep\fR has been already executed.\&
202 .PP
203 .RE
204 \fB--rmsource\fR
205 .RS 4
206 Remove the sources after the build (may also be used standalone,
207 e.\&g.\& \fBrpmbuild\fR \fB--rmsource foo.\&spec\fR).\&
208 Note that by definition, \fBNoSource\fR and \fBNoPatch\fR files are not
209 sources and so, are not affected by this option.\&
210 .PP
211 .RE
212 \fB--rmspec\fR
213 .RS 4
214 Remove the spec file after the build (may also be used standalone,
215 e.\&g.\& \fBrpmbuild\fR \fB--rmspec foo.\&spec\fR).\&
216 .PP
217 .RE
218 \fB--rpmfcdebug\fR
219 .RS 4
220 Print debug information on file classification and dependency
221 generation.\&
222 .PP
223 .RE
224 \fB--scm\fR=\fISCM\fR
225 .RS 4
226 Select the \fISCM\fR to use with \fB%autosetup\fR, if one is not set in the
227 spec file.\& Note that not all values for \fISCM\fR, e.\&g.\&, \fBpatch\fR (the
228 default) and \fBgendiff\fR, \fBgit\fR, or \fBquilt\fR work interchangeably
229 with all other patches and options stated in the %autosetup line,
230 especially option \fB-p\fR\fBN\fR.\&
231 .PP
232 .RE
233 \fB--short-circuit\fR
234 .RS 4
235 Skip straight to specified stage (i.\&e.\&, skip all stages leading up
236 to the specified stage).\& Only valid with \fB-bc\fR, \fB-bi\fR, and
237 \fB-bb\fR.\& Useful for local testing only.\& Packages built this way will
238 be marked with an unsatisfiable dependency to prevent their
239 accidental use.\&
240 .PP
241 .RE
242 \fB--with\fR \fIOPTION\fR
243 .RS 4
244 Enable configure \fIOPTION\fR for build.\&
245 .PP
246 .RE
247 \fB--without\fR \fIOPTION\fR
248 .RS 4
249 Disable configure \fIOPTION\fR for build.\&
250 .PP
251 .RE
252 See \fBrpm-common\fR(8) for the options common to all operations.\&
253 .PP
254 .SH DYNAMIC BUILD DEPENDENCIES
255 When the \fB%generate_buildrequires\fR stage runs and some of the newly
256 generated BuildRequires are not satisfied, \fBrpmbuild\fR creates an
257 intermediate source package ending in \fIbuildreqs.\&nosrc.\&rpm\fR, which has
258 the new BuildRequires, and exits with code 11.\& This package can then be
259 used in place of the original source package to resolve and install the
260 missing build dependencies in the usual way, such as with
261 \fBdnf-builddep\fR(8).\&
262 .PP
263 Multiple layers of dynamic build dependencies may exist in a spec file;
264 the presence of specific BuildRequires on the system may yield new
265 BuildRequires next time a build is performed with the same source
266 package.\& The easiest way to ensure that all dynamic build dependencies
267 are satisfied is to run the \fB-br\fR option, install the new
268 dependencies of the \fIbuildreqs.\&nosrc.\&rpm\fR package and repeat the whole
269 procedure until \fBrpmbuild\fR no longer exits with code 11.\&
270 .PP
271 If the \fB-br\fR option is coupled with \fB--nodeps\fR, exit code 11 is
272 always returned and a \fIbuildreqs.\&nosrc.\&rpm\fR package is always created.\&
273 .PP
274 .SH ENVIRONMENT
275 \fBRPM_BUILD_NCPUS\fR
276 .RS 4
277 Overrides autodetection for the number of CPUs to use for
278 parallelized sections of the build.\&
279 .PP
280 .RE
281 .SH EXIT STATUS
282 On success, 0 is returned, a nonzero failure code otherwise.\&
283 .PP
284 Packages with a \fB%generate_buildrequires\fR section will return with code 11
285 when there are unmet \fBDYNAMIC BUILD DEPENDENCIES\fR.\&
286 .PP
287 .SH EXAMPLES
288 \fBrpmbuild --rebuild hello-1.\&0-1.\&src.\&rpm\fR
289 .RS 4
290 Build binary and source packages from the \fIhello-1.\&0-1.\&src.\&rpm\fR
291 source package.\&
292 .PP
293 .RE
294 \fBrpmbuild -bb --nocheck --with openssl hello.\&spec\fR
295 .RS 4
296 Build binary packages from the \fIhello.\&spec\fR spec file,
297 skipping the \fB%check\fR stage if present and enabling support for
298 \fBopenssl\fR build conditional (assuming one is specified in the spec).\&
299 .PP
300 .RE
301 \fBrpmbuild -ta hello-2.\&0.\&tar.\&gz\fR
302 .RS 4
303 Build binary and source packages from the compressed
304 \fIhello-2.\&0.\&tar.\&gz\fR tarball, assuming the archive contains a
305 legitimate spec file (see \fITAR_ARCHIVE\fR for details).\&
306 .PP
307 .RE
308 \fBrpmbuild -bc hello.\&spec\fR
309 .RS 4
310 Build \fIhello.\&spec\fR up to and including the \fB%build\fR stage,
311 ie.\& without producing actual packages.\&
312 .PP
313 .RE
314 \fBrpmbuild -bi --short-circuit hello.\&spec\fR
315 .RS 4
316 Only execute the \fB%install\fR stage of \fIhello.\&spec\fR, skipping all
317 previous stages.\& This assumes a preceding run of at least up to
318 the \fB%build\fR stage, see previous example.\& Useful to avoid full
319 rebuilds when working on the \fB%files\fR section of a package.\&
320 .PP
321 .RE
322 .SH FILES
323 See \fBrpm-common\fR(8)
324 .PP
325 .SH SEE ALSO
326 \fBgendiff\fR(1), \fBpopt\fR(3), \fBrpm\fR(8), \fBrpm-common\fR(8), \fBrpmbuild-config\fR(5),
327 \fBrpm2cpio\fR(1), \fBrpmkeys\fR(8), \fBrpmspec\fR(1), \fBrpmsign\fR(1),
328 \fBrpm-setup-autosign\fR(1) \fBrpm-macros\fR(7)
329 .PP
330 \fBhttp://www.\&rpm.\&org/\fR