×
Namespaces

Variants
Actions
(Difference between revisions)

Creating Debian packages for Maemo 5 Qt applications and showing in the application menu

From Nokia Developer Wiki
Jump to: navigation, search
marcelobarrosalmeida (Talk | contribs)
(adding a link to maemo devel guide, removing some pre tags)
lpvalente (Talk | contribs)
m (Lpvalente -)
 
(34 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{ReviewerApproved}}
+
[[Category:Maemo]][[Category:Qt]][[Category:Code Examples]][[Category:MeeGo Harmattan]][[Category:Symbian]]
 +
{{Archived|timestamp=20130223192105|user=[[User:Lpvalente|Lpvalente]]}}
  
[[Category:Maemo]][[Category:Qt]][[Category:How To]]
 
  
== Introduction ==
+
{{Abstract|This article shows how to build a '''.deb''' package for a [[:Category:Qt|Qt]] application on Maemo.  Note that the Qt SDK produces Debian package for you, so this is not mandatory to read and follow this article.}} The other problem that this article will address is how to put the Qt application at  '''Menu of Maemo Device'''. The proposed strategy does not use dh_make to create the basic debian package structure, as described in [[Qt for Maemo Developers Guide]].
  
In this article, I will present how to build a '''.deb''' package . This is a usual implementation, but the difference is the '''[[Qt]] for [[Maemo]]''' application. The other problem that this article will address is how  to put the Qt application at  '''Menu of Maemo Device'''. The proposed strategy does not use dh_make to create the basic debian package structure, as described in [[Qt_for_Maemo_Developers_Guide]].
+
{{ArticleMetaData <!-- v1.2 -->
 +
|sourcecode= [[Media:Sample-0.0.1.zip]]
 +
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 +
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
 +
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 +
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20090925
 +
|author= [[User:Flaviofabricioferreira]]
 +
}}
  
[[File:Postdeb1.png|500x300px]]
+
[[File:helloworldmaemo5qt 4.png|500x300px]]
  
=== .Deb Packages In Brief ===
+
===Debian Packages In Brief===
  
'''Deb''' is the extension of the Debian software package format and the most often used name for such binary packages. Like the '''Deb''' part of the term Debian. '''Debian''' packages are used in distributions based on '''Debian''', such as '''Ubuntu''' and others.
+
'''.deb''' is the extension of the Debian software package format and the most often used name for such binary packages. Like the '''Deb''' part of the term Debian. '''Debian''' packages are used in distributions based on '''Debian''', such as '''Ubuntu''' and others.
  
 
=== Prerequisites ===
 
=== Prerequisites ===
  
You need to have '''libqt4-dev''' ,'''ScratchBox''' and '''Maemo SDK'''  installed on your Computer and '''libqt4-dev''' installed on your '''Scratchbox ARM''' target and your '''Maemo Device''' . For more information on '''ScratchBox''' Installation click [http://www.scratchbox.org/ here] and for '''Qt''' on '''Maemo''' click [http://qt4.garage.maemo.org/diablo.html here].
+
You need to have '''libqt4-dev''' and '''Maemo 5 SDK'''  installed on your Computer and '''libqt4-dev''' installed on your '''Scratchbox ARM''' target. For more information on '''Maemo 5 SDK''' Installation follow [http://www.developer.nokia.com/Resources/Tools_and_downloads/Other/Maemo/ the link].
  
== Creating the Application ==
+
===Creating the Application===
  
[[File:Postdeb0.png|500x300px]]
+
[[File:helloworldmaemo5qt 1.png|500x300px]]
  
 
You need to create a simple '''Qt HelloWorld'''  Project on computer. I created a project with two labels how is showed below. Remember of to set the size of QWidget to 720 of Width and 420 of Height because the resolution of Maemo Device.
 
You need to create a simple '''Qt HelloWorld'''  Project on computer. I created a project with two labels how is showed below. Remember of to set the size of QWidget to 720 of Width and 420 of Height because the resolution of Maemo Device.
  
== Copying the Application to Scratchbox ==
+
===Copying the Application to Scratchbox===
  
First , copy the sources files of application to a folder at '''Scratchbox'''. In general the address is '''/scratchbox/users/username/home/username/'''. I do this:
+
First, copy the sources files of application to a folder at '''Scratchbox'''. In general the address is '''/scratchbox/users/username/home/username/'''. I do this:
  
  flavio@flavio-desktop:~/workspace$ cp -r HelloWorld/ /scratchbox/users/flavio/home/flavio/
+
  flavio@flavio-desktop:~/workspace$ cp -r HelloWorld/ /scratchbox/users/${USER}/home/${USER}/
  
== Compiling the Application at Scratchbox ==
+
===Compiling the Application at Scratchbox===
  
 
At Start, you need '''login''' at '''Scratchbox''':
 
At Start, you need '''login''' at '''Scratchbox''':
Line 35: Line 56:
 
  ~$ /scratchbox/login
 
  ~$ /scratchbox/login
  
If necessary select the '''ARM''' target using '''sb-menu''' . To compile do this :
+
If necessary select the '''ARM''' target using '''sb-conf se FREMANTLE_ARMEL''' . To compile do this :
  
  [sbox-DIABLO_ARMEL: ~] > cd HelloWorld
+
  [sbox-FREMANTLE_ARMEL: ~] > cd HelloWorld
  [sbox-DIABLO_ARMEL: ~/HelloWorld] > qmake
+
  [sbox-FREMANTLE_ARMEL: ~/HelloWorld] > qmake
  [sbox-DIABLO_ARMEL: ~/HelloWorld] > make
+
  [sbox-FREMANTLE_ARMEL: ~/HelloWorld] > make
  
== Creating the Tree of Debian Package==
+
===Creating the Debian Source Package===
  
After that , you need to create the following folders:
+
The method of creation Debian packages is described in an external article [http://wiki.maemo.org/Packaging_a_Qt_application Packaging a Qt application]. Maemo is derivative of Debian Linux distribution,
 +
thus, should you have a question, feel free to consult Debian documentation [http://www.debian.org/doc/manuals/maint-guide/ Debian New Maintainer's Guide].
  
[sbox-DIABLO_ARMEL: ~/HelloWorld] cd ..
+
Sample source Debian package containing a very simple Qt application [[File:Sample-0.0.1.zip]].
[sbox-DIABLO_ARMEL: ~] > mkdir HelloWorldApplication
+
[sbox-DIABLO_ARMEL: ~] > mkdir HelloWorldApplication/DEBIAN
+
  
You'll need to create a control file for your package using a simple text edit. In this post I use the '''Vi'''.
+
===Building the Debian Package===
  
[sbox-DIABLO_ARMEL: ~] > vi  HelloWorldApplication/DEBIAN/control
+
To build both source and binary packages with checking build dependencies use the following command
 +
<code>
 +
[sbox-FREMANTLE_ARMEL: ~/HelloWorld] > dpkg-buildpackage -i -rfakeroot -D
 +
</code>
 +
Append "-nc -b" keys to avoid cleaning the source tree. This will speed up building a binary package. This is relevant for huge packages like Qt libraries, which are being built for several hours.
  
In this step we'll look at what each field in the control file means and what kind of information you need to provide.
+
===Sending the Debian Package to Maemo Device===
The syntax for the control fields is very simple: the name of the field, followed by a colon, and then the body or value of the field.
+
  
Package: HelloWorld
+
I used the '''scp''' command with the '''IP''' address of device. The '''IP''' address of device is searched at '''Settings->Connection Manager''' , after that, click at Connection Manager at '''left-Up-Corner->internet connection->IP address'''.
Priority: optional
+
Version: 1.0
+
Architecture: all
+
Maintainer: Flavio Fabricio <flaviofabricio@gmail.com>
+
Depends: libqt4-dev
+
Description: This is a HelloWorld Application
+
  
Returns to '''HelloWorld''' Application directory and create the folders below:
+
[sbox-FREMANTLE_ARMEL: ~/HelloWorld] > scp hello-world-application.deb root@10.0.0.13:/home/user/
  
[sbox-DIABLO_ARMEL: ~] > cd  HelloWorldApplication/
+
===Installing the Debian Package at Maemo Device===
[sbox-DIABLO_ARMEL: ~/HelloWorldApplication] > mkdir usr
+
  
Creating the /usr subdirectories:
+
[sbox-FREMANTLE_ARMEL: ~/HelloWorld] > ssh root@10.0.0.13 dpkg -i /home/user/hello-world-application.deb
  
[sbox-DIABLO_ARMEL: ~/HelloWorldApplication] > cd usr/
+
Now, the application is installed at '''Maemo''' Device.
[sbox-DIABLO_ARMEL: ~/HelloWorldApplication/usr] > mkdir bin
+
[sbox-DIABLO_ARMEL: ~/HelloWorldApplication/usr] > mkdir lib
+
[sbox-DIABLO_ARMEL: ~/HelloWorldApplication/usr] > mkdir share
+
  
Creating the /share subdirectories:
+
You will need to click at '''More... Menu''' and you will can see the '''HelloWorld''' Application with a icon of N900 :
  
[sbox-DIABLO_ARMEL: ~/HelloWorldApplication/usr] > cd share/
+
<gallery>
[sbox-DIABLO_ARMEL: ~/HelloWorldApplication/usr/share] > mkdir applications
+
image:helloworldmaemo5qt_2.png
[sbox-DIABLO_ARMEL: ~/HelloWorldApplication/usr/share] > mkdir pixmaps
+
image:helloworldmaemo5qt_3.png
 
+
image:helloworldmaemo5qt_4.png
Creating the '''hildon''' subdirectory that is the folder where is the '''.desktop''' files :
+
</gallery>
 
+
[sbox-DIABLO_ARMEL: ~/HelloWorldApplication/usr/share] > cd applications
+
[sbox-DIABLO_ARMEL: ~/HelloWorldApplication/usr/share/applications] > mkdir hildon
+
 
+
==Creating the file thats put the Application on Maemo Menu==
+
 
+
You'll need to create too, a .desktop file that the '''Maemo''' uses to put application at Menu.
+
 
+
[sbox-DIABLO_ARMEL: cd /HelloWorldApplication/usr/share/applications/hildon
+
[sbox-DIABLO_ARMEL: ~/HelloWorldApplication/usr/share/applications/hildon]>vi helloworld.desktop
+
 
+
Here we'll to add the address of executable file , image icon file , etc...
+
 
+
[Desktop Entry]
+
Categories=Qt;
+
Encoding=UTF-8
+
Version=0.1
+
Type=Application
+
Name=Qt HelloWorld
+
Exec=/usr/bin/HelloWorld
+
Icon=helloworld
+
 
+
== Copying the Application Compiled  to Deb Tree ==
+
 
+
[sbox-DIABLO_ARMEL: ~] > cd HelloWorld
+
[sbox-DIABLO_ARMEL: ~/HelloWorld] > ls
+
HelloWorld    helloworld.cpp  main.cpp      helloworld.png
+
HelloWorld.pro helloworld.h    helloworld.ui  ui_helloworld.h
+
 
+
In this step, you will to copy the executable file to /usr/bin folder. This executable is called by helloworld.desktop at line '''Exec=/usr/bin/HelloWorld''' on the file described above.
+
+
[sbox-DIABLO_ARMEL: ~/HelloWorld] > cp helloworld ../HelloWorldApplication/usr/bin/
+
 
+
Now, you will to copy the sources files to /usr/lib folder.This is recommended , but not required.
+
 
+
[sbox-DIABLO_ARMEL: ~/HelloWorld] > cp HelloWorld.pro ../HelloWorldApplication/usr/lib/
+
[sbox-DIABLO_ARMEL: ~/HelloWorld] > cp helloworld.cpp ../HelloWorldApplication/usr/lib/
+
[sbox-DIABLO_ARMEL: ~/HelloWorld] > cp helloworld.h ../HelloWorldApplication/usr/lib/
+
[sbox-DIABLO_ARMEL: ~/HelloWorld] > cp helloworld.ui ../HelloWorldApplication/usr/lib/
+
[sbox-DIABLO_ARMEL: ~/HelloWorld] > cp main.cpp ../HelloWorldApplication/usr/lib/
+
 
+
You will need a picture to use like Icon. You can search some image at the [http://images.google.com/ Google Images].In this case I renamed the picture to '''helloworld.png'''.This image is called by '''helloworld.desktop''' at line '''Icon=helloworld''' on the file described above and save to '''/usr/share/pixmaps/''' folder.
+
 
+
[sbox-DIABLO_ARMEL: ~/HelloWorld] > cp helloworld.png ../HelloWorldApplication/usr/share/pixmaps/
+
 
+
== Creating the Deb Package ==
+
 
+
[sbox-DIABLO_ARMEL: ~/HelloWorld] > cd ..
+
[sbox-DIABLO_ARMEL: ~] > dpkg-deb -b HelloWorldApplication
+
 
+
== Sending the .Deb Package to Maemo Device ==
+
 
+
I used the '''Scp''' command with the '''IP''' address of device. The '''IP''' address of device is searched at '''Settings->Connection Manager''' , after that , click at Connection Manager at '''left-Up-Corner->internet connection->IP address'''.
+
 
+
[sbox-DIABLO_ARMEL: ~/HelloWorld] > scp HelloWorldApplication.deb root@10.0.0.13:/home/
+
 
+
== Installing the Deb Package at Maemo Device==
+
 
+
Open a new terminal and do this:
+
 
+
ssh root@10.0.0.13
+
 
+
enter with the '''password''' of '''Maemo''' Device
+
 
+
root@10.0.0.13's password:
+
Nokia-N810-43-7:~# cd ..
+
Nokia-N810-43-7:/# cd /home/
+
Nokia-N810-43-7:/home# dpkg -i HelloWorldApplication.deb
+
 
+
Now, the application is installed at '''Maemo''' Device.
+
  
You will need to click at '''Extras Menu''' and you will can see the '''HelloWorld Application''':
+
===Snapshoot of HelloWorld Application===
Fine.
+
  
[[File:Postdeb2.png||500x300px]]
+
[[File:helloworldmaemo5qt 5.png||500x300px]]
 +
<!-- Translation --> [[pt:Como criar Pacotes Debian para aplicações em Qt para Maemo 5 e mostrá-la no Menu]]

Latest revision as of 22:21, 23 February 2013

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.


This article shows how to build a .deb package for a Qt application on Maemo. Note that the Qt SDK produces Debian package for you, so this is not mandatory to read and follow this article. The other problem that this article will address is how to put the Qt application at Menu of Maemo Device. The proposed strategy does not use dh_make to create the basic debian package structure, as described in Qt for Maemo Developers Guide.

Article Metadata
Code ExampleCompatibility
Platform(s):
Symbian
Article
Created: flaviofabricioferreira (25 Sep 2009)
Last edited: lpvalente (23 Feb 2013)

Helloworldmaemo5qt 4.png

Contents

[edit] Debian Packages In Brief

.deb is the extension of the Debian software package format and the most often used name for such binary packages. Like the Deb part of the term Debian. Debian packages are used in distributions based on Debian, such as Ubuntu and others.

[edit] Prerequisites

You need to have libqt4-dev and Maemo 5 SDK installed on your Computer and libqt4-dev installed on your Scratchbox ARM target. For more information on Maemo 5 SDK Installation follow the link.

[edit] Creating the Application

Helloworldmaemo5qt 1.png

You need to create a simple Qt HelloWorld Project on computer. I created a project with two labels how is showed below. Remember of to set the size of QWidget to 720 of Width and 420 of Height because the resolution of Maemo Device.

[edit] Copying the Application to Scratchbox

First, copy the sources files of application to a folder at Scratchbox. In general the address is /scratchbox/users/username/home/username/. I do this:

flavio@flavio-desktop:~/workspace$ cp -r HelloWorld/ /scratchbox/users/${USER}/home/${USER}/

[edit] Compiling the Application at Scratchbox

At Start, you need login at Scratchbox:

~$ /scratchbox/login

If necessary select the ARM target using sb-conf se FREMANTLE_ARMEL . To compile do this :

[sbox-FREMANTLE_ARMEL: ~] > cd HelloWorld
[sbox-FREMANTLE_ARMEL: ~/HelloWorld] > qmake
[sbox-FREMANTLE_ARMEL: ~/HelloWorld] > make

[edit] Creating the Debian Source Package

The method of creation Debian packages is described in an external article Packaging a Qt application. Maemo is derivative of Debian Linux distribution, thus, should you have a question, feel free to consult Debian documentation Debian New Maintainer's Guide.

Sample source Debian package containing a very simple Qt application File:Sample-0.0.1.zip.

[edit] Building the Debian Package

To build both source and binary packages with checking build dependencies use the following command

[sbox-FREMANTLE_ARMEL: ~/HelloWorld] > dpkg-buildpackage -i -rfakeroot -D

Append "-nc -b" keys to avoid cleaning the source tree. This will speed up building a binary package. This is relevant for huge packages like Qt libraries, which are being built for several hours.

[edit] Sending the Debian Package to Maemo Device

I used the scp command with the IP address of device. The IP address of device is searched at Settings->Connection Manager , after that, click at Connection Manager at left-Up-Corner->internet connection->IP address.

[sbox-FREMANTLE_ARMEL: ~/HelloWorld] > scp hello-world-application.deb root@10.0.0.13:/home/user/

[edit] Installing the Debian Package at Maemo Device

[sbox-FREMANTLE_ARMEL: ~/HelloWorld] > ssh root@10.0.0.13 dpkg -i /home/user/hello-world-application.deb

Now, the application is installed at Maemo Device.

You will need to click at More... Menu and you will can see the HelloWorld Application with a icon of N900 :

[edit] Snapshoot of HelloWorld Application

Helloworldmaemo5qt 5.png

This page was last modified on 23 February 2013, at 22:21.
170 page views in the last 30 days.