Creating a Debian package

When creating a Debian package, the first step is to put all the files (the source code, and the png and other graphics, desktop and service files) in an empty directory called my-application-1.0.0. The directory name should follow the <package-name>-<app-version> convention. This means that the package that you are creating for your application is called my-application.

Go to the source directory:

cd my-application-1.0.0

Set full name environment variable:

export DEBFULLNAME="Blaha Lujza"

Make initial debianization:

dh_make -e

Next dh_make will ask a question and print a summary of the package:

Type of package: single binary, multiple binary, library, or kernel module?
 [s/m/l/k] s

Maintainer name : Blaha Lujza
Email-Address   :
Date            : Thu, 23 Aug 2007 10:42:18 +0300
Package Name    : my-application
Version         : 1.0.0
Type of Package : Single
Hit <enter> to confirm: 

The dh_make command creates a debian subdirectory containing multiple configuration text files, most of which are templates that can be removed, since the application does not use them. The table below lists the needed files (others can be removed):

File in ./debian Description
changelog Application's change log
compat Debian helper compatibily version. Leave it as it is.
control Describes the packages to be made. For more information, see the paragraphs below the table.
copyright Copyright text. Fill in the blanks.
rules A makefile containing the rules to build all kinds of packages (such as source and binary). For more information, see the paragraphs below the table.

The key files in ./debian are control and rules. They contain a generic template showing what they must look like. In control, you must simply fill in the blanks and, in rules, you essentially need to remove unwanted and unnecessary code.

The following example illustrates what the control file for the example application must contain:

Source: my-application
Section: user/other 
Priority: optional 
Maintainer: Blaha Lujza <>
Build-Depends: debhelper (>= 4.0.0) 
Standards-Version: 3.6.0

Package: my-application 
Architecture: any
Depends: hildon-libs0 
Description: A simple test application
 A very simple application with a short description.
 Which spans multiple lines actually. 

The XB-Maemo-Icon-26 field contains the application icon file (in this case, hello_icon_26x26.png) encoded in base64. This is the icon that is shown in the Application Installer, next to the package name. To do this encoding in Linux, you can use either uuencode or openssl (there can be more suitable applications). Scratchbox rootstraps for maemo have been encoded with uuencode. Do not forget to put a white space at the beginning of each line containing the icon-encoded text. The white space serves as indentation. The same rule stands for the long package description ( A very simple application[...]).

The Application Installer only shows packages in the user section. Thus, your Section: field in the control file must has the Section: user/<SUBSECTION> syntax, where <SUBSECTION> is arbitrary. See Making a package for the Application Manager in maemo 3.x "Sections" chapter about the suggested values

The rules file is usually does not need to be changed. However if the created .deb package is empty then check the "install:" section and make sure that the DESTDIR environment variable is pointing to the right place, that is, where the rest of the packaging scripts are looking for the application to be packaged.

If your application has a proper .desktop file (with rules in that installs it to usr/share/applications/hildon/ and you would like to have an entry for the application in the extras menu, then a my-application.links file should be created in the debian directory with the following contents:

usr/share/applications/hildon/my-application.desktop etc/others-menu/extra_applications/my-application.desktop

Once the application is properly 'Debianized', building the application is done easily with the command:

[sbox-SDK_X86: ~/my-application-1.0.0] > dpkg-buildpackage -rfakeroot

The system displays some output, including a couple of warnings near the end of it (about XB-Maemo-Icon-26) but that is normal. The parent directory now has a my-application_1.0.0-0_i386.deb file - your Debian package. This is the file that is distributed to maemo devices and installed using the Application Installer.

You can test you package in the SDK by typing:

[sbox-SDK_X86: ~/my-application-1.0.0] > cd ..
[sbox-SDK_X86: ~] > fakeroot dpkg -i my-application_1.0.0-0_i386.deb
Replace 'my-application...' with the actual name of the package. Packages can be installed in both X86 and ARMEL targets. The package architecture must match the Scratchbox target.

For more information about making Debian packages, see Debian New Maintainers' Guide.

If you create a control panel or status bar applet and your application is deploying icons to /usr/share/icons/hicolor then you should make sure to run the
gtk-update-icon-cache /usr/share/icons/hicolor
command in the postinst script, otherwise your icons will not show up until the device is restarted!

Improve this page