The Debian Build System

Learn how to create a Debian package using the Debian build system.

Most or even all packages in the official Debian repository use the same build system based on a standard directory layout.

This build system reads files within the debian directory of the project and typically involves the debhelperThe debhelper toolchain uses a set of smaller tools, each of which, when invoked, completes some task in the build process. tool.

This standard build system is structured in a sequence of phases that assemble the files for the final Debian package in the directory debian/<packagename>. At the end, one of the debhelper tools, dh_builddeb, is called to create the actual .deb file.

A minimal package

Let’s use the debhelper toolchain to create a minimal Debian package called hello-debian.

We start with an empty directory for our We start with an empty directory for our project, create a debian directory in it, and declare our debhelper compatibility level:

$ mkdir -p hello-debian/debian
$ cd hello-debian/debian
$ echo 13 > compat
Setting compatibility level
Terminal 1
Terminal
Loading...

At the time of writing, the highest compatibility level is 13, and levels lower than 10 are not recommended.

Note: The debhelper tools try very hard to ...