blob: 5410a20c239d0dd260fb7bff2f4ec90002627d8c [file] [log] [blame]
.TH dpkg\-buildpackage 1 "2011-08-14" "Debian Project" "dpkg utilities"
dpkg\-buildpackage \- build binary or source packages from sources
.B dpkg\-buildpackage
.RI [ option ...]
.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\fP) and calls \fBdpkg\-source
\-\-before\-build\fP (unless \fB\-T\fP or \fB\-\-target\fP has been used).
.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 \-b\fP to generate the source package (unless
a binary\-only build has been requested with \fB\-b\fP, \fB\-B\fP or
.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
.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. Finally it calls \fBdpkg\-source \-\-after\-build\fP.
.B \-b
Specifies a binary-only build, no source files are to be built and/or
distributed. Passed to \fBdpkg\-genchanges\fP.
.B \-B
Specifies a binary-only build, limited to architecture dependent packages.
Passed to \fBdpkg\-genchanges\fP.
.B \-A
Specifies a binary-only build, limited to architecture independent
packages. Passed to \fBdpkg\-genchanges\fP.
.B \-S
Specifies a source-only build, no binary packages need to be made.
Passed to \fBdpkg\-genchanges\fP.
.B \-F
Specifies a normal full build, binary and source packages will be built.
This is the same as the default case when no build option is specified.
.BI \-\-target= target
.BI "\-\-target " target
.BI \-T target
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.
.B \-\-as\-root
Only meaningful together with \fB\-\-target\fP. Requires that the target be
run with root rights.
.B \-si
.B \-sa
.B \-sd
.BI \-v version
.BI \-C changesdescription
.BI \-m maintaineraddress
.BI \-e maintaineraddress
Passed unchanged to \fBdpkg\-genchanges\fP. See its manual page.
.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.
.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.
.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.
.B \-D
Check build dependencies and conflicts; abort if unsatisfied. This is the
default behavior.
.B \-d
Do not check build dependencies and conflicts.
.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).
.B \-tc
Clean the source tree (using
.I gain-root-command
.BR "debian/rules clean" )
after the package has been built.
.BI \-r gain-root-command
.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
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
.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.
.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).
.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.
.BI \-k key-id
Specify a key-ID to use when signing packages.
.BR \-us
Do not sign the source package.
.BR \-uc
Do not sign the \fB.changes\fP file.
.BR \-i [\fIregexp\fP]
.BI \-I [\fIpattern\fP]
.BR \-s [ nsAkurKUR ]
.BR \-z ", " \-Z
Passed unchanged to \fBdpkg\-source\fP. See its manual page.
.BI \-\-source\-option= opt
Pass option \fIopt\fP to \fBdpkg\-source\fP.
.BI \-\-changes\-option= opt
Pass option \fIopt\fP to \fBdpkg\-genchanges\fP.
.BI \-\-admindir= dir
.BI "\-\-admindir " dir
Change the location of the \fBdpkg\fR database. The default location is
.BR \-h ", " \-\-help
Show the usage message and exit.
.BR \-\-version
Show the version and exit.
Even if \fBdpkg\-buildpackage\fP exports some variables, \fBdebian/rules\fP
should not rely on their presence and should instead use the
respective interface to retrieve the needed values.
.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 are no longer exported
Between versions 1.14.17 and 1.16.1, \fBdpkg\-buildpackage\fP
exported compiler flags (\fBCFLAGS\fP, \fBCXXFLAGS\fP, \fBFFLAGS\fP,
\fBCPPFLAGS\fP and \fBLDFLAGS\fP) with values as returned
by \fBdpkg\-buildflags\fP. This is no longer the case.
It should be possible to specify spaces and shell metacharacters in
and initial arguments for
.IR gain-root-command " and " sign-command .
.BR dpkg\-source (1),
.BR dpkg\-architecture (1),
.BR dpkg\-buildflags (1),
.BR dpkg\-genchanges (1),
.BR fakeroot (1),
.BR gpg (1).
Copyright \(co 1995-1996 Ian Jackson
Copyright \(co 2000 Wichert Akkerman
Copyright \(co 2007 Frank Lichtenheld
Copyright \(co 2008-2010 Rapha\[:e]l Hertzog
This is free software; see the GNU General Public Licence version 2 or later
for copying conditions. There is NO WARRANTY.