1RPMBUILD(8) RPMBUILD(8)
2
3
4
6 rpmbuild - Build RPM Package(s)
7
9 BUILDING PACKAGES:
10 rpmbuild {-ba|-bb|-bp|-bc|-bi|-bl|-bs|-br} [rpmbuild-options] SPECFILE
11 ...
12
13 rpmbuild {-ra|-rb|-rp|-rc|-ri|-rl|-rs|-rr} [rpmbuild-options] SOUR‐
14 CEPACKAGE ...
15
16 rpmbuild {-ta|-tb|-tp|-tc|-ti|-tl|-ts|-tr} [rpmbuild-options] TARBALL
17 ...
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.
117
118 -bp Unpack the sources and apply any patches - executes the %prep
119 stage only.
120
121 -bc Compile the sources - executes up to and including the %build
122 stage. This generally involves the equivalent of a "make".
123
124 -bi Install the binaries into the build root - executes up to and
125 including the %check stage. This generally involves the equiva‐
126 lent of a "make install" and "make check".
127
128 -bl Do a "list check" - the %files section from the spec file is
129 macro expanded, and checks are made to verify that each file ex‐
130 ists.
131
132 -bs Build just the source package - skips straight to the assembly
133 stage, without executing any of the preceding stages or creating
134 binary packages.
135
136 -br Build just the source package, but also parse and include dynam‐
137 ic build dependencies - executes up to and including the %gener‐
138 ate_buildrequires stage and then skips straight to the assembly
139 stage, without creating binary packages. This command can be
140 used to fully resolve dynamic build dependencies. See the DY‐
141 NAMIC BUILD DEPENDENCIES section for details.
142
143 The following options may also be used:
144
145 --buildroot DIRECTORY
146 When building a package, override the BuildRoot tag with direc‐
147 tory DIRECTORY.
148
149 --clean
150 Remove the build tree after the packages are made.
151
152 --nobuild
153 Do not execute any build stages. Useful for testing out spec
154 files.
155
156 --noprep
157 Do not execute %prep build stage even if present in spec.
158
159 --noclean
160 Do not execute %clean build stage even if present in spec.
161
162 --nocheck
163 Do not execute %check build stage even if present in spec.
164
165 --nodebuginfo
166 Do not generate debuginfo packages.
167
168 --nodeps
169 Do not verify build dependencies.
170
171 --rmsource
172 Remove the sources after the build (may also be used standalone,
173 e.g. "rpmbuild --rmsource foo.spec").
174
175 --rmspec
176 Remove the spec file after the build (may also be used stand‐
177 alone, eg. "rpmbuild --rmspec foo.spec").
178
179 --short-circuit
180 Skip straight to specified stage (i.e., skip all stages leading
181 up to the specified stage). Only valid with -bc, -bi, and -bb.
182 Useful for local testing only. Packages built this way will be
183 marked with an unsatisfiable dependency to prevent their acci‐
184 dental use.
185
186 --build-in-place
187 Build from locally checked out sources. Sets _builddir to cur‐
188 rent working directory. Skips handling of -n and untar in the
189 %setup and the deletion of the buildSubdir.
190
191 --target PLATFORM
192 When building the package, interpret PLATFORM as arch-vendor-os
193 and set the macros %_target, %_target_cpu, and %_target_os ac‐
194 cordingly.
195
196 --with OPTION
197 Enable configure OPTION for build.
198
199 --without OPTION
200 Disable configure OPTION for build.
201
202 REBUILD AND RECOMPILE OPTIONS
203 There are two other ways to invoke building with rpm:
204
205 rpmbuild --rebuild|--recompile SOURCEPKG ...
206
207 When invoked this way, rpmbuild installs the named source package, and
208 does a prep, compile and install. In addition, --rebuild builds a new
209 binary package. When the build has completed, the build directory is
210 removed (as in --clean) and the the sources and spec file for the pack‐
211 age are removed.
212
213 These options are now superseded by the -r* options which allow much
214 more fine control over what stages of the build to run.
215
216 DYNAMIC BUILD DEPENDENCIES
217 When the %generate_buildrequires stage runs and some of the newly gen‐
218 erated BuildRequires are not satisfied, rpmbuild creates an intermedi‐
219 ate source package ending in buildreqs.nosrc.rpm, which has the new
220 BuildRequires, and exits with code 11. This package can then be used
221 in place of the original source package to resolve and install the
222 missing build dependencies in the usual way, such as with dnf-build‐
223 dep(8).
224
225 Multiple layers of dynamic build dependencies may exist in a spec file;
226 the presence of specific BuildRequires on the system may yield new
227 BuildRequires next time a build is performed with the same source pack‐
228 age. The easiest way to ensure that all dynamic build dependencies are
229 satisfied is to run the -br command, install the new dependencies of
230 the buildreqs.nosrc.rpm package and repeat the whole procedure until
231 rpmbuild no longer exits with code 11.
232
233 If the -br command is coupled with --nodeps, exit code 11 is always re‐
234 turned and a buildreqs.nosrc.rpm package is always created.
235
236 SHOWRC
237 The command
238
239 rpmbuild --showrc
240
241 shows the values rpmbuild will use for all of the options are currently
242 set in rpmrc and macros configuration file(s).
243
245 rpmrc Configuration
246 /usr/lib/rpm/rpmrc
247 /usr/lib/rpm/<vendor>/rpmrc
248 /etc/rpmrc
249 ~/.rpmrc
250
251 Macro Configuration
252 /usr/lib/rpm/macros
253 /usr/lib/rpm/<vendor>/macros
254 /etc/rpm/macros
255 ~/.rpmmacros
256
257 Temporary
258 /var/tmp/rpm*
259
261 gendiff(1),
262 popt(3),
263 rpm(8),
264 rpm2cpio(8),
265 rpmkeys(8)
266 rpmspec(8),
267 rpmsign(8),
268
269 rpmbuild --help - as rpm supports customizing the options via popt
270 aliases it's impossible to guarantee that what's described in the manu‐
271 al matches what's available.
272
273 http://www.rpm.org/ <URL:http://www.rpm.org/>
274
276 Marc Ewing <marc@redhat.com>
277 Jeff Johnson <jbj@redhat.com>
278 Erik Troan <ewt@redhat.com>
279
280
281
282 09 June 2002 RPMBUILD(8)