×
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
flaviofabricioferreira (Talk | contribs)
flaviofabricioferreira (Talk | contribs)
Line 4: Line 4:
 
[[Category:Maemo]][[Category:Qt]][[Category:Qt for Maemo]][[Category:How To]]
 
[[Category:Maemo]][[Category:Qt]][[Category:Qt for Maemo]][[Category:How To]]
  
== Introduction ==
+
===Introduction===
  
 
In this article, I will present how to build a '''.deb''' package . This is a usual implementation, but the difference is the '''[[::Category:Qt for Maemo|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|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 '''[[::Category:Qt for Maemo|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|Qt for Maemo Developers Guide]].
Line 10: Line 10:
 
[[File:helloworldmaemo5qt_4.png|500x300px]]
 
[[File:helloworldmaemo5qt_4.png|500x300px]]
  
=== .Deb Packages In Brief ===
+
===.Deb 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.
Line 18: Line 18:
 
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''' ,'''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].
  
== Creating the Application ==
+
===Creating the Application===
  
 
[[File:helloworldmaemo5qt_1.png|500x300px]]
 
[[File:helloworldmaemo5qt_1.png|500x300px]]
Line 24: Line 24:
 
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:
Line 30: Line 30:
 
  flavio@flavio-desktop:~/workspace$ cp -r  HelloWorld/ /scratchbox/users/flavio/home/flavio/
 
  flavio@flavio-desktop:~/workspace$ cp -r  HelloWorld/ /scratchbox/users/flavio/home/flavio/
  
== 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 42: Line 42:
 
  [sbox-FREMANTLE_ARMEL: ~/HelloWorld] > make
 
  [sbox-FREMANTLE_ARMEL: ~/HelloWorld] > make
  
== Creating the Tree of Debian Package==
+
===Creating the Tree of Debian Package===
  
 
After that , you need to create the following folders:
 
After that , you need to create the following folders:
Line 88: Line 88:
 
  [sbox-FREMANTLE_ARMEL: ~/HelloWorldApplication/usr/share/applications] > mkdir hildon
 
  [sbox-FREMANTLE_ARMEL: ~/HelloWorldApplication/usr/share/applications] > mkdir hildon
  
==Creating the file thats put the Application on Maemo Menu==
+
===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.  
 
You'll need to create too, a .desktop file that the '''Maemo''' uses to put application at Menu.  
Line 106: Line 106:
 
  Icon=helloworld
 
  Icon=helloworld
  
== Copying the Application Compiled  to Deb Tree ==
+
===Copying the Application Compiled  to Deb Tree===
  
 
  [sbox-FREMANTLE_ARMEL: ~] > cd HelloWorld
 
  [sbox-FREMANTLE_ARMEL: ~] > cd HelloWorld
Line 129: Line 129:
 
  [sbox-FREMANTLE_ARMEL: ~/HelloWorld] > cp helloworld.png ../HelloWorldApplication/usr/share/pixmaps/
 
  [sbox-FREMANTLE_ARMEL: ~/HelloWorld] > cp helloworld.png ../HelloWorldApplication/usr/share/pixmaps/
  
== Creating the Deb Package ==
+
===Creating the Deb Package===
  
 
  [sbox-FREMANTLE_ARMEL: ~/HelloWorld] > cd ..
 
  [sbox-FREMANTLE_ARMEL: ~/HelloWorld] > cd ..
 
  [sbox-FREMANTLE_ARMEL: ~] > dpkg-deb -b HelloWorldApplication
 
  [sbox-FREMANTLE_ARMEL: ~] > dpkg-deb -b HelloWorldApplication
  
== Sending the .Deb Package to Maemo Device ==
+
===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'''.
 
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'''.
Line 140: Line 140:
 
  [sbox-FREMANTLE_ARMEL: ~/HelloWorld] > scp HelloWorldApplication.deb root@10.0.0.13:/home/
 
  [sbox-FREMANTLE_ARMEL: ~/HelloWorld] > scp HelloWorldApplication.deb root@10.0.0.13:/home/
  
== Installing the Deb Package at Maemo Device==
+
===Installing the Deb Package at Maemo Device===
  
 
Open a new terminal and do this:
 
Open a new terminal and do this:
Line 149: Line 149:
  
 
  root@10.0.0.13's password:
 
  root@10.0.0.13's password:
  Nokia-N810-43-7:~# cd ..
+
  Nokia-N900-43-7:~# cd ..
  Nokia-N810-43-7:/# cd /home/
+
  Nokia-N900-43-7:/# cd /home/
  Nokia-N810-43-7:/home# dpkg -i HelloWorldApplication.deb
+
  Nokia-N900-43-7:/home# dpkg -i HelloWorldApplication.deb
  
 
Now, the application is installed at '''Maemo''' Device.  
 
Now, the application is installed at '''Maemo''' Device.  
  
You will need to click at '''Extras Menu''' and you will can see the '''HelloWorld Application''':
+
You will need to click at '''More... Menu''' and you will can see the '''HelloWorld''' Application with a icon of N900 :
 
Fine.  
 
Fine.  
 +
 +
<gallery>
 +
image:helloworldmaemo5qt_2.png
 +
image:helloworldmaemo5qt_3.png
 +
image:helloworldmaemo5qt_4.png
 +
</gallery>
 +
 +
The snapshoot of application is showed below:
  
 
[[File:helloworldmaemo5qt_5.png||500x300px]]
 
[[File:helloworldmaemo5qt_5.png||500x300px]]
  
 
This post is avaiable too at [http://efforts.embedded.ufcg.edu.br/qt/ QtEfforts ] of the [http://efforts.embedded.ufcg.edu.br Efforts Projects] in the [http://embedded.ufcg.edu.br/indexen.html Embedded Systems and Pervasive Computing Laboratory].
 
This post is avaiable too at [http://efforts.embedded.ufcg.edu.br/qt/ QtEfforts ] of the [http://efforts.embedded.ufcg.edu.br Efforts Projects] in the [http://embedded.ufcg.edu.br/indexen.html Embedded Systems and Pervasive Computing Laboratory].

Revision as of 02:34, 16 November 2009

Featured Article
{{{width}}}

Contents

Introduction

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.

Helloworldmaemo5qt 4.png

.Deb 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.

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 here and for Qt on Maemo click here.

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.

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/flavio/home/flavio/

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

Creating the Tree of Debian Package

After that , you need to create the following folders:

[sbox-FREMANTLE_ARMEL: ~/HelloWorld] cd ..
[sbox-FREMANTLE_ARMEL: ~] > mkdir HelloWorldApplication
[sbox-FREMANTLE_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.

[sbox-FREMANTLE_ARMEL: ~] > vi  HelloWorldApplication/DEBIAN/control

In this step we'll look at what each field in the control file means and what kind of information you need to provide. 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
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: ~] > cd  HelloWorldApplication/
[sbox-FREMANTLE_ARMEL: ~/HelloWorldApplication] > mkdir usr

Creating the /usr subdirectories:

[sbox-FREMANTLE_ARMEL: ~/HelloWorldApplication] > cd usr/
[sbox-FREMANTLE_ARMEL: ~/HelloWorldApplication/usr] > mkdir bin
[sbox-FREMANTLE_ARMEL: ~/HelloWorldApplication/usr] > mkdir lib
[sbox-FREMANTLE_ARMEL: ~/HelloWorldApplication/usr] > mkdir share

Creating the /share subdirectories:

[sbox-FREMANTLE_ARMEL: ~/HelloWorldApplication/usr] > cd share/
[sbox-FREMANTLE_ARMEL: ~/HelloWorldApplication/usr/share] > mkdir applications
[sbox-FREMANTLE_ARMEL: ~/HelloWorldApplication/usr/share] > mkdir pixmaps

Creating the hildon subdirectory that is the folder where is the .desktop files :

[sbox-FREMANTLE_ARMEL: ~/HelloWorldApplication/usr/share] > cd applications
[sbox-FREMANTLE_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-FREMANTLE_ARMEL: cd /HelloWorldApplication/usr/share/applications/hildon
[sbox-FREMANTLE_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=HelloWorld
Exec=/usr/bin/HelloWorld
Icon=helloworld

Copying the Application Compiled to Deb Tree

[sbox-FREMANTLE_ARMEL: ~] > cd HelloWorld
[sbox-FREMANTLE_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-FREMANTLE_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-FREMANTLE_ARMEL: ~/HelloWorld] > cp HelloWorld.pro ../HelloWorldApplication/usr/lib/
[sbox-FREMANTLE_ARMEL: ~/HelloWorld] > cp helloworld.cpp ../HelloWorldApplication/usr/lib/
[sbox-FREMANTLE_ARMEL: ~/HelloWorld] > cp helloworld.h ../HelloWorldApplication/usr/lib/
[sbox-FREMANTLE_ARMEL: ~/HelloWorld] > cp helloworld.ui ../HelloWorldApplication/usr/lib/
[sbox-FREMANTLE_ARMEL: ~/HelloWorld] > cp main.cpp ../HelloWorldApplication/usr/lib/

You will need a picture to use like Icon. You can search some image at the 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-FREMANTLE_ARMEL: ~/HelloWorld] > cp helloworld.png ../HelloWorldApplication/usr/share/pixmaps/

Creating the Deb Package

[sbox-FREMANTLE_ARMEL: ~/HelloWorld] > cd ..
[sbox-FREMANTLE_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-FREMANTLE_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-N900-43-7:~# cd ..
Nokia-N900-43-7:/# cd /home/
Nokia-N900-43-7:/home# dpkg -i HelloWorldApplication.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 : Fine.

The snapshoot of application is showed below:

Helloworldmaemo5qt 5.png

This post is avaiable too at QtEfforts of the Efforts Projects in the Embedded Systems and Pervasive Computing Laboratory.

242 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×