dpkg-buildpackage is a program that automates the process of building a
Debian package. It consists of the following steps:
1. It prepares the build environment by setting various environment
variables (see ENVIRONMENT) and calls dpkg-source --before-build
(unless -T or --target has been used).
2. It checks that the build-dependencies and build-conflicts are satis-
fied (unless -d is specified).
3. If a specific target has been selected with the -T or --target
option, it calls that target and stops here. Otherwise it calls
fakeroot debian/rules clean to clean the build-tree (unless -nc is
4. It calls dpkg-source -b to generate the source package (unless a
binary-only build has been requested with -b, -B or -A).
5. It calls debian/rules build followed by fakeroot debian/rules
binary-target (unless a source-only build has been requested with
-S). Note that binary-target is either binary (default case, or if
-b is specified) or binary-arch (if -B is specified) or binary-indep
(if -A is specified).
6. It calls gpg to sign the .dsc file (if any, unless -us is speci-
7. It calls dpkg-genchanges to generate a .changes file. Many
dpkg-buildpackage options are forwarded to dpkg-genchanges.
8. It calls gpg to sign the .changes file (unless -uc is specified).
9. If -tc is specified, it will call fakeroot debian/rules clean again.
Finally it calls dpkg-source --after-build.
-b Specifies a binary-only build, no source files are to be built
and/or distributed. Passed to dpkg-genchanges.
-B Specifies a binary-only build, limited to architecture dependent
packages. Passed to dpkg-genchanges.
-A Specifies a binary-only build, limited to architecture indepen-
dent packages. Passed to dpkg-genchanges.
-S Specifies a source-only build, no binary packages need to be
made. Passed to dpkg-genchanges.
-F Specifies a normal full build, binary and source packages will
Only meaningful together with --target. Requires that the target
be run with root rights.
Passed unchanged to dpkg-genchanges. See its manual page.
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.
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 sys-
tem type of the target Debian architecture.
-jjobs Number of jobs allowed to be run simultaneously, equivalent to
the make(1) option of the same name. Will add itself to the
MAKEFLAGS environment variable, which should cause all subse-
quent make invocations to inherit the option. Also adds paral-
lel=jobs to the DEB_BUILD_OPTIONS environment variable which
allows debian/rules files to use this information for their own
purposes. The parallel=jobs in DEB_BUILD_OPTIONS environment
variable will override the -j value if this option is given.
-D Check build dependencies and conflicts; abort if unsatisfied.
This is the default behavior.
-d Do not check build dependencies and conflicts.
-nc Do not clean the source tree (implies -b if nothing else has
been selected among -B, -A or -S).
-tc Clean the source tree (using gain-root-command debian/rules
clean) after the package has been built.
When dpkg-buildpackage needs to execute part of the build
process as root, it prefixes the command it executes with gain-
root-command if one has been specified. Otherwise, if none has
been specified, fakeroot will be used by default, if the command
is present. gain-root-command should start with the name of a
program on the PATH and will get as arguments the name of the
real command to run and the arguments it should take. gain-
root-command can include parameters (they must be space-sepa-
rated) but no shell metacharacters. gain-root-command might
typically be fakeroot, sudo, super or really. su is not suit-
When dpkg-buildpackage needs to execute GPG or PGP to sign a
source control (.dsc) file or a .changes file it will run sign-
command (searching the PATH if necessary) instead of gpg. sign-
command will get all the arguments that pgp would have gotten.
If sign-command takes its arguments in GPG rather than PGP
style, you should give the -sgpg option. sign-command should not
contain spaces or any other shell metacharacters.
Specify a key-ID to use when signing packages.
-us Do not sign the source package.
-uc Do not sign the .changes file.
Passed unchanged to dpkg-source. See its manual page.
Pass option opt to dpkg-source.
Pass option opt to dpkg-genchanges.
Change the location of the dpkg database. The default location
Show the usage message and exit.
Show the version and exit.
Even if dpkg-buildpackage exports some variables, debian/rules should
not rely on their presence and should instead use the respective inter-
face to retrieve the needed values.
Variables set by dpkg-architecture
dpkg-architecture is called with the -a and -t parameters forwarded.
Any variable that is output by its -s option is integrated in the build
The CFLAGS, CXXFLAGS, FFLAGS, CPPFLAGS and LDFLAGS environment vari-
ables are set to the values that dpkg-buildflags returned. See its man-
ual page for more information.
Copyright (C) 2008-2010 Raphael Hertzog
This is free software; see the GNU General Public Licence version 2 or
later for copying conditions. There is NO WARRANTY.
Debian Project 2011-08-14 dpkg-buildpackage(1)
Man Pages Copyright Respective Owners. Site Copyright (C) 1994 - 2017
All Rights Reserved.