Creating a Debian package file for Maemo 5

openclipart.org, public domain

openclipart.org, public domain

A friend of mine asked for a package of MoNav for the Nokia N900 smart phone.

Creating a proper package requires to read a lot of documentation (yes, there is pretty good documentation) and to put together all the bits correctly. But I just wanted a very basic package, containing a binary, an icon, and a desktop shortcut file. Should be simple, eh?

Yes, it is simple. Just put the files in a directory, add a basic control file, and you’re done. Here we go:

  • Create a working dir, e.g.
    • mkdir builddebpackage
  • Make it the working dir:
    • cd builddebpackage
  • Create the base dir for the package, e.g.
    • mkdir monav-0.3
  • Make it the working dir:
    • cd monav-0.3
  • Create the folders you want to populate on the target machine:
    • mkdir -p usr/bin
    • mkdir -p usr/share/applications/hildon
    • mkdir -p usr/share/icons/hicolor/scalable/hildon
  • Copy the files to those directories:
    • cp ~/dev/monav/bin/monav usr/bin
    • cp ~/dev/monav/bin/monav.desktop usr/share/applications/hildon
    • cp ~/dev/monav/bin/monav.png /usr/share/icons/hicolor/scalable/hildon
  • Create a folder named DEBIAN:
    • mkdir DEBIAN
  • Create a control file in this directory, with the following content:
    • vi DEBIAN/control
    • Package: monav
    • Version: 0.3-1
    • Architecture: armel
    • Maintainer: ce
    • Installed-Size: 1456
    • Section: user/navigation
    • Priority: extra
    • Homepage: http://code.google.com/p/monav/
    • Description: Routing application
    • [insert one blank here]Allows to track the GPS position and provides very fast and exact route calculation.
  • Make the upper directory the working directory:
    • cd ..
  • Create the package, while ensuring there is no trailing slash at the end of the folder’s name:
    • dpkg-deb --build monav-0.3
  • Upload the resulting package to your web space:
    • scp monav-0.3.deb remotehost.yy:/htdocs/installers

I’m pretty sure there will be some stoning tomorrow, organized by some open source evangelists :) . I do not care. I just want to install three files on a smart phone. Nothing else.