1RPMBUILD(8) RPMBUILD(8)
2
3
4
6 rpmbuild - Build RPM Package(s)
7
9 BUILDING PACKAGES:
10 rpmbuild {-ba|-bb|-bp|-bf|-bc|-bi|-bl|-bs|-br|-bd} [rpmbuild-options]
11 SPECFILE ...
12
13 rpmbuild {-ra|-rb|-rp|-rf|-rc|-ri|-rl|-rs|-rr|-rd} [rpmbuild-options]
14 SOURCEPACKAGE ...
15
16 rpmbuild {-ta|-tb|-tp|-tf|-tc|-ti|-tl|-ts|-tr|-td} [rpmbuild-options]
17 TARBALL ...
18
19 rpmbuild {--rebuild|--recompile} SOURCEPKG ...
20
21 MISCELLANEOUS:
22 rpmbuild --showrc
23
24 rpmbuild-options
25 [--buildroot DIRECTORY] [--clean] [--nobuild] [--rmsource] [--rmspec]
26 [--short-circuit] [--build-in-place] [--noprep] [--noclean] [--nocheck]
27 [--rpmfcdebug] [--target PLATFORM] [--with OPTION] [--without OPTION]
28
30 rpmbuild is used to build both binary and source software packages. A
31 package consists of an archive of files and meta-data used to install
32 and erase the archive files. The meta-data includes helper scripts,
33 file attributes, and descriptive information about the package. Pack‐
34 ages come in two varieties: binary packages, used to encapsulate soft‐
35 ware to be installed, and source packages, containing the source code
36 and recipe necessary to produce binary packages.
37
38 One of the following basic modes must be selected: Build Package, Build
39 Package from Tarball, Recompile Package, Show Configuration.
40
41 GENERAL OPTIONS
42 These options can be used in all the different modes.
43
44 -?, --help
45 Print a longer usage message then normal.
46
47 --version
48 Print a single line containing the version number of rpm being
49 used.
50
51 --quiet
52 Print as little as possible - normally only error messages will
53 be displayed.
54
55 -v Print verbose information - normally routine progress messages
56 will be displayed.
57
58 -vv Print lots of ugly debugging information.
59
60 --rpmfcdebug
61 Enables to debug dependencies generation.
62
63 --rcfile FILELIST
64 Each of the files in the colon separated FILELIST is read se‐
65 quentially by rpm for configuration information. Only the first
66 file in the list must exist, and tildes will be expanded to the
67 value of $HOME. The default FILELIST is /usr/lib/rpm/rpm‐
68 rc:/usr/lib/rpm/<vendor>/rpmrc:/etc/rpmrc:~/.rpmrc.
69
70 --pipe CMD
71 Pipes the output of rpm to the command CMD.
72
73 --dbpath DIRECTORY
74 Use the database in DIRECTORY rather than the default path
75 /var/lib/rpm
76
77 --root DIRECTORY
78 Use the file system tree rooted at DIRECTORY for all operations.
79 Note that this means the database within DIRECTORY will be used
80 for dependency checks and any scriptlet(s) (e.g. %post if in‐
81 stalling, or %prep if building, a package) will be run after a
82 chroot(2) to DIRECTORY.
83
84 -D, --define='MACRO EXPR'
85 Defines MACRO with value EXPR.
86
87 --scm=SCM
88 Select the SCM to use with %autosetup, if one is not set in the
89 spec file. Note that not all values for SCM, e.g., patch (the
90 default) and gendiff, git, or quilt work interchangeably with
91 all other patches and options stated in the %autosetup line, es‐
92 pecially option -pN.
93
94 BUILD OPTIONS
95 The general form of an rpm build command is
96
97 rpmbuild {-bSTAGE|-rSTAGE|-tSTAGE} [rpmbuild-options] FILE ...
98
99 The argument used is -b if a spec file is being used to build the pack‐
100 age, -r if a source package is to be rebuilt and -t if rpmbuild should
101 look inside of a (possibly compressed) tar file for the spec file to
102 use.
103
104 Packages are built in a number of stages. The first six correspond to
105 the following sections in a spec file: %prep, %generate_buildrequires,
106 %build, %install, %check and %clean. Finally, binary and source pack‐
107 ages are created in an assembly stage.
108
109 The STAGE character specifies the stage to finish with (after doing all
110 the stages preceding it), and is one of:
111
112 -ba Perform a full build - executes up to and including the assembly
113 stage. In most cases, this is the option to choose.
114
115 -bb Build just the binary packages - executes up to and including
116 the assembly stage, but without creating the source package. On
117 success, the build directory is removed (as in --clean).
118
119 -bp Unpack the sources and apply any patches - executes the %prep
120 stage only.
121
122 -bf Configure the sources - executes up to and including the %conf
123 stage. This generally involves the equivalent of a "./config‐
124 ure".
125
126 -bc Compile the sources - executes up to and including the %build
127 stage. This generally involves the equivalent of a "make".
128
129 -bi Install the binaries into the build root - executes up to and
130 including the %check stage. This generally involves the equiva‐
131 lent of a "make install" and "make check".
132
133 -bl Do a "list check" - the %files section from the spec file is
134 macro expanded, and checks are made to verify that each file ex‐
135 ists.
136
137 -bs Build just the source package - skips straight to the assembly
138 stage, without executing any of the preceding stages or creating
139 binary packages.
140
141 -br Build just the source package, but also parse and include dynam‐
142 ic build dependencies - executes up to and including the %gener‐
143 ate_buildrequires stage and then skips straight to the assembly
144 stage, without creating binary packages. This command can be
145 used to fully resolve dynamic build dependencies. See the DY‐
146 NAMIC BUILD DEPENDENCIES section for details.
147
148 -bd Check dynamic build dependencies and build the .buildreqs.nos‐
149 rc.rpm package if any are missing. Don’t build anything else.
150
151 The following options may also be used:
152
153 --buildroot DIRECTORY
154 When building a package, override the BuildRoot tag with direc‐
155 tory DIRECTORY.
156
157 --clean
158 Remove the build tree after the packages are made.
159
160 --nobuild
161 Do not execute any build stages. Useful for testing out spec
162 files.
163
164 --noprep
165 Do not execute %prep build stage even if present in spec.
166
167 --noclean
168 Do not execute %clean build stage even if present in spec.
169
170 --nocheck
171 Do not execute %check build stage even if present in spec.
172
173 --nodebuginfo
174 Do not generate debuginfo packages.
175
176 --nodeps
177 Do not verify build dependencies.
178
179 --rmsource
180 Remove the sources after the build (may also be used standalone,
181 e.g. "rpmbuild --rmsource foo.spec").
182
183 --rmspec
184 Remove the spec file after the build (may also be used stand‐
185 alone, eg. "rpmbuild --rmspec foo.spec").
186
187 --short-circuit
188 Skip straight to specified stage (i.e., skip all stages leading
189 up to the specified stage). Only valid with -bc, -bi, and -bb.
190 Useful for local testing only. Packages built this way will be
191 marked with an unsatisfiable dependency to prevent their acci‐
192 dental use.
193
194 --build-in-place
195 Build from locally checked out sources. Sets _builddir to cur‐
196 rent working directory. Skips handling of -n and untar in the
197 %setup and the deletion of the buildSubdir.
198
199 --target PLATFORM
200 When building the package, interpret PLATFORM as arch-vendor-os
201 and set the macros %_target, %_target_cpu, and %_target_os ac‐
202 cordingly.
203
204 --with OPTION
205 Enable configure OPTION for build.
206
207 --without OPTION
208 Disable configure OPTION for build.
209
210 REBUILD AND RECOMPILE OPTIONS
211 There are two other ways to invoke building with rpm:
212
213 rpmbuild --rebuild|--recompile SOURCEPKG ...
214
215 When invoked this way, rpmbuild installs the named source package, and
216 does a prep, compile and install. In addition, --rebuild builds a new
217 binary package. When the build has completed, the build directory is
218 removed (as in --clean) and the the sources and spec file for the pack‐
219 age are removed.
220
221 These options are now superseded by the -r* options which allow much
222 more fine control over what stages of the build to run.
223
224 DYNAMIC BUILD DEPENDENCIES
225 When the %generate_buildrequires stage runs and some of the newly gen‐
226 erated BuildRequires are not satisfied, rpmbuild creates an intermedi‐
227 ate source package ending in buildreqs.nosrc.rpm, which has the new
228 BuildRequires, and exits with code 11. This package can then be used
229 in place of the original source package to resolve and install the
230 missing build dependencies in the usual way, such as with dnf-build‐
231 dep(8).
232
233 Multiple layers of dynamic build dependencies may exist in a spec file;
234 the presence of specific BuildRequires on the system may yield new
235 BuildRequires next time a build is performed with the same source pack‐
236 age. The easiest way to ensure that all dynamic build dependencies are
237 satisfied is to run the -br command, install the new dependencies of
238 the buildreqs.nosrc.rpm package and repeat the whole procedure until
239 rpmbuild no longer exits with code 11.
240
241 If the -br command is coupled with --nodeps, exit code 11 is always re‐
242 turned and a buildreqs.nosrc.rpm package is always created.
243
244 SHOWRC
245 The command
246
247 rpmbuild --showrc
248
249 shows the values rpmbuild will use for all of the options are currently
250 set in rpmrc and macros configuration file(s).
251
253 rpmrc Configuration
254 /usr/lib/rpm/rpmrc
255 /usr/lib/rpm/<vendor>/rpmrc
256 /etc/rpmrc
257 ~/.rpmrc
258
259 Macro Configuration
260 /usr/lib/rpm/macros
261 /usr/lib/rpm/<vendor>/macros
262 /etc/rpm/macros
263 ~/.rpmmacros
264
265 Temporary
266 /var/tmp/rpm*
267
269 gendiff(1), popt(3), rpm(8), rpm2cpio(8), rpmkeys(8), rpmspec(8), rpm‐
270 sign(8)
271
272 rpmbuild --help - as rpm supports customizing the options via popt
273 aliases it's impossible to guarantee that what's described in the manu‐
274 al matches what's available.
275
276 http://www.rpm.org/ <URL:http://www.rpm.org/>
277
279 Marc Ewing <marc@redhat.com>
280 Jeff Johnson <jbj@redhat.com>
281 Erik Troan <ewt@redhat.com>
282
283
284
285 09 June 2002 RPMBUILD(8)