1dpkg-buildpackage(1)            dpkg utilities            dpkg-buildpackage(1)
2
3
4

NAME

6       dpkg-buildpackage - build binary or source packages from sources
7

SYNOPSIS

9       dpkg-buildpackage [options]
10

DESCRIPTION

12       dpkg-buildpackage is a program that automates the process of building a
13       Debian package. It consists of the following steps:
14
15       1. It prepares the build environment  by  setting  various  environment
16          variables (see ENVIRONMENT VARIABLES).
17
18       2. It checks that the build-dependencies and build-conflicts are satis‐
19          fied (unless -d is specified).
20
21       3. If a specific target has been  selected  with  the  -T  or  --target
22          option,  it  calls  that  target  and stops here. Otherwise it calls
23          fakeroot debian/rules clean to clean the build-tree (unless  -nc  is
24          specified).
25
26       4. It  calls  dpkg-source  to  generate  the  source  package (unless a
27          binary-only build has been requested with -b, -B or -A).
28
29       5. It  calls  debian/rules  build  followed  by  fakeroot  debian/rules
30          binary-target  (unless  a  source-only build has been requested with
31          -S). Note that binary-target is either binary (default case,  or  if
32          -b is specified) or binary-arch (if -B is specified) or binary-indep
33          (if -A is specified).
34
35       6. It calls gpg to sign the .dsc file (if any,  unless  -us  is  speci‐
36          fied).
37
38       7. It  calls  dpkg-genchanges  to generate a .changes file.  Many dpkg-
39          buildpackage options are forwarded to dpkg-genchanges.
40
41       8. It calls gpg to sign the .changes file (unless -uc is specified).
42
43       9. If -tc is specified, it will call fakeroot debian/rules clean again.
44

OPTIONS

46       -b     Specifies a binary-only build, no source files are to  be  built
47              and/or distributed. Passed to dpkg-genchanges.
48
49       -B     Specifies a binary-only build, limited to architecture dependent
50              packages.  Passed to dpkg-genchanges.
51
52       -A     Specifies a binary-only build, limited to architecture  indepen‐
53              dent packages. Passed to dpkg-genchanges.
54
55       -S     Specifies  a  source-only  build,  no binary packages need to be
56              made.  Passed to dpkg-genchanges.
57
58       --target=target
59       --target target
60       -Ttarget
61              Calls debian/rules target after having setup the build  environ‐
62              ment  and  stops the package build process here. If --as-root is
63              also given, then the command is executed as root (see -r).  Note
64              that official targets that are required to be run as root by the
65              Debian policy do not need this option.
66
67       --as-root
68              Only meaningful together with --target. Requires that the target
69              be run with root rights.
70
71       -si
72       -sa
73       -sd
74       -vversion
75       -Cchangesdescription
76       -mmaintaineraddress
77       -emaintaineraddress
78              Passed unchanged to dpkg-genchanges. See its manual page.
79
80       -aarchitecture
81              Specify  the  Debian architecture we build for. The architecture
82              of the machine we build on is determined automatically,  and  is
83              also the default for the host machine.
84
85              If the host architecture differs from the build architecture (as
86              is the case for a cross-compilation),  and  if  the  environment
87              variable PKG_CONFIG_LIBDIR is not set, then it is set to a value
88              suitable for  cross-compilation  ("/usr/gnu-system-type/lib/pkg‐
89              config/:/usr/share/pkgconfig").
90
91       -tgnu-system-type
92              Specify  the  GNU  system  type  we build for. It can be used in
93              place of -a or as a complement to override the default GNU  sys‐
94              tem type of the target Debian architecture.
95
96       -jjobs Number  of  jobs allowed to be run simultaneously, equivalent to
97              the make(1) option of the same name.  Will  add  itself  to  the
98              MAKEFLAGS  environment  variable,  which should cause all subse‐
99              quent make invocations to inherit the option. Also  adds  paral‐
100              lel=jobs  to  the  DEB_BUILD_OPTIONS  environment variable which
101              allows debian/rules files to use this information for their  own
102              purposes.   The  parallel=jobs  in DEB_BUILD_OPTIONS environment
103              variable will override the -j value if this option is given.
104
105       -D     Check build dependencies and conflicts;  abort  if  unsatisfied.
106              This is the default behavior.
107
108       -d     Do not check build dependencies and conflicts.
109
110       -nc    Do  not  clean  the  source tree (implies -b if nothing else has
111              been selected among -B, -A or -S).
112
113       -tc    Clean the  source  tree  (using  gain-root-command  debian/rules
114              clean) after the package has been built.
115
116       -rgain-root-command
117              When  dpkg-buildpackage  needs  to  execute  part  of  the build
118              process as root, it prefixes the command it executes with  gain-
119              root-command  if  one has been specified. Otherwise, if none has
120              been specified, fakeroot will be used by default, if the command
121              is  present.   gain-root-command should start with the name of a
122              program on the PATH and will get as arguments the  name  of  the
123              real  command  to  run  and the arguments it should take.  gain-
124              root-command can include parameters (they  must  be  space-sepa‐
125              rated)  but  no  shell  metacharacters.  gain-root-command might
126              typically be fakeroot, sudo, super or really.  su is  not  suit‐
127              able,  since it can only invoke the user's shell with -c instead
128              of passing arguments individually to the command to be run.
129
130       -Rrules-file
131              Building a Debian package usually involves invoking debian/rules
132              as  a command with several standard parameters. With this option
133              it's possible to use another program  invocation  to  build  the
134              package  (it  can include space separated parameters).  Alterna‐
135              tively it can be used to execute the standard  rules  file  with
136              another  make  program (for example by using /usr/local/bin/make
137              -f debian/rules as rules-file).
138
139       -psign-command
140              When dpkg-buildpackage needs to execute GPG or  PGP  to  sign  a
141              source  control (.dsc) file or a .changes file it will run sign-
142              command (searching the PATH if necessary) instead of gpg.  sign-
143              command  will  get all the arguments that pgp would have gotten.
144              If sign-command takes its  arguments  in  GPG  rather  than  PGP
145              style, you should give the -sgpg option. sign-command should not
146              contain spaces or any other shell metacharacters.
147
148       -kkey-id
149              Specify a key-ID to use when signing packages.
150
151       -us    Do not sign the source package.
152
153       -uc    Do not sign the .changes file.
154
155       -i[regexp]
156       -I[pattern]
157       -s[nsAkurKUR]
158       -z, -Z
159              Passed unchanged to dpkg-source. See its manual page.
160
161       --admindir=dir
162       --admindir dir
163              Change the location of the dpkg database. The  default  location
164              is /var/lib/dpkg.
165
166       -h, --help
167              Show the usage message and exit.
168
169       --version
170              Show the version and exit.
171

ENVIRONMENT VARIABLES

173   Variables set by dpkg-architecture
174       dpkg-architecture  is  called  with the -a and -t parameters forwarded.
175       Any variable that is output by its -s option is integrated in the build
176       environment.
177
178   Compiler flags
179       Some environment variables defining compiler and linker options are set
180       to default values unless already present in the environment. Note  that
181       this  mechanism  was only introduced in version 1.14.17 of dpkg-dev and
182       not all rules files and build tools will honour these variables, yet.
183
184       CFLAGS Optimization options which are passed to the Debian build system
185              and  can/should  be  overriden  by  the  package build if needed
186              (default value: -g -O2, or  -g -O0  if  noopt  is  specified  in
187              DEB_BUILD_OPTIONS).   Overriding   options   can   be   used  to
188              explicitely set a higher optimization level, or work around com‐
189              piler bugs, which only can be seen with some optimization levels
190              (the last opt level "wins").
191
192       CFLAGS_APPEND
193              Optimization options appended to the compiler flags, which  must
194              not  be  overwritten  by  the  package  (mostly used to for test
195              builds). Default value: empty.
196
197       CXXFLAGS
198              Same as CFLAGS for C++ sources.
199
200       CXXFLAGS_APPEND
201              Same as CFLAGS_APPEND for C++ sources.
202
203       FFLAGS Same as CFLAGS for Fortran sources.
204
205       FFLAGS_APPEND
206              Same as CFLAGS_APPEND for Fortran sources.
207
208       CPPFLAGS
209              Preprocessor flags which are passed to the Debian  build  system
210              and  can/should  be  overriden  by  the  package build if needed
211              (default: empty). This macro is seldom used (most build  systems
212              just use CFLAGS instead of CPPFLAGS).
213
214       CPPFLAGS_APPEND
215              Preprocessor  flags  appended  to  the preprocessor flags, which
216              must not be overwritten by the package (mostly used to for  test
217              builds). Default value: empty.
218
219       LDFLAGS
220              Options  passed  to  the  compiler  when  linking executables or
221              shared objects (if the linker is called directly, then -Wl and ,
222              have to be stripped from these options). Default value: empty.
223
224       LDFLAGS_APPEND
225              Optimization options appended to the compiler flags when linking
226              code, which must not be overwritten by the package (mostly  used
227              to for test builds). Default value: empty.
228

BUGS

230       It should be possible to specify spaces and shell metacharacters in and
231       initial arguments for gain-root-command and sign-command.
232

SEE ALSO

234       dpkg-source(1), dpkg-architecture(1), dpkg-genchanges(1),  fakeroot(1),
235       gpg(1).
236

AUTHORS

238       Copyright © 1995-1996 Ian Jackson
239       Copyright © 2000 Wichert Akkerman
240       Copyright © 2007 Frank Lichtenheld
241       Copyright © 2008 Raphaël Hertzog
242
243       This  is free software; see the GNU General Public Licence version 2 or
244       later for copying conditions. There is NO WARRANTY.
245
246
247
248Debian Project                    2009-06-13              dpkg-buildpackage(1)
Impressum