dpkg-buildpackage(1)
Build a Debian package from source code in a directory tree.
Synopsis
dpkg-buildpackage [OPTION]... [--] [MAKE_OPTIONS]Description
dpkg-buildpackage is a wrapper around the Debian package build process. It reads the debian/control file, installs build dependencies, runs the debian/rules file with appropriate targets, and creates binary and source packages ready for distribution.
The command automates the sequence of building, signing, and packaging, handling dependency resolution and version tracking automatically. It requires a proper debian/ directory with control, rules, and changelog files.
By default, it builds both binary and source packages; use -b, -B, or -A flags to build only specific package types.
Common options
| Flag | What it does |
|---|---|
-b | Build binary packages only (architecture-dependent) |
-B | Build binary packages only (architecture-independent) |
-A | Build binary packages for all architectures |
-S | Build source package only (no binary packages) |
-nc | Do not clean the source tree (skip clean target) |
-d | Do not check build dependencies and conflicts |
-k<keyid> | Use the specified GPG key to sign packages (default: maintainer key) |
-us | Unsigned source package (skip source signing) |
-uc | Unsigned changes file (skip changes file signing) |
-j<jobs> | Set the number of parallel jobs for make (default: CPU count) |
-v<version> | Include changelog entries for versions newer than <version> |
--build=<type> | Specify build type: full, binary, arch, source, or any |
Examples
Build only binary packages for the current architecture
dpkg-buildpackage -bBuild only the source package (.dsc and .tar.gz)
dpkg-buildpackage -SBuild packages without signing (useful for testing builds)
dpkg-buildpackage -us -ucBuild binary packages using 4 parallel jobs
dpkg-buildpackage -b -j4Build binary packages without checking build dependencies
dpkg-buildpackage -b -dBuild binary packages and sign with a specific GPG key ID
dpkg-buildpackage -b -k4096R/A1B2C3D4Build binary packages without cleaning the source tree first
dpkg-buildpackage -nc -bBuild binary packages for all architectures
dpkg-buildpackage -A