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-target followed by fakeroot debian/rules
binary-target (unless a source-only build has been requested with
-S). Note that build-target and binary-target are either build and
binary (default case, or if -b is specified), or build-arch and
binary-arch (if -B is specified), or build-indep and binary-indep
(if -A is specified).
6. It calls gpg2 or gpg to sign the .dsc file (if any, unless -us is
specified or on UNRELEASED builds).
7. It calls dpkg-genchanges to generate a .changes file. Many
dpkg-buildpackage options are forwarded to dpkg-genchanges.
8. It calls gpg2 or gpg to sign the .changes file (unless -uc is speci-
fied or on UNRELEASED builds).
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.
Debian policy do not need this option.
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.
Specify the profile(s) we build, as a comma-separated list,
without the "profile." namespace prefix. The default behavior is
to build for no specific profile. Also adds them (as a space
separated list) to the DEB_BUILD_PROFILES environment variable
which allows, for example, debian/rules files to use this infor-
mation for conditional builds.
-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.
Building a Debian package usually involves invoking 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). Alterna-
tively it can be used to execute the standard rules file with
another make program (for example by using /usr/local/bin/make
-f debian/rules as rules-file).
When dpkg-buildpackage needs to execute GPG to sign a source
control (.dsc) file or a .changes file it will run sign-command
(searching the PATH if necessary) instead of gpg2 or gpg. sign-
command will get all the arguments that gpg2 or gpg would have
gotten. sign-command should not contain spaces or any other
Specify a key-ID to use when signing packages.
-us Do not sign the source package.
-uc Do not sign the .changes file.
Force the signing of the resulting files (since dpkg 1.17.0),
regardless of -us or -uc or other internal heuristics.
-z, -Z 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.
If set, it will be used to sign the .changes and .dsc files.
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
Compiler flags are no longer exported
Between dpkg 1.14.17 and 1.16.1, dpkg-buildpackage exported compiler
flags (CFLAGS, CXXFLAGS, FFLAGS, CPPFLAGS and LDFLAGS) with values as
returned by dpkg-buildflags. This is no longer the case.
Default build targets
dpkg-buildpackage is using the build-arch and build-indep targets since
dpkg 1.16.2. Those targets are thus mandatory. But to avoid breakages
of existing packages, and ease the transition, it will fallback to
using the build target if make -f debian/rules -qn build-target returns
2 as exit code.
It should be possible to specify spaces and shell metacharacters in and
initial arguments for gain-root-command and sign-command.
dpkg-source(1), dpkg-architecture(1), dpkg-buildflags(1),
dpkg-genchanges(1), fakeroot(1), gpg2(1), gpg(1).
Debian Project 2013-12-12 dpkg-buildpackage(1)
Man Pages Copyright Respective Owners. Site Copyright (C) 1994 - 2019
All Rights Reserved.