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="Your Name"
Make initial debianization:
dh_make -e your.name@example.org
Next dh_make will ask a question and print a summary of the package:
Type of package: single binary, multiple binary, library, kernel module or cdbs? [s/m/l/k/b] s Maintainer name : Your Name Email-Address : your.name@example.org Date : Fri, 30 Nov 2007 13:20:48 +0200 Package Name : my-application Version : 1.0.0 License : blank Type of Package : Single Hitto 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) |
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: Your Name <your.name@example.org> Build-Depends: debhelper (>= 4.0.0) Standards-Version: 3.6.0 Package: my-application Architecture: any Depends: libhildon1 Description: A simple test application A very simple application with a short description. Which spans multiple lines actually. XB-Maemo-Icon-26: iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAABmJLR0QA/wD/AP+g vaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1gURDQoYya0JlwAAAU9J REFUSMftlL1KA0EUhb/NZl/ggnHQxsJUxt5CUucVJCCkDfgyKdIGG5/A0s5HEBtJ EdDAQGBgmw0YJmMzgXXYza5CtNkDW9zZw5z7c+ZCgwb/Ai3i9sVl/Bq8RIs4LRK1 gJDsKvJyNXmJMuYTsMoY1zpgozaABdYArQNPZQ1kfyGU7SpqVwxzAMwABWhgpIwp 4vWBB+AUWAI3ypjnfEXtPU4bLKx9vErTeCeiRSYF+fTn1j5dp2myE9EiU+DSi3wX ymeqRQAmZ3EcA5E/fgO6BULT8zhOcrwXoJdrXRa2Lgps2y2odAUcBUIXQdz78YyC SldAp8b7+bXrIv91qjZBietqCc2DjbAt4b2WxJkyZljVujlwp0U0cPxuLcAIuC+4 dKxFlsDJarvdAGP/b6hFnDImYs+uG3hbO2AB3Jbsur63tQM+fFx3bzZocEB8AdV2 gJBZgKTwAAAAAElFTkSuQmCC
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 Manager,
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 Manager 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 Application Packages "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.
Once the application is properly 'Debianized', building the application is done easily with the command:
[sbox-CHINOOK_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 Manager.
You can test you package in the SDK by typing:
[sbox-CHINOOK_X86: ~/my-application-1.0.0] > cd .. [sbox-CHINOOK_X86: ~] > fakeroot dpkg -i my-application_1.0.0-0_i386.debReplace '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. For further information about creating application packages for maemo, see Making Application Packages.
/usr/share/icons/hicolor
then you should make sure to run thegtk-update-icon-cache /usr/share/icons/hicolor
command in the
postinst
script, otherwise your icons might not show up until the device is restarted!
Improve this page