Editing Packaging a Qt application

Warning: You are not logged in. Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
-
{{main|Packaging}}
+
= Packaging a Qt Application =
-
 
+
== Looking for a debian package of your Application ==
-
Packaging a Qt application for Maemo is very similar to packaging any other application, so this document only contains information on Qt-specific packaging issues.
+
If you want to port  a popular Qt application probably it is already packaged for debian.
-
 
+
You can try to get the package source in a couple of different ways:
-
== Creating a Maemo package from a qmake project ==
+
* Adding a debian src repository in your /etc/apt/source.list file
-
 
+
<pre>
-
In order to create a new package for Maemo, from a qmake project, you will need to:
+
$echo “deb http://ftp.it.debian.org/debian/ unstable main contrib non-free” >> /etc/apt/source.list
-
* Rename the source directory to <code>Package-Version</code> (for example myapp-0.1 for an application ‘myapp’ with a version of ‘0.1’)
+
$apt-get update
-
* Create a ‘src’ directory in <code>Package-Version/</code>
+
$apt-cache search app_name
-
* Copy all the files to the <code>src/</code> directory
+
$apt-get source app_name
-
* Rename <code>src/appname.pro</code> to <code>src/src.pro</code>
+
</pre>
-
Please make sure that the directory name is <package-version> format and in small case letters.
+
* Checking http://packages.debian.org, downloading the following files and running ''dpkg-source -x app_name.dsc'' to decompress the upstream source and to apply the changes available in the diff.gz file.
 +
** upstream source file (.tar.gz)
 +
** package changes    (.diff.gz)
 +
** meta-data information file (.dsc)
 +
== Creating a Debian package for a new Qt Application ==
 +
If your application has been already packaged, you can jump this section.
 +
If your application is quite younger and you need to package it by yourself,
 +
in order to creating a new package, you need to:
 +
* Rename the upstream source directory in Package-Version (eg: myapp-0.1)
 +
* Create “src” directory in Package-Version/
 +
* Copy all the files in the src/
 +
* Rename src/appname.pro in src/src.pro
<pre>
<pre>
$mv myapp myapp-0.1
$mv myapp myapp-0.1
Line 19: Line 30:
$mv src/appname.pro src/src.pro
$mv src/appname.pro src/src.pro
</pre>
</pre>
-
 
+
*Create a myapp-0.1/myapp.pro file like this:
-
Append the following chunk to end of your <code>src/src.pro</code>. The chunk adds an install section to your qmakefile 
+
-
 
+
-
<pre>
+
-
unix {
+
-
  #VARIABLES
+
-
  isEmpty(PREFIX) {
+
-
    PREFIX = /usr
+
-
  }
+
-
  BINDIR = $$PREFIX/bin
+
-
  DATADIR =$$PREFIX/share
+
-
 
+
-
  DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\"
+
-
 
+
-
  #MAKE INSTALL
+
-
 
+
-
  INSTALLS += target desktop service iconxpm icon26 icon48 icon64
+
-
 
+
-
  target.path =$$BINDIR
+
-
 
+
-
  desktop.path = $$DATADIR/applications/hildon
+
-
  desktop.files += $${TARGET}.desktop
+
-
 
+
-
  service.path = $$DATADIR/dbus-1/services
+
-
  service.files += $${TARGET}.service
+
-
 
+
-
  icon64.path = $$DATADIR/icons/hicolor/64x64/apps
+
-
  icon64.files += ../data/64x64/$${TARGET}.png
+
-
}
+
-
</pre>
+
-
 
+
-
 
+
-
*Create a <code>myapp-0.1/myapp.pro</code> file like this:
+
<pre>
<pre>
QMAKEVERSION = $$[QMAKE_VERSION]
QMAKEVERSION = $$[QMAKE_VERSION]
Line 67: Line 46:
**Some example files (*.EX *.ex)
**Some example files (*.EX *.ex)
<pre>
<pre>
-
export DEBFULLNAME="maintainer first name and last name"
 
dh_make --createorig --single -e maintainer@email.org -c gpl
dh_make --createorig --single -e maintainer@email.org -c gpl
</pre>
</pre>
 +
 +
== Having a look inside the debian/ dir ==
 +
At this point the directory my-app contains
 +
* the source directory ( src/ )
 +
* the debian directory (debian/)
 +
 +
Inside the debian dir we have the files need for the creation of the debian package
 +
* Changelog  - Application's change log
 +
* Compat  - Debian helper compatibly version
 +
* Control - Describes the packages to be made
 +
* Copyright - Copyright text
 +
* Rules - A makefile containing the rules to build all kinds of packages
 +
 +
== Maemo Packaging Policy ==
 +
Maemo packages follow the Debian Policy, but there are some items where Maemo:
 +
* Is more strict (it is an embedded distribution)
 +
* Is more relaxed
 +
**Only a target device (Nokia Internet Tablet)
 +
**Only a specified UI (Hildon)
 +
**Only one user.
 +
*Differs from Debian because Maemo has different:
 +
**Objectives
 +
**Maintainers
 +
**Infrastructure
== Editing the rules file ==
== Editing the rules file ==
-
The rules file generated by <code>dh_make</code>, found in <code>debian/rules</code> will be modified in order to look like this one. We are using qmake, so there is no <code>configure</code> script to run. If you copy and paste the following file, notice the empty space at the beginning of the lines these are TAB characters, they are not multiple space characters. If you copy and paste the following chunk, you most propably get space's instead of tabs if this is true then the file will not work.
+
The rules file generated by dh_make will be modified in order to look like this one.
 +
We are using qmake, so we haven't a configure file to run.  
<pre>
<pre>
Line 118: Line 121:
         dh_installman
         dh_installman
         dh_link
         dh_link
-
         dh_strip --dbg-package=my-application-dbg
+
         dh_strip
         dh_compress
         dh_compress
         dh_fixperms
         dh_fixperms
Line 131: Line 134:
</pre>
</pre>
-
== Editing the control file ==
+
==Editing the Control file ==
-
The control file generated by <code>dh_make</code>, found in <code>debian/control</code> will be modified substantially. Please refer to the general packaging guide for Maemo for details.
+
Basically it specifies for each package (source or binary) a name, some dependencies, a description etc...
 +
For a Maemo package these fields are very important:
 +
* Section: Only the packages in the user segment are showed by App Installer.
 +
* Maintainer: This field MUST be changed if the upstream package is modified
 +
* XB-Maemo-Icon26: It contains the PNG icon encoded in base64 visible in the Application Installer
-
For Qt applications you need to make sure to add <code>libqt4-dev</code> as an additional entry in the field <code>Build-Depends</code>.
+
<pre>
 +
Source: my-application
 +
Section: user/valid_subsection
 +
Priority: optional
 +
Maintainer: name surname <xxxxxxx.xxxxxx@maemo.org>
 +
XSBC-Original-Maintainer: name surname <yyyyy.yyyyy@debian.org>
 +
Build-Depends: debhelper (>= 5), libqt4-dev, OTHERS_BUILD DEPENDECIES
 +
Standards-Version: 3.7.3
-
== Example ==
+
Package: my-application
-
You can download the [http://maemo.org/packages/view/qt-maemo-example/ source package of qt-maemo-example] from the [[extras-devel]] repository as follows, if you have source packages enabled in your <code>/etc/apt/sources.list</code> file:
+
Architecture: any
 +
Depends: ${shlibs:Depends}, ${misc:Depends}
 +
Description: A simple test application
 +
A very simple application with a short description.
 +
Which spans multiple lines actually.
 +
XB-Maemo-Icon-26:
 +
iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAABmJLR0QA/wD/AP+g
 +
vaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1gURDQoYya0JlwAAAU9J
 +
REFUSMftlL1KA0EUhb/NZl/ggnHQxsJUxt5CUucVJCCkDfgyKdIGG5/A0s5HEBtJ
 +
EdDAQGBgmw0YJmMzgXXYza5CtNkDW9zZw5z7c+ZCgwb/Ai3i9sVl/Bq8RIs4LRK1
 +
gJDsKvJyNXmJMuYTsMoY1zpgozaABdYArQNPZQ1kfyGU7SpqVwxzAMwABWhgpIwp
 +
4vWBB+AUWAI3ypjnfEXtPU4bLKx9vErTeCeiRSYF+fTn1j5dp2myE9EiU+DSi3wX
 +
ymeqRQAmZ3EcA5E/fgO6BULT8zhOcrwXoJdrXRa2Lgps2y2odAUcBUIXQdz78YyC
 +
SldAp8b7+bXrIv91qjZBietqCc2DjbAt4b2WxJkyZljVujlwp0U0cPxuLcAIuC+4
 +
dKxFlsDJarvdAGP/b6hFnDImYs+uG3hbO2AB3Jbsur63tQM+fFx3bzZocEB8AdV2
 +
gJBZgKTwAAAAAElFTkSuQmCC
 +
</pre>
-
apt-get source qt-maemo-example
+
Valid subsections are:
 +
* Accessories
 +
* Comunications
 +
* Games
 +
* Multimedia
 +
* Office
 +
* Other
 +
* Programming
 +
* Support
 +
* Themes
 +
* Tools
-
This command will download the:
+
== Editing the Changelog file ==
 +
It is the log of the changes for a specified application version. It's important file because it sets the binary/binaries and the source packages version and revision.
 +
If an upstream package is re-packaged or modified for maemo, the Maemo revision string should be appended to the upstream revision.
 +
So if in Debian the package name was something like "Myapp-0.4-2" in maemo this package will be called "Myapp-0.4-2maemo0".
 +
The number after the "maemo" string is a progressive number.
-
* unmodified source (.orig.tar.gz)
+
==  Application menu icon & position ==
-
* debian dsc file (.dsc)
+
The Maemo application menu detects automatically an app that provides a .desktop file in /usr/share/application/hildon
-
* diff file (.diff)
+
Maemo menu structure is completely different from Debian:
 +
* An unmodified Debian package installs the proper .desktop in /usr/share/applications
 +
* Applications that use the debian menu are displayed in the extra menu
-
and will then automatically launch <code>dpkg -x file.dsc</code> in order to decompress the orig.tar.gz and apply the changes.
+
In order to show our application in the correct Maemo menu:
 +
* debian/myapp.install moves the .desktop file and icons in the right directory
 +
<pre>
 +
src/*.desktop usr/share/applications/hildon
 +
src/*.png usr/share/icons/hicolor/26x26/apps
 +
</pre>
 +
 
 +
* debian/postinst should call  maemo-select-menu-location utility to permit the user to choose the menu location.  
 +
<pre>
 +
#!/bin/bash
 +
maemo-select-menu-location myapp.desktop
 +
</pre>
-
== Useful Links ==
+
= Useful Links =
 +
[http://qt4.garage.maemo.org Qt4Maemo at garage]
-
* [[Packaging Qt Creator Apps for Maemo Extras]]
+
[http://doc.trolltech.com/4.4/index.html Official Qt 4.4 Documentation]  
-
* [[Qt-Maemo|Qt for Maemo]]
+
-
* [[Packaging|Packaging guide for Maemo]]
+
-
* [http://doc.qt.nokia.com/qt-maemo-4.6/maemo5-with-qt-introduction.html#deploying-your-applications Deploying your Maemo 5 Qt application] Qt documentation
+
-
[[Category:Packaging]]
+
[[Category:Development]]
-
[[Category:Qt]]
+

Learn more about Contributing to the wiki.


Please note that all contributions to maemo.org wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see maemo.org wiki:Copyrights for details). Do not submit copyrighted work without permission!


Cancel | Editing help (opens in new window)

Templates used on this page: