| Line 9: | Line 9: | ||
cp -a /usr/lib/qt4/example/opengl/textures $workspace/textures-0.0.1 | cp -a /usr/lib/qt4/example/opengl/textures $workspace/textures-0.0.1 | ||
| - | * Add an icon for the appilcation. | + | * Add an icon for the appilcation. We reuse an image inside the project as the application icon. |
cp images/side6.png textures.png | cp images/side6.png textures.png | ||
| - | * Add a desktop file | + | * Add a desktop file so we can find the application from MeeGo applications panel. |
vi textures.desktop | vi textures.desktop | ||
with following contents: | with following contents: | ||
| Line 19: | Line 19: | ||
Comment=Qt Demo Textures | Comment=Qt Demo Textures | ||
Exec=textures | Exec=textures | ||
| - | Categories= | + | Categories=Development; |
Icon=textures | Icon=textures | ||
Type=Application | Type=Application | ||
| Line 25: | Line 25: | ||
StartupNotify=true | StartupNotify=true | ||
| - | * Edit the $workspace/textures-0.0.1/textures.pro to remove | + | * Edit the $workspace/textures-0.0.1/textures.pro to remove some defines for Qt Example and add icon, desktop installation. The contents will be: |
HEADERS = glwidget.h \ | HEADERS = glwidget.h \ | ||
window.h | window.h | ||
| Line 46: | Line 46: | ||
INSTALLS += target icon desktop | INSTALLS += target icon desktop | ||
| - | * | + | * If you want to test, we can move the whole folder into MeeGo SDK chroot environment, build, debug and test it. |
qmake | qmake | ||
make | make | ||
make install | make install | ||
| - | * | + | * Clean up the project and create the source tarball, which is ready to do packaging. |
make distclean | make distclean | ||
cd .. | cd .. | ||
| Line 58: | Line 58: | ||
== Create spec file == | == Create spec file == | ||
MeeGo recommends to use [http://wiki.meego.com/Spectacle Spectacle] to either create MeeGo spec file or convert existing spec file to MeeGo spec file. | MeeGo recommends to use [http://wiki.meego.com/Spectacle Spectacle] to either create MeeGo spec file or convert existing spec file to MeeGo spec file. | ||
| + | |||
==== Install Spectacle ==== | ==== Install Spectacle ==== | ||
* On MeeGo platform or MeeGo chroot environment, you can install it directly. | * On MeeGo platform or MeeGo chroot environment, you can install it directly. | ||
| - | |||
| - | |||
yum install python-cheetah | yum install python-cheetah | ||
| + | yum install spectacle | ||
| + | |||
* On Linux Host machine, you can refer to [http://wiki.meego.com/Spectacle#Installation Spectacle Installation]. | * On Linux Host machine, you can refer to [http://wiki.meego.com/Spectacle#Installation Spectacle Installation]. | ||
| Line 71: | Line 72: | ||
vi $workspace/textures.yaml | vi $workspace/textures.yaml | ||
with following contents: | with following contents: | ||
| - | |||
Name: spectacleName: textures | Name: spectacleName: textures | ||
Summary: Qt Demo - OpenGL Textures | Summary: Qt Demo - OpenGL Textures | ||
Version: 0.0.1 | Version: 0.0.1 | ||
Release: 1 | Release: 1 | ||
| - | Group: | + | Group: Development/Tools |
License: LGPLv2.1 | License: LGPLv2.1 | ||
URL: http://qt.nokia.com | URL: http://qt.nokia.com | ||
| Line 91: | Line 91: | ||
Files: | Files: | ||
- /usr/bin/textures | - /usr/bin/textures | ||
| - | - /usr/share/ | + | - /usr/share/applications/*.desktop |
- /usr/share/icons/*.png | - /usr/share/icons/*.png | ||
| Line 115: | Line 115: | ||
Version: 0.0.1 | Version: 0.0.1 | ||
Release: 1 | Release: 1 | ||
| - | Group: | + | Group: Development/Tools |
License: LGPLv2.1 | License: LGPLv2.1 | ||
URL: http://qt.nokia.com | URL: http://qt.nokia.com | ||
| Line 216: | Line 216: | ||
yum localinstall --nogpgcheck textures-0.0.1-1.i586.rpm | yum localinstall --nogpgcheck textures-0.0.1-1.i586.rpm | ||
| - | Then you can start the MeeGo SDK simulator and find QtDemoTextures in applications-> | + | Then you can start the MeeGo SDK simulator and find QtDemoTextures in applications->Programming. Click it and run. |
* More about rpmbuild can be found at [http://www.rpm.org/max-rpm-snapshot/ch-rpm-b-command.html rpmbuild] | * More about rpmbuild can be found at [http://www.rpm.org/max-rpm-snapshot/ch-rpm-b-command.html rpmbuild] | ||
Contents |
MeeGo uses RPM as the package format. After you finish your application development work, you need to make a RPM package to publish it. This page will introduce a tutorial to create RPM package with MeeGo SDK and tools. To generate MeeGo adapted RPM packages, the MeeGo Packaging Guideline should be followed. This page will provides a simple tutorial to create a MeeGo rpm package for an OpenGL application called "textures", which is an example in Qt demo.
The textures is one example of Qt demo and included in qt-examples package. The project is at /usr/lib/qt4/example/opengl/textures.
cp -a /usr/lib/qt4/example/opengl/textures $workspace/textures-0.0.1
cp images/side6.png textures.png
vi textures.desktop
with following contents:
[Desktop Entry] Name=QtDemoTextures Comment=Qt Demo Textures Exec=textures Categories=Development; Icon=textures Type=Application Terminal=false StartupNotify=true
HEADERS = glwidget.h \
window.h
SOURCES = glwidget.cpp \
main.cpp \
window.cpp
RESOURCES = textures.qrc
QT += opengl
# install
#target.path = $$[QT_INSTALL_EXAMPLES]/opengl/textures
#sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS textures.pro images
#sources.path = $$[QT_INSTALL_EXAMPLES]/opengl/textures
target.path = /usr/bin
icon.files = textures.png
icon.path = /usr/share/icons
desktop.files = textures.desktop
desktop.path = /usr/share/applications
INSTALLS += target icon desktop
qmake make make install
make distclean cd .. tar jcvf textures-0.0.1.tar.bz2 textures-0.0.1
MeeGo recommends to use Spectacle to either create MeeGo spec file or convert existing spec file to MeeGo spec file.
yum install python-cheetah yum install spectacle
Spectacle uses a package meta-data file as the input to generate MeeGo spec file. The meta-data file is in YAML format. Spectacle defines specific Syntax of Spectacle YAML.
vi $workspace/textures.yaml
with following contents:
Name: spectacleName: textures Summary: Qt Demo - OpenGL Textures Version: 0.0.1 Release: 1 Group: Development/Tools License: LGPLv2.1 URL: http://qt.nokia.com Sources: - "%{name}-%{version}.tar.bz2" Description: Qt Demo OpenGL Textures
PkgConfigBR:
- QtCore >= 4.6.0
- QtOpenGL
- QtGui
Configure: none
Builder: none
Files:
- /usr/bin/textures
- /usr/share/applications/*.desktop
- /usr/share/icons/*.png
spec2spectacle package_name.spec
With the YAML file, the spec file can be easily generated:
specify textures.yaml
The generated $workspace/textures.spec file is:
# # Do not Edit! Generated by: # spectacle version 0.15 # # >> macros # << macros Name: textures Summary: Qt Demo - OpenGL Textures Version: 0.0.1 Release: 1 Group: Development/Tools License: LGPLv2.1 URL: http://qt.nokia.com Source0: %{name}-%{version}.tar.bz2 Source100: textures.yaml Requires(post): desktop-file-utils Requires(post): /bin/touch Requires(postun): desktop-file-utils BuildRequires: pkgconfig(QtCore) >= 4.6.0 BuildRequires: pkgconfig(QtOpenGL) BuildRequires: pkgconfig(QtGui) BuildRequires: desktop-file-utils %description Qt Demo OpenGL Textures %prep %setup -q -n %{name}-%{version} # >> setup # << setup %build # >> build pre # << build pre # >> build post # << build post %install rm -rf %{buildroot} # >> install pre # << install pre # >> install post # << install post desktop-file-install --delete-original \ --dir %{buildroot}%{_datadir}/applications \ %{buildroot}%{_datadir}/applications/* %post /bin/touch --no-create %{_datadir}/icons/hicolor || : %{_bindir}/gtk-update-icon-cache \ --quiet %{_datadir}/icons/hicolor 2> /dev/null|| : update-desktop-database %{_datadir}/applications &> /dev/null || : %postun /bin/touch --no-create %{_datadir}/icons/hicolor || : %{_bindir}/gtk-update-icon-cache \ --quiet %{_datadir}/icons/hicolor 2> /dev/null|| : update-desktop-database %{_datadir}/applications &> /dev/null || : %files %defattr(-,root,root,-) /usr/bin/textures /usr/share/applications/*.desktop /usr/share/icons/*.png # >> files # << files
Note: In textures.yaml, we put "none" for the "Builder" option since the spectacle v0.15 does not support qt build well so we have to manually change the textures.spec. That limitation has been fixed in latest spectacle, which however is not included in MeeGo 1.0.
# >> build pre export PATH=$PATH:/usr/lib/qt4/bin qmake-qt4 # << build pre
# >> install post
make INSTALL_ROOT=%{buildroot} install
# << install post
For application developers, they may want to create package directly from the MeeGo SDK chroot environment. It's quite easy to use rpmbuild to do that.
yum install rpmbuild yum install meego-rpm-config
cp textures-0.0.1.tar.bz2 ~/rpmbuild/SOURCES/ cp textures.yaml ~/rpmbuild/SOURCES/ cp textures.spec ~/rpmbuild/SPECS/
cd ~/rpmbuild/SPECS rpmbuild -ba textures.spec
Then the rpm packages will be generated at:
~/rpmbuild/RPMS/i586/textures-0.0.1-1.i586.rpm ~/rpmbuild/SRPMS/textures-0.0.1-1.src.rpm
cd ~/rpmbuild/RPMS/i586/ yum localinstall --nogpgcheck textures-0.0.1-1.i586.rpm
Then you can start the MeeGo SDK simulator and find QtDemoTextures in applications->Programming. Click it and run.
For people who do build or release, they may just want to build packages without the MeeGo SDK chroot environment. The following steps are useful for them.
Under Linux, a tool called "build" is used to create rpm packages directly from spec file.
* MeeGo * Fedora 10,11,12 * openSUSE(s) * xUbuntu 8.10/9.04/9.10 * Debian 5.0
sudo build --repository http://repo.meego.com/MeeGo/release/1.0/core/repo/ia32/os/ --arch i686 spectacle.spec
The packages will be generated at /var/tmp/build-root/home/abuild/rpmbuild/RPMS/ and /var/tmp/build-root/home/abuild/rpmbuild/SRPMS/ You may configure your http_proxy to make sure the repo can be accessed.
export http_proxy=http://proxy_server:port