Packaging

(add link to detailed developer guide documentation)
Line 133: Line 133:
  pJ/JICzLKiBLySTYVArpdFrp3DuMhRZVqfvnJ+wPAQYA1hdr5EDqltYAAAAASUVORK5CYII=
  pJ/JICzLKiBLySTYVArpdFrp3DuMhRZVqfvnJ+wPAQYA1hdr5EDqltYAAAAASUVORK5CYII=
</pre>
</pre>
 +
 +
= Formerly "Getting started with packaging" page - needs merge =
 +
 +
''Note: The main goal of this page is to provide someone with a very quick way to get from source code to distributed package, and to aggregate links to more in-depth information. Please keep things simple here.''
 +
 +
== Prerequisites ==
 +
 +
We assume here that you have a software package which you have developed, and which can be installed from source using a standard <pre>./configure; make; sudo make install</pre> process.
 +
 +
For the purposes of our article, we will be packaging a simple command-lie utility called "rot13", which will perform a simple [http://en.wikipedia.org/wiki/ROT13 rot13] cipher on all text input from stdin.
 +
 +
== Packaging a .deb ==
 +
 +
The easiest way to package a .deb file is to use Debian's build helpers.
 +
 +
Package your application as you would distribute it in a .tar.gz (when using autotools, this is done with "make distcheck"). In our example, we uncompress rot13-0.1.tar.gz, and change the current directory to rot13-0.1.
 +
 +
$ tar xfz rot13-0.1.tar.gz
 +
$ cd rot13-0.1
 +
 +
Then we run dh_make, which initialises the Debian package management file structure (among other things):
 +
$ dh_make -e <my email address> -f ../rot13-0.1.tar.gz -c GPL
 +
 +
You can of course choose a different licence for your package.
 +
 +
Answer the resulting questions - in this case, we are packaging a single binary.
 +
 +
We can now edit the files in the debian/ directory which has been created to their desired values, before packaging the software. In fact, we can delete many of these files. All of the files ending in ".ex" or ".EX" and example files, intended to help you package different types of software.
 +
 +
If you use a standard configure script, you do not need to moduify any files in here at all.
 +
 +
Before creating a .deb, you should set a changelog entry. .deb changelogs follow a special format, so rather than editing the files by hand, use the dch helper application. This will allow you to add what new features went into this application, give credit, and so on. On saving, a syntax check is performed which ensures that the resulting file is OK. The file format is completely documented in the [http://www.debian.org/doc/maint-guide/ Debian packaging guide].
 +
 +
Finally, we generate a .deb from the source code using the command
 +
dpkg-buildpackage -sa -rfakeroot -k<my email address>
 +
 +
You should now have several files created in the parent directory to where you unpacked the source code. I have;
 +
 +
rot13_0.1.orig.tar.gz
 +
rot13_0.1-1_i386.deb
 +
rot13_0.1-1.diff.gz
 +
rot13_0.1-1.dsc
 +
rot13_0.1-1_i386.changes
 +
 +
Now change the target architecture to ARMEL and rebuild it, to generate rot13_0.1-1_arm.deb
 +
 +
== Uploading to extras ==
 +
 +
TODO.
 +
 +
 +
See also [[Documentation/Maemo 5 Developer Guide/Packaging, Deploying and Distributing | Deploying and distributing software on Maemo 5]] and [http://www.forum.nokia.com/Tools_Docs_and_Code/Documentation/Maemo.xhtml Forum Nokia developer documentation].
 +
 +
 +
[[Category:Development]]
[[Category:Development]]
[[Category:Development]]

Revision as of 16:34, 26 January 2010

This page describes the process of taking software and packaging it for the Maemo platform. For more detailed information, see Packaging, Deploying and Distributing from the Maemo 5 Developer Guide

Contents

Creating Packages for Maemo

Since Maemo is based on the Debian operating system, creating packages for Maemo borrows a lot of tools and techniques from Debian.

Background information

The following list is a resource for getting started with packaging for Maemo, these links will largely discuss packaging Python apps but can be used for any programming language. The first resource is a link to the Debian wiki entry for the Python Modules Team;

Debian's Python Modules Team

These folks package a lot of Python modules for debian, so their documentation will be pretty authoritative and looking at their packages will probably teach you a lot.

The next link is to the Python policy. Boring I know, but you will be directed there for answers to various questions, so you might as well have a handy link to it.

Python Policy

Here is an interesting and pretty darn good screencast and tutorial showing how to package a simple python application as a deb on Ubuntu!

Creating debs on Ubuntu

Ubuntu also has a Packaging guide which might be useful, I haven't read all of it and it is more general than just Python programming.

Ubuntu Packaging Guide

Maemo-specific information

Packaging policy

Most of the specifics for Maemo packaging are outlined in the Maemo packaging policy. The policy is still in the draft stage, though, so certain parts are still incomplete or not entirely up to date.

Sections

This is the list used in Fremantle/Maemo5 and is the same as the final list for Diablo as discussed in the task.

Key Example English i18n Example apps
user/desktop Desktop Home, statusbar and taskbar applets
user/development Programming py2deb
user/education Education Flashcard apps
user/games Games Doom, Duke Nukem 3D
user/graphics Graphics Photo apps, GIMP, Inkscape, fonts
user/multimedia Multimedia or Sound & Video Canola, mplayer, Kagu, UKMP, MediaBox
user/navigation (Location &) Navigation maemo-mapper, Navit
user/network Internet & Networking Web browsers, Samba clients, OpenAFS, Transmission
user/office Office GPE, Claws, AbiWord
user/science Science gnuplot, Octave
user/system System rotation-support, enhanced kernels, themes
user/utilities Utilities or Accessories Calculators, terminals, text editors

If the package's section starts "user/", but is not any of the above, the Application Manager forces them into an "Other" section.

Maemo-specific fields

There are a number of Maemo-specific package fields that are handled by Application manager. The Application manager documentation outlines them.

Displaying an icon in the Application Manager next to your package

Displaying an icon in the Application Manager next to your package makes it look pretty and makes your package stand out, and it is not that hard to do.

  1. Make an image that is 48x48 pixels. The image can be saved in any format that is supported by GdkPixbufLoader on Maemo, but PNG is commonly used.
  2. base64 encode the image. This can be done in many ways, depending on the platform, but assuming you are in scratchbox:
apt-get update
apt-get install sharutils
uuencode -m <name of 48x48 image> <name of 48x48 image> > <name of 48x48 image>.base64
  1. Add the field XB-Maemo-Icon-26 to your debian/control (in Maemo4 the size of the icons was 26x26, hence the name of the field, which has not changed)
  2. Open the base64 version of your image and copy from the line under begin-base64 644 <name of 48x48 image> to the line above the ===
  3. Add this to the XB-Maemo-Icon-26 field
  4. Add a space in front of every line of the encoded icon

Here is an example of a properly formatted Maemo-Icon-26: (of wrong image size)

Description: Chess...
XB-Maemo-Icon-26: 
 iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAABGdBTUEAAK/INwWK6QAAABl0
 RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAALxSURBVHja3FZNTBNREP669J/S
 XYxtKRWl1JOSFBIPhkitCQeNiaKBmzdj9Ggk0ZOBxHDWixcTjV6MF+WiIB40YEyMBMGYEqQK
 tLS2lG7pdre0pF3WtxslgJRuD2J0kpfdTN7O976Z782sRpIk7IZR2C2TGW1cv8xaY5WuXLy8
 iW5XV5fk8/kkr9e7ya/T6SSNRiOViikvbbmDDD590SusZBGYDiDwJbDud7vdvYIgIJfLYXV1
 tSwhrQrSfRX6/26N/j+gkjW6ce06HE4HGEctGuj9oEwUzFYz5ubmEA6HQVEUisUi8vn8b4rd
 zjRbNxCZrr+3t7XTzjrnvMfdxMi7xj6OIRaPIbWcQjabVdRWKBTkrX4SZ2SjvCtKXf+tkxxD
 M5MetwfHj/lwwueHy+WCVqvdehdHKq7R6JvbpfNMAGiGhs1mg9ls3sS+4hodbDqCwef9mA9P
 7vhhVVWV3BGUOomiaCSufEWMxNwimlweMFYbpoMfyp70J6t8xanLZgWs8Ak07N0Hau0P3qOs
 wIHnl5FJx2E1WlUFuXrzIS713KusRplMCoLAgl2O4N34ODQ4VRaot6cbUzMRNNQ/w/uJWXWM
 eH5JARkYHsLQMIe1NZEpB7Sn1uKFhkL3maO4cL5NHVAo+hkPnrzEq2HqQIf/3ICzvr7FXmeH
 3qBXlslkgtFoVBS3YfbcKRRFfJpagE6vUwd0//FbjI7mkcvnGoNfg51ORx3sNju+hWYxMxsk
 jHlF2jJgdXU1DAaDrDx/kQAVRREJlldXo8kJoPlQ8wHSevosFgs5MmE5H0IingDP8eAzPAQC
 tkJakDz05Hsks+poPzwg6+Luo9chVb2O3Hilv7V6W5nO02cVX3wxjsj3CMKRBUSjUcQWY0iy
 SQVoi6XJaiQxubKpI02yj2xk6BoaBr0BqXRKCZpYSiCZlIXCguM4pWtvY0ypyUtt87PSIj/t
 pJ/JICzLKiBLySTYVArpdFrp3DuMhRZVqfvnJ+wPAQYA1hdr5EDqltYAAAAASUVORK5CYII=

Formerly "Getting started with packaging" page - needs merge

Note: The main goal of this page is to provide someone with a very quick way to get from source code to distributed package, and to aggregate links to more in-depth information. Please keep things simple here.

Prerequisites

We assume here that you have a software package which you have developed, and which can be installed from source using a standard
./configure; make; sudo make install
process.

For the purposes of our article, we will be packaging a simple command-lie utility called "rot13", which will perform a simple rot13 cipher on all text input from stdin.

Packaging a .deb

The easiest way to package a .deb file is to use Debian's build helpers.

Package your application as you would distribute it in a .tar.gz (when using autotools, this is done with "make distcheck"). In our example, we uncompress rot13-0.1.tar.gz, and change the current directory to rot13-0.1.

$ tar xfz rot13-0.1.tar.gz
$ cd rot13-0.1

Then we run dh_make, which initialises the Debian package management file structure (among other things):

$ dh_make -e <my email address> -f ../rot13-0.1.tar.gz -c GPL

You can of course choose a different licence for your package.

Answer the resulting questions - in this case, we are packaging a single binary.

We can now edit the files in the debian/ directory which has been created to their desired values, before packaging the software. In fact, we can delete many of these files. All of the files ending in ".ex" or ".EX" and example files, intended to help you package different types of software.

If you use a standard configure script, you do not need to moduify any files in here at all.

Before creating a .deb, you should set a changelog entry. .deb changelogs follow a special format, so rather than editing the files by hand, use the dch helper application. This will allow you to add what new features went into this application, give credit, and so on. On saving, a syntax check is performed which ensures that the resulting file is OK. The file format is completely documented in the Debian packaging guide.

Finally, we generate a .deb from the source code using the command

dpkg-buildpackage -sa -rfakeroot -k<my email address>

You should now have several files created in the parent directory to where you unpacked the source code. I have;

rot13_0.1.orig.tar.gz
rot13_0.1-1_i386.deb
rot13_0.1-1.diff.gz
rot13_0.1-1.dsc
rot13_0.1-1_i386.changes

Now change the target architecture to ARMEL and rebuild it, to generate rot13_0.1-1_arm.deb

Uploading to extras

TODO.


See also Deploying and distributing software on Maemo 5 and Forum Nokia developer documentation.