edist.prf a qmake feature for advanced source distribution package generation
Add qmake feature for advanced source distribution package generation
Author: Peter Seiderer (for http://www.ciselant.de)
Date: 3 March 2012
A. Rational
On Unix systems qmake generated Makefiles have a 'dist' target which
should pack all relevant source, header, project files into an compressed
tar file. Extra files can be included with the variable 'DISTFILES' in
the project file [1].
This feature seems to be without active development and there
are several bugs and deficients (Qt-4.7.4/QMake-2.01a):
- The distribution file is named after the given 'TARGET' name in
the project file. If the target 'TARGET=mytarget' is given in an
application project file after 'make dist' all files are packed
into 'mytarget1.0.0.tar.gz' distribution file. One would expect
(as autoconf/automake projects do) the filename and path to
be 'mytarget-1.0.0.tar.gz'
- There are several additional .conf/.prf files packed into the
'mytarget1.0.0.tar.gz' tar file [2]:
$ tar -tvzf mytarget1.0.0.tar.gz
mytarget1.0.0/usr/share/qt4/mkspecs/common/linux.conf
mytarget1.0.0/usr/share/qt4/mkspecs/common/unix.conf
mytarget1.0.0/usr/share/qt4/mkspecs/common/g++.conf
mytarget1.0.0/usr/share/qt4/mkspecs/features/qt_config.prf
mytarget1.0.0/usr/share/qt4/mkspecs/features/default_post.prf
mytarget1.0.0/usr/share/qt4/mkspecs/features/qt_functions.prf
mytarget1.0.0/usr/share/qt4/mkspecs/features/exclusive_builds.prf
mytarget1.0.0/usr/share/qt4/mkspecs/features/qt.prf
mytarget1.0.0/usr/share/qt4/mkspecs/features/unix/thread.prf
mytarget1.0.0/usr/share/qt4/mkspecs/features/release.prf
mytarget1.0.0/usr/share/qt4/mkspecs/features/default_pre.prf
mytarget1.0.0/usr/share/qt4/mkspecs/features/moc.prf
mytarget1.0.0/usr/share/qt4/mkspecs/features/include_source_dir.prf
mytarget1.0.0/usr/share/qt4/mkspecs/qconfig.pri
mytarget1.0.0/pro1.h
mytarget1.0.0/pro1.cpp
mytarget1.0.0/pro1.pro
The last three are the (minimal) example project files.
- The 'dist' target is only provided for 'app', 'lib' and 'aux' qmake
templates, no support for the 'subdirs' template [3][4]. There exists
already a patch [5], but this is not yet on the mainline (Qt-4.8.0).
B. The edist (extended dist) feature
Put the downloaded edist.prf file into your project root directory (or
somewhere else into the feature/spec search path of qmake, as described
in [6]). Add 'CONFIG += edist' to all your project files. Now generate
the Unix Makefiles with 'QMAKEFEATURES=`pwd` qmake -recursive' (see D.)
and test the source distribution package generation with 'make edist'.
There should be the generated '-.tar.gz'
file in your project directory.
C. Run the example
$ wget http://www.ciselant.de/projects/qt-edist/qt-edist-1.0.0.tar.gz
$ tar -tvzf qt_example-1.0.0.tgz
$ cd qt_example-1.0.0
$ QMAKEFEATURES=`pwd` qmake -recursive
$ make edist
$ tar -tvzf qt_example-1.0.0.tgz
D. Why a simple qmake is not enough
As described in [6], the project's root directory should be included in the
qmake configuration/feature search path. So a simple 'qmake' should be enough.
But there seems to be a bug in the current qmake implementation (Qt-4.7.4/Qt-4.8.0,
QMake-2.01a). To work around this the project root/current path is added to
'QMAKEFEATURES' environment variable and the '-recursive' option is given
to qmake, so all Makefiles in the project subdirectories are generated.
Without this workaround the edist.prf feature file is not found by qmake:
$ cd qt_example-1.0.0
$ strace -f qmake 2>& | grep edist.prf
stat("/edist.prf", 0x96d8c8) = -1 ENOENT (No such file or directory)
stat("/usr/share/qt4//mkspecs/default/features/edist.prf", 0x96d8c8) = -1 ENOENT (No such file or directory)
stat("/usr/share/qt4/mkspecs/features/unix/edist.prf", 0x961fe8) = -1 ENOENT (No such file or directory)
stat("/usr/share/qt4/mkspecs/features/edist.prf", 0x961fe8) = -1 ENOENT (No such file or directory)
stat("/usr/mkspecs/features/unix/edist.prf", 0x961fe8) = -1 ENOENT (No such file or directory)
stat("/usr/mkspecs/features/edist.prf", 0x961fe8) = -1 ENOENT (No such file or directory)
stat("/usr/share/qt4//mkspecs/features/unix/edist.prf", 0x961fe8) = -1 ENOENT (No such file or directory)
stat("/usr/share/qt4//mkspecs/features/edist.prf", 0x961fe8) = -1 ENOENT (No such file or directory)
E. References
[1] http://qt-project.org/doc/qt-4.8/qmake-variable-reference.html#distfiles
[2] https://qt.gitorious.org/qt/qt/merge_requests/1048
[3] https://bugreports.qt-project.org/browse/QTBUG-3124
[4] https://bugreports.qt-project.org/browse/QTBUG-21910
[5] http://qt.gitorious.org/~jpnurmi/qt/jpnurmi-qt/commit/8c4ef198d88ceceb7b94526c1602ffff66225ae0
[6] http://qt-project.org/doc/qt-4.8/qmake-advanced-usage.html#adding-new-configuration-features
Download:
edist.prf
qt-edist-1.0.0.tar.gz
<< back to projects page
copyright © 2012 Peter Seiderer for www.ciselant.de