Packaging a Qt application
(→Porting the debian package to a Maemo package) |
(→Useful Links: add link) |
||
(51 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
- | + | {{main|Packaging}} | |
- | + | ||
- | + | ||
- | + | 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. | |
- | + | == Creating a Maemo package from a qmake project == | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | In order to create a new package for Maemo, from a qmake project, you will need to: | |
- | + | * Rename the source directory to <code>Package-Version</code> (for example myapp-0.1 for an application ‘myapp’ with a version of ‘0.1’) | |
+ | * Create a ‘src’ directory in <code>Package-Version/</code> | ||
+ | * Copy all the files to the <code>src/</code> directory | ||
+ | * Rename <code>src/appname.pro</code> to <code>src/src.pro</code> | ||
+ | Please make sure that the directory name is <package-version> format and in small case letters. | ||
- | |||
- | |||
- | |||
- | |||
- | |||
<pre> | <pre> | ||
$mv myapp myapp-0.1 | $mv myapp myapp-0.1 | ||
Line 30: | Line 20: | ||
</pre> | </pre> | ||
- | Append the following chunk to end of your src/src.pro . The chunk adds install section to your qmakefile | + | Append the following chunk to end of your <code>src/src.pro</code>. The chunk adds an install section to your qmakefile |
<pre> | <pre> | ||
- | + | unix { | |
- | + | #VARIABLES | |
- | + | isEmpty(PREFIX) { | |
- | + | PREFIX = /usr | |
} | } | ||
- | BINDIR = $$PREFIX/bin | + | BINDIR = $$PREFIX/bin |
- | DATADIR =$$PREFIX/share | + | DATADIR =$$PREFIX/share |
- | DEFINES += DATADIR=\"$$DATADIR\" PKGDATADIR=\"$$PKGDATADIR\" | + | DEFINES += DATADIR=\\\"$$DATADIR\\\" PKGDATADIR=\\\"$$PKGDATADIR\\\" |
- | #MAKE INSTALL | + | #MAKE INSTALL |
- | INSTALLS += target desktop iconxpm icon26 | + | INSTALLS += target desktop service iconxpm icon26 icon48 icon64 |
target.path =$$BINDIR | target.path =$$BINDIR | ||
Line 52: | Line 42: | ||
desktop.files += $${TARGET}.desktop | desktop.files += $${TARGET}.desktop | ||
- | + | service.path = $$DATADIR/dbus-1/services | |
- | + | service.files += $${TARGET}.service | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
icon64.path = $$DATADIR/icons/hicolor/64x64/apps | icon64.path = $$DATADIR/icons/hicolor/64x64/apps | ||
icon64.files += ../data/64x64/$${TARGET}.png | icon64.files += ../data/64x64/$${TARGET}.png | ||
} | } | ||
- | |||
- | |||
</pre> | </pre> | ||
- | *Create a myapp-0.1/myapp.pro file like this: | + | *Create a <code>myapp-0.1/myapp.pro</code> file like this: |
<pre> | <pre> | ||
QMAKEVERSION = $$[QMAKE_VERSION] | QMAKEVERSION = $$[QMAKE_VERSION] | ||
Line 85: | Line 67: | ||
**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> | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
== Editing the rules file == | == Editing the rules file == | ||
- | The rules file generated by dh_make will be modified in order to look like this one. | + | 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. |
- | We are using qmake, so | + | |
- | If you | + | |
- | the following chunk, you most propably get | + | |
<pre> | <pre> | ||
Line 162: | Line 118: | ||
dh_installman | dh_installman | ||
dh_link | dh_link | ||
- | dh_strip | + | dh_strip --dbg-package=my-application-dbg |
dh_compress | dh_compress | ||
dh_fixperms | dh_fixperms | ||
Line 175: | Line 131: | ||
</pre> | </pre> | ||
- | ==Editing the | + | == 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. | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | < | + | 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>. |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | Build-Depends | + | |
- | + | ||
- | + | == Example == | |
- | + | 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: | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | </ | + | |
- | + | apt-get source qt-maemo-example | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
This command will download the: | This command will download the: | ||
- | + | * unmodified source (.orig.tar.gz) | |
- | + | * debian dsc file (.dsc) | |
- | + | * diff file (.diff) | |
- | + | ||
- | + | ||
- | and | + | and will then automatically launch <code>dpkg -x file.dsc</code> in order to decompress the orig.tar.gz and apply the changes. |
- | = Useful Links = | + | == Useful Links == |
- | + | ||
- | [http:// | + | * [[Packaging Qt Creator Apps for Maemo Extras]] |
+ | * [[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: | + | [[Category:Packaging]] |
[[Category:Qt]] | [[Category:Qt]] |
Latest revision as of 09:11, 4 November 2010
Main article: Packaging
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.
Contents |
[edit] Creating a Maemo package from a qmake project
In order to create a new package for Maemo, from a qmake project, you will need to:
- Rename the source directory to
Package-Version
(for example myapp-0.1 for an application ‘myapp’ with a version of ‘0.1’) - Create a ‘src’ directory in
Package-Version/
- Copy all the files to the
src/
directory - Rename
src/appname.pro
tosrc/src.pro
Please make sure that the directory name is <package-version> format and in small case letters.
$mv myapp myapp-0.1 $cd myapp-0.1 $mkdir src $cp * src $mv src/appname.pro src/src.pro
Append the following chunk to end of your src/src.pro
. The chunk adds an install section to your qmakefile
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 }
- Create a
myapp-0.1/myapp.pro
file like this:
QMAKEVERSION = $$[QMAKE_VERSION] ISQT4 = $$find(QMAKEVERSION, ^[2-9]) isEmpty( ISQT4 ) { error("Use the qmake include with Qt4.4 or greater, on Debian that is qmake-qt4"); } TEMPLATE = subdirs SUBDIRS = src
- Run dh_make to debianize the source archive, it creates:
- An archive with the unchanged upstream source (orig.tar.gz)
- Some basic files in the debian directory
- Some example files (*.EX *.ex)
export DEBFULLNAME="maintainer first name and last name" dh_make --createorig --single -e maintainer@email.org -c gpl
[edit] Editing the rules file
The rules file generated by dh_make
, found in debian/rules
will be modified in order to look like this one. We are using qmake, so there is no configure
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.
#!/usr/bin/make -f APPNAME := my_app_name builddir: mkdir -p builddir builddir/Makefile: builddir cd builddir && qmake-qt4 PREFIX=/usr ../$(APPNAME).pro build: build-stamp build-stamp: builddir/Makefile dh_testdir # Add here commands to compile the package. cd builddir && $(MAKE) touch $@ clean: dh_testdir dh_testroot rm -f build-stamp # Add here commands to clean up after the build process. rm -rf builddir dh_clean install: build dh_testdir dh_testroot dh_clean -k dh_installdirs # Add here commands to install the package into debian/your_appname cd builddir && $(MAKE) INSTALL_ROOT=$(CURDIR)/debian/$(APPNAME) install # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_installdocs dh_installexamples dh_installman dh_link dh_strip --dbg-package=my-application-dbg dh_compress dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install configure
[edit] Editing the control file
The control file generated by dh_make
, found in debian/control
will be modified substantially. Please refer to the general packaging guide for Maemo for details.
For Qt applications you need to make sure to add libqt4-dev
as an additional entry in the field Build-Depends
.
[edit] Example
You can download the source package of qt-maemo-example from the extras-devel repository as follows, if you have source packages enabled in your /etc/apt/sources.list
file:
apt-get source qt-maemo-example
This command will download the:
- unmodified source (.orig.tar.gz)
- debian dsc file (.dsc)
- diff file (.diff)
and will then automatically launch dpkg -x file.dsc
in order to decompress the orig.tar.gz and apply the changes.
[edit] Useful Links
- This page was last modified on 4 November 2010, at 09:11.
- This page has been accessed 109,702 times.