LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

sbuild

Build Debian packages in clean chroot environments

TLDR

Build a package
$ sbuild [package.dsc]
copy
Build for a specific distribution
$ sbuild -d [unstable] [package.dsc]
copy
Build for a specific architecture
$ sbuild --arch=[arm64] [package.dsc]
copy
Build with parallel jobs
$ sbuild -j[4] [package.dsc]
copy
Build and run lintian afterwards
$ sbuild --run-lintian [package.dsc]
copy
Create a chroot
$ sbuild-createchroot [unstable] [/srv/chroot/unstable] [http://deb.debian.org/debian]
copy

SYNOPSIS

sbuild [-d dist] [--arch arch] [options] dsc-file

DESCRIPTION

sbuild builds Debian packages inside clean chroot environments managed by schroot, ensuring reproducible results by starting from a pristine base system for each build. Build dependencies are installed fresh each time, eliminating contamination from previous builds or the host system.The tool supports cross-architecture builds, allowing packages to be compiled for different platforms like arm64 or armhf from an x86 host. It is compatible with the Debian buildd infrastructure, meaning packages built with sbuild match the same build process used by official Debian archive builders.

PARAMETERS

-d, --dist=DIST

Target distribution (e.g. unstable, bookworm).
--arch=ARCH
Build architecture (e.g. amd64, arm64).
-c, --chroot=CHROOT
Use a specific chroot environment.
-j, --jobs=N
Number of parallel build jobs.
-s, --source
Build source package in addition to binaries.
-A, --arch-all
Also build architecture-independent packages.
--build-dep-resolver=RESOLVER
Choose dependency resolver: apt (default), aptitude, aspcud.
--extra-repository=SPEC
Add an additional apt repository for the build.
--run-lintian
Run lintian after a successful build.
--no-clean-source
Skip running debian/rules clean before building.
--profiles=PROFILE[,...]
Specify build profiles.
-p, --purge=MODE
Purge build directory: always, never, or successful.
-v, --verbose
Verbose output.
-n, --nolog
Print output to stdout only, skip log files.

CAVEATS

Requires chroot setup via sbuild-createchroot. Root privileges or appropriate group membership (sbuild group) needed. Primarily for Debian/Ubuntu packaging.

HISTORY

sbuild was originally developed for the Debian buildd network. It provides clean and reproducible package builds.

SEE ALSO

Copied to clipboard
Kai