summaryrefslogtreecommitdiff
path: root/man/dpkg-buildpackage.1
blob: 4e545210998be7801b23075fa1ef6206dc4fc433 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
.TH dpkg\-buildpackage 1 "2008-08-18" "Debian Project" "dpkg utilities"
.SH NAME
dpkg\-buildpackage \- build binary or source packages from sources
.
.SH SYNOPSIS
.B dpkg\-buildpackage
.RI [ options ]
.
.SH DESCRIPTION
.B dpkg\-buildpackage
is a program that automates the process of building a Debian package. It
consists of the following steps:
.IP \fB1.\fP 3
It prepares the build environment by setting various environment
variables (see \fBENVIRONMENT VARIABLES\fP).
.IP \fB2.\fP 3
It checks that the build-dependencies and build-conflicts
are satisfied (unless \fB\-d\fP is specified).
.IP \fB3.\fP 3
If a specific target has been selected with the \fB-T\fP or \fB--target\fP
option, it calls that target and stops here. Otherwise it calls
\fBfakeroot debian/rules clean\fP to clean the build-tree (unless
\fB\-nc\fP is specified).
.IP \fB4.\fP 3
It calls \fBdpkg-source\fP to generate the source package (unless
a binary-only build has been requested with \fB\-b\fP, \fB\-B\fP or
\fB\-A\fP).
.IP \fB5.\fP 3
It calls \fBdebian/rules\fP \fBbuild\fP followed by
\fBfakeroot debian/rules\fP \fIbinary-target\fP (unless a source-only
build has been requested with \fB\-S\fP). Note that \fIbinary-target\fR is
either \fBbinary\fP (default case, or if \fB\-b\fP is specified)
or \fBbinary-arch\fP (if \fB\-B\fP is specified) or \fBbinary-indep\fP
(if \fB\-A\fP is specified).
.IP \fB6.\fP 3
It calls \fBgpg\fP to sign the \fB.dsc\fP file (if any, unless
\fB\-us\fP is specified).
.IP \fB7.\fP 3
It calls \fBdpkg-genchanges\fP to generate a \fB.changes\fP file.
Many \fBdpkg-buildpackage\fP options are forwarded to
\fBdpkg-genchanges\fP.
.IP \fB8.\fP 3
It calls \fBgpg\fP to sign the \fB.changes\fP file (unless \fB\-uc\fP
is specified).
.IP \fB9.\fP 3
If \fB\-tc\fP is specified, it will call \fBfakeroot debian/rules clean\fP
again.
.
.SH OPTIONS
.TP
.B \-b
Specifies a binary-only build, no source files are to be built and/or
distributed. Passed to \fBdpkg-genchanges\fP.
.TP
.B \-B
Specifies a binary-only build, limited to architecture dependent packages.
Passed to \fBdpkg-genchanges\fP.
.TP
.B \-A
Specifies a binary-only build, limited to architecture independent
packages. Passed to \fBdpkg-genchanges\fP.
.TP
.B \-S
Specifies a source-only build, no binary packages need to be made.
Passed to \fBdpkg-genchanges\fP.
.P
.BI \-\-target= target
.br
.BI "\-\-target " target
.br
.BI \-T target
.RS
Calls \fBdebian/rules\fP \fItarget\fP after having setup the build
environment and stops the package build process here. If
\fB\-\-as\-root\fP is also given, then the command is executed
as root (see \fB\-r\fP). Note that official targets that are required to
be run as root by the Debian policy do not need this option.
.RE
.TP
.B \-\-as\-root
Only meaningful together with \fB\-\-target\fP. Requires that the target be
run with root rights.
.P
.B \-si
.br
.B \-sa
.br
.B \-sd
.br
.BI \-v version
.br
.BI \-C changesdescription
.br
.BI \-m maintaineraddress
.br
.BI \-e maintaineraddress
.RS
Passed unchanged to \fBdpkg-genchanges\fP. See its manual page.
.RE
.TP
.BI \-a architecture
Specify the Debian architecture we build for. The architecture of the
machine we build on is determined automatically, and is also the default
for the host machine.

If the host architecture differs from the build architecture (as is the
case for a cross-compilation), and if the environment variable
\fBPKG_CONFIG_LIBDIR\fP is not set, then it is set to a value suitable for
cross-compilation
("/usr/\fIgnu-system-type\fP/lib/pkgconfig/:/usr/share/pkgconfig").
.TP
.BI \-t gnu-system-type
Specify the GNU system type we build for. It can be used in place
of \-a or as a complement to override the default GNU system type
of the target Debian architecture.
.TP
.BI \-j jobs
Number of jobs allowed to be run simultaneously, equivalent to the
.BR make (1)
option of the same name. Will add itself to the MAKEFLAGS
environment variable, which should cause all subsequent make
invocations to inherit the option. Also adds \fBparallel=\fP\fIjobs\fP
to the DEB_BUILD_OPTIONS environment variable which allows
debian/rules files to use this information for their own purposes.
The \fBparallel=\fP\fIjobs\fP in DEB_BUILD_OPTIONS environment variable
will override the \fB-j\fP value if this option is given.
.TP
.B \-D
Check build dependencies and conflicts; abort if unsatisfied. This is the
default behavior.
.TP
.B \-d
Do not check build dependencies and conflicts.
.TP
.B \-nc
Do not clean the source tree (implies \fB\-b\fP if nothing else has been
selected among \fB-B\fP, \fB-A\fP or \fB-S\fP).
.TP
.B \-tc
Clean the source tree (using
.I gain-root-command
.BR "debian/rules clean" )
after the package has been built.
.TP
.BI \-r gain-root-command
When
.B dpkg\-buildpackage
needs to execute part of the build process as root, it prefixes the
command it executes with
.I gain-root-command
if one has been specified. Otherwise, if none has been specified,
\fBfakeroot\fP will be used by default, if the command is present.
.I gain-root-command
should start with the name of a program on the
.B PATH
and will get as arguments the name of the real command to run and the
arguments it should take.
.I gain-root-command
can include parameters (they must be space-separated) but no shell
metacharacters.
.I gain-root-command
might typically be
.BR fakeroot ", " sudo ", " super " or " really .
.B su
is not suitable, since it can only invoke the user's shell with
.B \-c
instead of passing arguments individually to the command to be run.
.TP
.BI \-R rules-file
Building a Debian package usually involves invoking
.B debian/rules
as a command with several standard parameters. With this option it's
possible to use another program invocation to build the package (it can
include space separated parameters).
Alternatively it can be used to execute the standard rules file with
another make program (for example by using
.B /usr/local/bin/make -f debian/rules
as \fIrules-file\fR).
.TP
.BI \-p sign-command
When \fBdpkg\-buildpackage\fP needs to execute GPG or PGP to sign a source
control (\fB.dsc\fP) file or a \fB.changes\fP file it will run
\fIsign-command\fP (searching the \fBPATH\fP if necessary) instead of
\fBgpg\fP. \fIsign-command\fP will get all the arguments that
\fBpgp\fP would have gotten. If \fIsign-command\fP
takes its arguments in GPG rather than PGP style, you should give
the \fB\-sgpg\fP option. \fIsign-command\fP
should not contain spaces or any other shell metacharacters.
.TP
.BI \-k key-id
Specify a key-ID to use when signing packages.
.TP
.BR \-us
Do not sign the source package.
.TP
.BR \-uc
Do not sign the \fB.changes\fP file.
.P
.BR \-i [\fIregexp\fP]
.br
.BI \-I [\fIpattern\fP]
.br
.BR \-s [ nsAkurKUR ]
.br
.BR \-z ", " \-Z
.br
.RS
Passed unchanged to \fBdpkg\-source\fP. See its manual page.
.RE
.P
.BI \-\-admindir= dir
.br
.BI "\-\-admindir " dir
.RS
Change the location of the \fBdpkg\fR database. The default location is
\fI/var/lib/dpkg\fP.
.RE
.TP
.BR \-h ", " \-\-help
Show the usage message and exit.
.TP
.BR \-\-version
Show the version and exit.
.
.SH ENVIRONMENT VARIABLES
.SS Variables set by dpkg-architecture
\fBdpkg\-architecture\fP is called with the \fB\-a\fP and \fB\-t\fP
parameters forwarded. Any variable that is output by its \fB\-s\fP
option is integrated in the build environment.
.SS Compiler flags
Some environment variables defining compiler and linker options are
set to default values unless already present in the environment. Note that
this mechanism was only introduced in version 1.14.17 of dpkg-dev and
not all \fIrules\fP files and build tools will honour these variables,
yet.
.TP
.B CFLAGS
Optimization options which are passed to the Debian build system and
can/should be overriden by the package build if needed (default value:
.BR "\-g \-O2" ,
or
.BR \-g\ \-O0
if
.BR noopt
is specified in DEB_BUILD_OPTIONS). Overriding options can be
used to explicitely set a
higher optimization level, or work around compiler bugs, which only
can be seen with some optimization levels (the last opt level "wins").
.TP
.B CFLAGS_APPEND
Optimization options appended to the compiler flags, which must not be
overwritten by the package (mostly used to for test builds). Default
value: empty.
.TP
.B CXXFLAGS
Same as
.B CFLAGS
for C++ sources.
.TP
.B CXXFLAGS_APPEND
Same as
.B CFLAGS_APPEND
for C++ sources.
.TP
.B FFLAGS
Same as
.B CFLAGS
for Fortran sources.
.TP
.B FFLAGS_APPEND
Same as
.B CFLAGS_APPEND
for Fortran sources.
.TP
.B CPPFLAGS
Preprocessor flags which are passed to the Debian build system and
can/should be overriden by the package build if needed (default:
empty). This macro is seldom used (most build systems just use
.B CFLAGS
instead of
.BR CPPFLAGS ).
.TP
.B CPPFLAGS_APPEND
Preprocessor flags appended to the preprocessor flags, which must not
be overwritten by the package (mostly used to for test
builds). Default value: empty.
.TP
.B LDFLAGS
Options passed to the compiler when linking executables or shared
objects (if the linker is called directly, then
.B -Wl
and
.B ,
have to be stripped from these options). Default value: empty.
.TP
.B LDFLAGS_APPEND
Optimization options appended to the compiler flags when linking code,
which must not be overwritten by the package (mostly used to for test
builds). Default value: empty.
.
.SH BUGS
It should be possible to specify spaces and shell metacharacters in
and initial arguments for
.IR gain-root-command " and " sign-command .
.
.SH "SEE ALSO"
.BR dpkg\-source (1),
.BR dpkg\-architecture (1),
.BR dpkg\-genchanges (1),
.BR fakeroot (1),
.BR gpg (1).
.
.SH AUTHORS
Copyright \(co 1995-1996 Ian Jackson
.br
Copyright \(co 2000 Wichert Akkerman
.br
Copyright \(co 2007 Frank Lichtenheld
.br
Copyright \(co 2008 Rapha\[:e]l Hertzog
.sp
This is free software; see the GNU General Public Licence version 2 or later
for copying conditions. There is NO WARRANTY.