2007-07-15

Manually creating a .deb package for maemo

After much gnashing of teeth I have managed to manually make a .deb package that installs on the N800. I wanted to make the .deb by hand since I use Fedora on the desktop, for which the dpkg tools are not available. (I haven’t installed Scratchbox, because there are no rpms available for it at the moment, and I’d like to install it cleanly.)

A .deb package is quite simple, at least in theory. It consists of a control.tar.gz archive with package control files, data.tar.gz archive of all files that will be installed and debian-binary file that indicates the deb version to use. These files are then placed within an ar archive.

I cobbled together the archive contents using a hacky make file and sed. The final ar archive was the main sticking point. The ar format used in .deb packages is different to that generated by GNU ar. By looking at an existing deb package (the one for maemo-wordpy as it happens) with the emacs hexl-mode and consulting the wikipedia entry on the ar format and a few other people who shared my pain, I was able to come up with a sed script to fix the internal headers:

sed -e 's|^\([^/]\+\)/ \(.*\)|\1 \2|g' temp.ar > output.deb

This still didn’t cut the mustard. It turns out that the order of the files within the ar archive is important:

ar -rc temp.ar build/debian-binary build/control.tar.gz build/data.tar.gz

The complete makefile is a bit of an embarrassment at the moment, so I won’t post it here. At some stage I’ll write a more general script for generating .deb packages.

A few more things learnt along the way:

  • dpkg-deb on the N800 cannot be used to make .debs since it appears to be incompatible with the busybox version of tar
  • non-header lines in the control file most be indented (e.g. description lines and base64-encoded icon)
  • the maemo installer icon is 26×26; ImageMagick is helpful here: convert -rescale 26x26 icon.png output.png
  • to base64 encode the icon do base64 icon.png | gawk '{print " "$$0;}' > icon.txt
  • create the md5sums file like so: find . -type f -exec md5sum {} \; | sed -e 's| \./||' > md5sums
  • some extra fields are needed in the .desktop file to get the icon to show up: X-Icon-path=/usr/share/icons X-Window-Icon=appname and the .png extension should be dropped from the Icon line.

Functional Exaile for maemo debs coming soon hopefully…

Update: I’ve made a reusable makefile fragment for generating .deb packages without using dpkg tools: deb_hand.mak, and an example custom makefile that uses this fragment: deb_hand_example.mak

Filed under: maemo,N800 — twegener @ 1:58

2 Comments »

  1. [...] much messing around I have build some .deb packages for my Exaile for Maemo port and the mutagen library (one of its [...]

    Pingback by Madabar.techblog » Preview .deb packages for Exaile for maemo — 2007-07-15 @ 23:11

  2. [...] Manually creating a .deb package for maemo Tags: none July 16, 2007, at 4:30 — links — BY-NC-SA [...]

    Pingback by Unatine :: blog : links for 2007-07-15 — 2007-07-16 @ 10:00

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress

-->