Fix required for older W32API in Fedora 10.
[fedora-mingw.git] / qt-win / mingw32-qt-win.spec
1 %define __strip %{_mingw32_strip}
2 %define __objdump %{_mingw32_objdump}
3 %define _use_internal_dependency_generator 0
4 %define __find_requires %{_mingw32_findrequires}
5 %define __find_provides %{_mingw32_findprovides}
6
7 # NOTES, please read these carefully first:
8 #
9 # . We only build a few libraries at the moment, those listed in
10 #   %{subdirs} below.  We could build more without too much effort.
11 #
12 # . We should build our own qmake instead of relying on the one
13 #   from the native Fedora package.  The reason is so that we can
14 #   set the default include and library paths correctly.
15
16 %define subdirs src/corelib src/xml src/network src/gui src/winmain
17
18 Name:           mingw32-qt-win
19 Version:        4.4.3
20 Release:        3%{?dist}
21 Summary:        Qt for Windows
22
23 License:        GPLv2+
24 Group:          Development/Libraries
25
26 URL:            http://www.qtsoftware.com/
27 Source0:        ftp://ftp.trolltech.no/qt/source/qt-win-opensource-src-%{version}.zip
28
29 # To make the configure patch - see below.
30 Source1:        qt-win-configure.sh
31
32 # Override .qmake.cache
33 Source2:        qmake.cache.in
34
35 # Special cross-compilation qmake target.
36 Source3:        qmake.conf
37 Source4:        qplatformdefs.h
38
39 # Qt-win is supplied with a binary configure.exe.  Although we have source
40 # for this, (a) it can't be compiled on Linux, and (b) we cannot run
41 # the Windows binary during the build.  Instead we run the command by
42 # hand and create this diff to record what it did.
43 #
44 # Generate this patch using "qt-win-configure.sh".
45 Patch0:         qt-win-configure.patch
46
47 # The released source contains multiple, blatant build bugs which have
48 # been fixed (further) upstream months ago.  Urgghhh.  These patches
49 # fix them.
50 Patch10:        mingw32-qt-4.4.3-atomic-volatile.patch
51 Patch11:        mingw32-qt-4.4.3-no-fpu-functions.patch
52 Patch12:        mingw32-qt-4.4.3-wininput.patch
53
54 # http://lists-archives.org/mingw-users/11845-problem-compile-qt-4-4-2-with-latest-w32api.html
55 Patch20:        mingw32-qt-4.4.3-subauth.patch
56
57 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
58 BuildArch:      noarch
59
60 BuildRequires:  mingw32-filesystem >= 35
61 BuildRequires:  mingw32-gcc
62 BuildRequires:  mingw32-gcc-c++
63 BuildRequires:  mingw32-binutils
64
65 # For the native qmake, moc programs.
66 BuildRequires:  qt-devel
67 BuildRequires:  zip
68 BuildRequires:  dos2unix
69
70 # This is required because we want qmake, but also because we
71 # install the cross-compile qmake specs into a directory owned
72 # by this package.
73 Requires:       qt-devel
74
75
76 %description
77 This package contains the Qt software toolkit for developing
78 cross-platform applications.
79
80 This is the Windows version of Qt, for use in conjunction with the
81 Fedora Windows cross-compiler.
82
83
84 %prep
85 %setup -q -n qt-win-opensource-src-%{version}
86
87 %patch0 -p1
88
89 %patch10 -p1
90 %patch11 -p1
91 %patch12 -p1
92
93 %patch20 -p1
94
95 for f in changes-%{version} LICENSE.GPL2 LICENSE.GPL3 GPL_EXCEPTION_ADDENDUM.TXT GPL_EXCEPTION.TXT OPENSOURCE-NOTICE.TXT README; do
96   dos2unix --keepdate $f
97 done
98
99 # Override the .qmake.cache file.
100 rm .qmake.cache
101 sed -e s,@builddir@,$(pwd),g < %{SOURCE2} > .qmake.cache
102
103 # Cross-compilation qmake target.
104 mkdir mkspecs/fedora-win32-cross
105 cp %{SOURCE3} %{SOURCE4} mkspecs/fedora-win32-cross
106
107
108 %build
109 for d in %{subdirs}; do
110   # Precompiled headers from a previous iteration of this loop
111   # cause the compiler deep confusion, so make sure any are removed
112   # _and_ the PCH directories are fresh and empty.
113   rm -rf tmp/obj/release_shared/qt_pch.h.gch
114   mkdir -p tmp/obj/release_shared/qt_pch.h.gch
115   rm -rf tmp/obj/release_shared/qt_gui_pch.h.gch
116   mkdir -p tmp/obj/release_shared/qt_gui_pch.h.gch
117
118   # Now build in this directory.
119   pushd $d
120   qmake-qt4 -win32 *.pro
121   make %{?_smp_mflags}
122   popd
123 done
124
125
126 %install
127 rm -rf $RPM_BUILD_ROOT
128
129 for d in %{subdirs}; do
130   # As above ... WTF is Qt doing confusing make and make install??
131   rm -rf tmp/obj/release_shared/qt_pch.h.gch
132   mkdir -p tmp/obj/release_shared/qt_pch.h.gch
133   rm -rf tmp/obj/release_shared/qt_gui_pch.h.gch
134   mkdir -p tmp/obj/release_shared/qt_gui_pch.h.gch
135
136   pushd $d
137   make %{?_smp_mflags} INSTALL_ROOT=$RPM_BUILD_ROOT install
138   popd
139 done
140
141 # Qt ignores our carefully configured directories and just
142 # puts stuff in default directories.  Move them to the proper
143 # places ...
144 # (Actually this may be because we are using the native qmake)
145 mkdir -p $RPM_BUILD_ROOT%{_mingw32_includedir}
146 mv $RPM_BUILD_ROOT%{_includedir}/* $RPM_BUILD_ROOT%{_mingw32_includedir}
147 mkdir -p $RPM_BUILD_ROOT%{_mingw32_bindir}
148 mkdir -p $RPM_BUILD_ROOT%{_mingw32_libdir}
149 mv $RPM_BUILD_ROOT%{_libdir}/*.dll $RPM_BUILD_ROOT%{_mingw32_bindir}
150 mv $RPM_BUILD_ROOT%{_libdir}/*.a $RPM_BUILD_ROOT%{_mingw32_libdir}
151 rm $RPM_BUILD_ROOT%{_libdir}/qt4/bin/*
152 rm $RPM_BUILD_ROOT%{_libdir}/*.prl
153
154 # Cross-compiler qmake specs.
155 mkdir -p $RPM_BUILD_ROOT%{_libdir}/qt4/mkspecs/fedora-win32-cross
156 cp %{SOURCE3} %{SOURCE4} \
157   $RPM_BUILD_ROOT%{_libdir}/qt4/mkspecs/fedora-win32-cross
158
159
160 %clean
161 rm -rf $RPM_BUILD_ROOT
162
163
164 %files
165 %defattr(-,root,root)
166 %doc changes-%{version} configure.output
167 %doc LICENSE.GPL2 LICENSE.GPL3 GPL_EXCEPTION_ADDENDUM.TXT GPL_EXCEPTION.TXT
168 %doc OPENSOURCE-NOTICE.TXT README
169 %{_mingw32_bindir}/QtCore4.dll
170 %{_mingw32_bindir}/QtGui4.dll
171 %{_mingw32_bindir}/QtNetwork4.dll
172 %{_mingw32_bindir}/QtXml4.dll
173 %{_mingw32_libdir}/libQtCore4.a
174 %{_mingw32_libdir}/libQtGui4.a
175 %{_mingw32_libdir}/libQtNetwork4.a
176 %{_mingw32_libdir}/libQtXml4.a
177 %{_mingw32_libdir}/libqtmain.a
178 %{_mingw32_includedir}/Qt/
179 %{_mingw32_includedir}/QtCore/
180 %{_mingw32_includedir}/QtGui/
181 %{_mingw32_includedir}/QtNetwork/
182 %{_mingw32_includedir}/QtXml/
183 %{_libdir}/qt4/mkspecs/fedora-win32-cross
184
185
186 %changelog
187 * Fri Feb  6 2009 Richard W.M. Jones <rjones@redhat.com> - 4.4.3-3
188 - Fix required for older W32API in Fedora 10.
189
190 * Sun Feb  1 2009 Richard W.M. Jones <rjones@redhat.com> - 4.4.3-2
191 - Initial RPM release.