How to integrate Intel AppUp™ SDK and create RPM package for MeeGo* applications

In this article I will show you how to prepare your MeeGo* app to be validated in the Intel AppUpSM Center. This article is based on the project from my another article Modern mobile applications with Qt* and QML. No changes will be made in the project source code. Thanks to Qt*, our Windows* application can be launched on MeeGo* without any changes in code. All you need is just to recompile it.

Integrating AppUp™ SDK

Launch Qt Creator* installed with MeeGo* SDK. If you don't have MeeGo* SDK installed, here is a link. On this page you can find everything you need to start developing MeeGo* apps. Open project, open project file (4Toddler.pro) and add following lines:

# Add path to Intel AppUp™ SDK headers directory INCLUDEPATH +=    "$$(IADP_SDK_DIR_MEEGO)Cpp/include" # Add required libraries LIBS +=    -lxml2 -lpthread LIBS +=    "$$(IADP_SDK_DIR_MEEGO)Cpp/lib/libadpruntime.a" \     "$$(IADP_SDK_DIR_MEEGO)Cpp/lib/libadpcore.a" \     "$$(IADP_SDK_DIR_MEEGO)Cpp/lib/libxerces-c.a" \     "$$(IADP_SDK_DIR_MEEGO)Cpp/lib/libxml-security-c.a" \     "$$(IADP_SDK_DIR_MEEGO)Cpp/lib/libcrypto.a"


Next open main.cpp file. Include header file from the Intel AppUp™ SDK:

#include "adpcppf.h"


And new function:

bool IsAuthorized() { #ifdef QT_DEBUG     // Do not check authorization for debug version     return true; #endif     bool authorized = false;     QString message;     com::intel::adp::Application *pApp = NULL;     try     {         pApp = new Application(ADP_DEBUG_APPLICATIONID);         // Authorized successfully         authorized = true;     }     catch (com::intel::adp::AdpException& e)     {         // Got some error         message = QString::fromAscii(e.message());     }     if(pApp != NULL)     {         delete pApp;     }     if(authorized == false)     {         QMessageBox msgBox(QMessageBox::Information, "4 Toddler", message, QMessageBox::Ok);         msgBox.exec();     }     return authorized; }


Call this function from your main()

if(IsAuthorized() == false) {     // Quit application     a.quit();     return 0; }

 

Creating RPM package


To install and run the application on MeeGo* we need to create an RPM package. RPM is something like an archive with binaries, icons, libraries, application info inside it. You can find a lot of info about RPM at www.rpm.org.

The Intel AppUpSM Developer Program has some requirements for RPMs described here MeeGo* Packaging and Compliance Guidelines.

First we need to create additional icons in PNG file format in sizes: 16x16, 32x32, 64x64, and 128x128.

Next we need to create a .desktop file for our application. This file contains some info for the OS about our application category, icon, binary file path. Create a new file with name 4Toddler.desktop.

[Desktop Entry] Name=4 Toddler GenericName=4 Toddler Comment=4 Toddler application Exec=/opt/com.company.4toddler/4Toddler Categories=Games Icon=4toddler Type=Application Terminal=false StartupNotify=true


Name - specific name of the application
GenericName - generic name of the application
Comment - tooltip for the entry
Exec - path to program to execute, possibly with arguments
Categories - categories in which the entry should be shown in a menu. Information about all categories can be found here
Icon - icon file name
Type - type of desktop entry. Can be Application, Link or Directory
Terminal - whether the program runs in a terminal window

Full description for all keys inside the desktop file can be found at here.

Next we need to make some changes in our project file. We should tell Qt Creator* which file should be packed to our RPM.

# Files to be packed and installed target.path = /opt/com.company.4toddler/ icon.files = Icon/4toddler.png icon.path = /usr/share/icons/ icon16.files = Icon/16/4toddler.png icon16.path = /usr/share/icons/hicolor/16x16/apps/ icon32.files = Icon/32/4toddler.png icon32.path = /usr/share/icons/hicolor/32x32/apps/ icon64.files = Icon/64/4toddler.png icon64.path = /usr/share/icons/hicolor/64x64/apps/ icon128.files = Icon/128/4toddler.png icon128.path = /usr/share/icons/hicolor/128x128/apps/ desktop.files = 4Toddler.desktop desktop.path = /usr/share/applications sounds.files = Sounds/*.wav sounds.path = /var/opt/com.company.4toddler/sounds/ ui.files = UI/*.* ui.path = /var/opt/com.company.4toddler/UI/ stars.files = UI/Stars/*.png stars.path = /var/opt/com.company.4toddler/UI/Stars/ icons.files = UI/Icons/*.png icons.path = /var/opt/com.company.4toddler/UI/Icons/ INSTALLS += target icon icon16 icon32 icon64 icon128 desktop sounds ui stars icons


Why do I choose /opt/com.company.4toddler/ for binaries and /var/opt/com.company.4toddler/sounds/ for application files? This is a requirement, described in MeeGo* Packaging and Compliance Guidelines.

Last thing, we should add spec file to our project. This file is needed to build RPM file from our project files. Add new 4Toddler.spec file:

# Define package name %define app_name com.company.4toddler Name:          4toddler Version:        1.0.1 Release:        1 License:        Intel Summary:        4 Toddler Application Url:            http://you_company_website.com Group:         Amusements/Games Requires:    libqt >= 4.7.0 %description Application description %prep %setup -q %build # Add commands here to compile the package. make %install make install INSTALL_ROOT=%{buildroot} %files %defattr(-,root,root,-) /opt/%{app_name} %{_datadir}/applications/*.desktop %{_datadir}/icons/*.png %{_datadir}/icons/hicolor/16x16/apps/*.png %{_datadir}/icons/hicolor/32x32/apps/*.png %{_datadir}/icons/hicolor/64x64/apps/*.png %{_datadir}/icons/hicolor/128x128/apps/*.png /var/opt/%{app_name}/sounds/*.wav /var/opt/%{app_name}/UI/*.* /var/opt/%{app_name}/UI/Stars/*.* /var/opt/%{app_name}/UI/Icons/*.*


Name - package name. Name of your application
Version - software version
Release - package version
Url - Url to your application web site
Group - package group
Requires - package requirements


You can read more about spec files here.

As you can see, the sec file contains several sections, marked with %. The most interesting section is the %files section. In this section you should define paths to all your installed files. If you forget to include something, this file will not be packed and installed.

Hint: To make sure all files are inside RPM package and have valid paths, I use 7-Zip. Using 7-Zip you can open and explore RPM packages.

Done! Your application is ready to be built, deployed on a device and submitted to the Intel AppUpSM Center. But don't forget to rename your package before submission to:

com.companyname.appname.rpm

Some useful links:
MeeGo* Packaging and Compliance Guidelines
Integrating the Intel AppUp™ SDK Suite in a MeeGo* app
Building a MeeGo* Application for AppUpSM using Windows* Development Environment
Installing the MeeGo* SDK for Windows*
Packaging/Guidelines - MeeGo* Wiki
Packaging/Tutorial - MeeGo* Wiki
Desktop file specifications
http://www.rpm.org/max-rpm/index.html

Have a question? Do not hesitate to ask.
Good luck!

For more complete information about compiler optimizations, see our Optimization Notice.

Comments

Hi dmitry-rizshkov, Following

Hi dmitry-rizshkov,

Following are the part of the my .spec file
%install
# Add here commands to install the package.
#%qmake_install
make install INSTALL_ROOT=%{buildroot}
%files
%defattr(-,root,root,-)
/opt/%{app_name}
%{_datadir}/applications/*.desktop
/opt/%{app_name}/Database.sqlite
/opt/%{app_name}/Images/*.*
/opt/%{app_name}/Profile/*.*

When i install the package, only the 'root' user have all the permissions for all files.But i need all the users can be able to change /update the database file and folders and all.So what will i do to achieve this.

In my current application , its working fine if i open the application binary directly inside the /opt/com.company.appname directory with current "root" as the user.
But when i open the application from Application Menu, database is not updating,at the same time i can able to read the database contents.

My application is, such that all user are supposed to view or edit the database and files.
Please suggest me how can i manage the permissions for my database files and other folders

Thanks,
Vishnu



Hi dmitry-rizshkov, Thanks

Hi dmitry-rizshkov,
Thanks for the suggestion.I tried changing to the following

make install INSTALL_ROOT=%{buildroot}

%files
%defattr(777,root,root,-)
/opt/%{app_name}
%{_datadir}/applications/*.desktop
/var/opt/%{app_name}/HeritageData.sqlite
/opt/%{app_name}/Images/*.*
/opt/%{app_name}/Profile/*.*

but seems not working.I can able to view the databse records, but not able to write the records.I think it seems to be a read/write/execute permission issue.Also user want to copy some files inside my packages, thats also not working.
When i change the permission of my "com.company.appname" to access all(read/write/execute), then application is working fine.
So Is there any way i can change the permission of "com.company.package" inside the /opt directory??
Or please clarify me on this issue

Thanks,
Vsh.Vshnu



Dear Dmitry this is a very

Dear Dmitry this is a very useful post. If this was there 2 days before, our first app Super Soccer would have not been rejected as we forgot to rename the app "com.companyname.appname.rpm " and is been rejected only for the naming convention. All for Good ;-)

This Post will be useful for many developers. Great work done by you again.

Cheers
Suresh



I think you misinterpreted

I think you misinterpreted the compliance spec:

Variable data from a package, such as lock files, cached files, etc. shall be placed in the /var/opt/packagename directory rather than directly in /var, unless a specific location is necessary for the application or system to operate correctly.

Everything you install to /var/opt belongs under /opt, IIUC.





Pages