Port an existing Debian package
Main article: Packaging
[edit] Finding your package in Debian
If you want to port a Debian package to Maemo, you should check and see if it is already packaged for Debian and use that package if you can - this will save you time and effort. You can search in Debian's Package Tracking System (PTS) to see if it is there. There is a search system on the PTS page, under the "distribution" drop-down, select 'any', this will search throughout Debian's repositories to find the package. Debian has more than 20,000 packages just in its stable distribution so your application is likely already packaged.
If you find the package already exists in Debian, you can get the source, including the packaging source, with apt-get. To do this, you'll have to edit your /etc/apt/sources.list
, you can follow this recipe;
$ echo "deb http://ftp.it.debian.org/debian/ unstable main contrib non-free" >> /etc/apt/sources.list $ echo "deb-src http://ftp.it.debian.org/debian/ unstable main contrib non-free" >> /etc/apt/sources.list $ apt-get update $ apt-cache search "application name" $ apt-get source "application name"
To learn more about the /etc/apt/sources.list
you can do a 'man sources.list' if you are running Debian or a Debian-based GNU/Linux distro.
[edit] Modifying a Debian package for Maemo
Once you have the source of the Debian package, you will need to make some modifications to that package for it to build under Maemo. See the Maemo packaging guidelines for more information.
The maintainer field (in the debian/control
file) must be changed if the upstream package is modified, for example:
Maintainer: Tcl/Tk Debian Packagers <pkg-tcltk-devel@lists.alioth.debian.org>
should be replaced by
Maintainer: My Name <my@email.com> XSBC-Original-Maintainer: Tcl/Tk Debian Packagers <pkg-tcltk-devel@lists.alioth.debian.org>
You must add a new entry to debian/changelog
and append maemo1
to the version, for example:
tk8.5 (8.5.8-1) unstable; urgency=low
becomes:
tk8.5 (8.5.8-1maemo1) fremantle; urgency=low
This indicates that there have been Maemo-specific changes to the packaging. If you upload new changes, you must add a new changelog entry and increment the version number, for example maemo2
).
The "Debian way" is to keep all modifications to the package in the package.version.diff.gz
file and to leave the .orig.tar.gz
file untouched. There are several ways to apply patches with Debian packaging, and some are described in the patching section of the New Maintainer's Guide
However, the .diff.gz
cannot store binary files like icons. A possible workaround is to uuencode the binary file, for example (in debian/
):
uuencode -m icon.png icon.png > icon.png.b64
and in the rules file decode the file to debian/icon.png before installation
uudecode debian/icon.png.b64
For this solution you have to add sharutils
to the Build-Depends
.
If the package should be visible in the Application Manager, the Section field should begin with user/
, with the valid sections. You should also add and install a .desktop
file for starting the application, if one does not already exist.
[edit] Differences between Debian/Ubuntu and Maemo
The are a couple of important differences between a Debian system and Maemo:
- Busybox:
Maemo uses busybox to replace most of bsdutils, coreutils, findutils and bash, therefore most of the extended options for the commands and shell are not available. Check the postinstall and other package scripts for such options and try to replace or emulate them.
- Outdated build and configuration tools:
the SDK and autobuilder provide only outdated versions of gcc, dpkg, debhelper, cdbs, debconf, ucf and other build tools. Try to replace theBuild-Depends
in thedebian/control
file with older versions or use backports like debhelper7
- Directories for temporary files:
/tmp
is only 900 kB and should only be used for very small temporary files./var/tmp
on the NAND is larger. A new temporary directory in/home/user/
could be even larger. Replace constructs like${TMP-/tmp}
in shell scripts with${TMP-/var/tmp}
(the same applies tomktemp -p /tmp
).
- Optification may confuse programs:
some programs try to find their data files relative to the binary location. Such a program stored in/opt/maemo/usr/bin/program
would search, for instance, in/opt/maemo/usr/share
while the actual data may be in/usr/share
.
- Installation in
/opt
:
if you want to perform manual optification (e.g. usingconfigure --prefix=/opt/package
) you should store "none" indebian/optify
and add some to the postinst script which symlinks the binaries and libraries of the package to/usr/bin
andlib
, respectively.
- Documentation:
do not install documentation in/usr/share/doc
or/usr/share/info
- docpurge will remove it. You may install it in the/opt
hierarchy, however.
- This page was last modified on 28 April 2010, at 14:00.
- This page has been accessed 6,279 times.