## Packaging With CDBS

CDBS is a tool that uses debhelper to make building and maintaining Debian packages even easier. It has many advantages:

- It produces a short, readable, and efficient `debian/rules`

- It automates debhelper and autotools for you, so you do not have to worry about repetitive tasks

- It helps you focus on more important packaging problems, because it helps without limiting customization

- Its classes have been well tested, so you can avoid dirty hacks to solve common problems

- Switching to CDBS is easy

- It is extensible

### Using CDBS in packages

Using CDBS for Ubuntu packages is very easy. After adding cdbs to the Build-Depends in `debian/control`, a basic `debian/rules` file using CDBS can fit in 2 lines. For a simple C/C++ application with no extra rules, such as hello, `debian/rules` can look like this :

    #!/usr/bin/make -f

    include /usr/share/cdbs/1/rules/debhelper.mk
    include /usr/share/cdbs/1/class/autotools.mk

That is all you need to build the program! CDBS handles installing and cleaning. You can then use the `.install` and `.info` files to tune your package with the usual debhelper functions in the various sections for `debian/rules`.

Do not use DEB_AUTO_UPDATE_DEBIAN_CONTROL:=yes to automatically change `debian/control`. It can cause bad things, and Debian considers it a reason to reject a package from entering the archives. See http://ftp-master.debian.org/REJECT-FAQ.html for more information.

As you can see, CDBS mostly works by including `.mk` Makefiles in `debian/rules`. The cdbs package provides such files in `/usr/share/cdbs/1/` that allow you to do quite a lot of packaging tasks. Other packages, such as quilt, add modules to CDBS and can be used as Build-Depends. Note that you can also use your own CDBS rules and include them in the package. The most useful modules included with the cdbs package are:

- `rules/debhelper.mk`: Calls debhelper in all required sections

- `rules/dpatch.mk`: Allows you to use dpatch to ease patching the source

- `rules/simple-patchsys.mk`: Provides a very easy way to patch the source

- `rules/tarball.mk`: Allows you to build packages using the compressed tarball in the package

- `class/autotools.mk`: Calls autotools in all required sections

- `class/gnome.mk`: Builds GNOME programs (requires the proper Build-Depends in `debian/control`)

- `class/kde.mk`: Builds KDE programs (requires the proper Build-Depends in `debian/control`)

- `class/python-distutils.mk`: Facilitates packaging Python programs

### More information on CDBS

For more information on CDBS, see Marc Dequènes's guide at https://perso.duckcorp.org/duck/cdbs-doc/cdbs-doc.xhtml.

Packaging with Debhelper |  | Aggiornare i pacchetti