Packaging a Qt Application

    This article applies to Ubuntu 8.04/10.04. I referred to the instruction here: http://ubuntuforums.org/showthread.php?t=51003. And I’ll use my qastrologer project to demo the building procedure.

1. Install build tool packages:

2. Get the source package, exact it into ~/packages/qastrologer. The directory structure should like: ~/packages/qastrologer/qastrologer-<version>/<source>. The <source> directory contains your *.pro file.

3. Add install section in *.pro file. Otherwise, the built package contains not binary:

I referred to the guild here: http://wiki.maemo.org/Packaging_a_Qt_application. For more information on how to use the INSTALLS macro, refer to the Qt document: http://doc.trolltech.com/4.7/qmake-environment-reference.html#installs

4. Run dh_make. This will create the basic debian package structure.

We are generating a single binary package and licensed with GPL. After running the command, a “debian” subdirectory is created. Now we need to fill in more useful infomations.

5. “rules” file:

It is the most important build script. The cdbs already have support for building QMake projects. Our “rules” file is simple:

Last line ensures we use Qt4. I referred to the source of minitube project. You can access it via:

6. “control” file:

This file controls build and binary dependency. For my qastrologer, the default values are enough. You may want to have some minor changes in “Section”/”Priority”/”Maintainer” values. Since I want to keep my package installs from 8.04 to 10.04 and above, I must specify the minimum dependencies manually to use Qt 4.3. So my “control” file looks like:

Note, the default “control” file uses “${shlibs:Depends}” and “${misc:Depends}” macros to generate binary dependencies automatically. Refer to the man page of debhelper to get more information.

7. Fill in “changelog” and “copyright” files.

8. Build the package:

For full build of the package (build source, deb, clean…) run:

Instead if you have a big package, you can also build only the deb file with:

Leave a Reply

Your email address will not be published. Required fields are marked *