User:Mohammad7410/Packaging

Packaging is the simplest, yet not exactly clearly documented well part of software development. This tutorial should hopefully cover everything you need to start making simple, working packages for Maemo.

This tutorial assumes you're running on Linux (or a virtual machine of one) and that you have Scratchbox installed as per http://wiki.maemo.org/Documentation/Maemo5_Final_Installation

Qt Creator users

A project made with QtCreator usually creates two (or more) folders, one contains a clean source, and the other contains an architecture specific build, for the purpose of this tutorial, we will not be using Qt Creator's package builder (as imo, it's crap compared to the manual one).

Copy the files in the clean source directory to somewhere in your scratchbox $home directory (or just copy the whole folder into ~ on scratchbox) and follow the steps below.

Scratchbox users

Packaging an application involves two things, getting the source itself, and making the debian/ directory and writing its contents. The debian/ directory is needed to make .deb packages, everything related to the package (i.e. .deb file) is there, with the sources outside it, the sources and the debian/ directory should be in one main directory, which is the source directory for the package.

Example hierarchy (Package name is maemodeb):

maemodeb/ (main source dir, a version number can be appended (e.g maemodeb-0.1)
  src/ (usually contains sources, sources can also be put in the main dir without a subfolder)
  data/ (usually contains data, i.e icons/images)
  debian/ (contains the files needed to build the package)

The debian directory should contain at least this basic set of files, without them, a package cannot be built:

A control file, this holds information such as name of package(s - multiple packages can be built from one source), description, maintainer name, section, packages needed to build the source, and the dependencies, and (for Maemo), icons for the application manager and "pretty" names, also for the application manager.

A changelog file, this holds again, the name of the source (not the separate packages), the version number, the changes in that version number, and a signature with the name and email for the person who edited the old source, as well as a timestamp, this file can be auto-generated with dch.

A compat file, which contains the version of debhelper needed, only a number is held in this file, usually 5.

A rules file, which contains the build instructions.

What should these files contain? These files can be generated using dh_make, however, I find cleaning the examples it generates a bit tedious, so I copy the files from my own sample debian/ folder.

control file:

Source: source_name
Section: section_goes_here, possible sections listed here http://wiki.maemo.org/Packaging#Sections
Priority: extra
Maintainer: Your_FULL_REAL_name <email_must_NOT_be_fake>
Build-Depends: debhelper (>= 5) # deps needed to build the package (e.g libqt4-dev for 
Standards-Version: 3.7.2

Package: first_package_name
XB-Maemo-Display-Name: Name to be displayed in HAM
Architecture: architecture, can be all/i386/armel
Depends: dependencies for the package
Description: short description here
 hildon-theme-alpha's boxes have a black border around theme, this package fixes the size 70 one.
Source: maemodeb
Section: user/system
Priority: extra
Maintainer: Mohammad Abu-Garbeyyeh <mohammad7410@gmail.com>
Build-Depends: debhelper (>= 5)
Standards-Version: 3.7.2

Package: maemodeb
XB-Maemo-Display-Name: Maemo Deb
Architecture: all
Depends: apt, ${shlibs:Depends}
Description: Sample package to show how packaging works
 Long description of the application to be shown if a user clicks Description in HAM