1RPMBUILD(8)                 System Manager's Manual                RPMBUILD(8)
2
3
4

NAME

6       rpmbuild - Build RPM Package(s)
7

SYNOPSIS

9   BUILDING PACKAGES:
10       rpmbuild  {-ba|-bb|-bp|-bc|-bi|-bl|-bs|-br} [rpmbuild-options] SPECFILE
11       ...
12
13
14       rpmbuild  {-ra|-rb|-rp|-rc|-ri|-rl|-rs|-rr}  [rpmbuild-options]   SOUR‐
15       CEPACKAGE ...
16
17
18       rpmbuild  {-ta|-tb|-tp|-tc|-ti|-tl|-ts|-tr}  [rpmbuild-options] TARBALL
19       ...
20
21
22
23       rpmbuild {--rebuild|--recompile} SOURCEPKG ...
24
25
26   MISCELLANEOUS:
27       rpmbuild --showrc
28
29
30   rpmbuild-options
31        [--buildroot DIRECTORY] [--clean] [--nobuild]
32        [--rmsource] [--rmspec] [--short-circuit] [--build-in-place]
33        [--noprep] [--noclean] [--nocheck]
34        [--rpmfcdebug]
35        [--target PLATFORM]
36        [--with OPTION] [--without OPTION]
37
38

DESCRIPTION

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

FILES

259   rpmrc Configuration
260       /usr/lib/rpm/rpmrc
261       /usr/lib/rpm/<vendor>/rpmrc
262       /etc/rpmrc
263       ~/.rpmrc
264
265   Macro Configuration
266       /usr/lib/rpm/macros
267       /usr/lib/rpm/<vendor>/macros
268       /etc/rpm/macros
269       ~/.rpmmacros
270
271   Temporary
272       /var/tmp/rpm*
273

SEE ALSO

275       gendiff(1),
276       popt(3),
277       rpm(8),
278       rpm2cpio(8),
279       rpmkeys(8)
280       rpmspec(8),
281       rpmsign(8),
282
283       rpmbuild  --help  -  as  rpm  supports customizing the options via popt
284       aliases it's impossible to guarantee that what's described in the  man‐
285       ual matches what's available.
286
287       http://www.rpm.org/ <URL:http://www.rpm.org/>
288

AUTHORS

290       Marc Ewing <marc@redhat.com>
291       Jeff Johnson <jbj@redhat.com>
292       Erik Troan <ewt@redhat.com>
293
294
295
296Red Hat, Inc.                    09 June 2002                      RPMBUILD(8)
Impressum