Rewriting the Qt .spec file

Erik van Pienbroek erik at vanpienbroek.nl
Sat Oct 9 19:39:57 UTC 2010


Hi everybody,

The mingw32-qt.spec file which is currently used in Fedora uses a rather
unconventional method to build the package. This involves a script which
has to run on the packagers' host, runs Qt's configure.exe using wine
and generating a diff against a clean source directory. In the .spec
file itself only some folders are built.

As you can see this is a kinda hacked up method to get Qt compiled.
Yesterday, Kalev Lember mentioned in #fedora-mingw that as of Qt 4.7.0
support for cross-compiling should have been improved. So I decided to
try to rewrite the Qt .spec file. In the end I managed to get Qt
compiled without the hacks which were originally used. As a bonus
support for MMX and SSE optimizations has also been added. There still
are some patches which need to be applied, but most of it is
upstreamable.

During this rewrite I stumbled across some issues which I would like to
share with the list so we come to a solution which everybody agrees on.

In the original .spec file a mkspecs target was created called
'win32-fedora-cross'. People had to use the command 'qmake-qt4 -spec
win32-fedora-cross' to compile Qt applications using MinGW. During the
rewrite I noticed that Qt's build system interprets that name as a MSVC
toolchain based one. This resulted in errors where the linker was trying
to link to .lib files instead of .a files for example. GCC based
toolchains have to use the prefix 'win32-g++'. For now I've patched
around this limitation, but I think we should discuss changing it to a
new name as we should limit the number of patches required to an
absolute minimum.

Kalev mentioned another MinGW cross compiler project [1] which uses the
mkspecs name win32-g++-cross. I would like to propose that we switch to
that name as well for Fedora 14 and rawhide. There's also a mingw-w64
testing repository out there [2] which bundles Qt. For mingw-w64 I'd
like to propose the mkspecs name win32-g++-cross-x64. Discussion whether
these are good or bad names is welcome.

Next there's the issue about bundled libraries which is a hot topic on
the fedora-devel list these days. By default Qt bundles several
libraries in it's DLL's. Among these are zlib, libjpeg, libtiff, libpng
and openssl. We already have those libraries in the Fedora repositories.
Upstream's releases don't have any dependencies on these external
libraries as they're all bundled inside the Qt DLL's. So the question is
whether we should confirm to the way upstream wants it or the way Fedora
wants it. Comments are welcome.

As soon as we've agreed on these two questions I'll build the new Qt
package and push it to F14 and rawhide.

Kind regards,

Erik van Pienbroek


1. http://hg.savannah.gnu.org/hgweb/mingw-cross-env
2.
http://www.mail-archive.com/mingw@lists.fedoraproject.org/msg00135.html




More information about the mingw mailing list