d75d68274fcb60eb0f26e5934a660f57fb58079c
[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 src/svg src/sql src/qt3support
17
18 Name:           mingw32-qt-win
19 Version:        4.5.0
20 Release:        1%{?dist}
21 Summary:        Qt for Windows
22
23 License:        GPLv3 with exceptions or LGPLv2 with exceptions
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 Patch11:        mingw32-qt-4.4.3-no-fpu-functions.patch
48
49 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
50 BuildArch:      noarch
51
52 BuildRequires:  mingw32-filesystem >= 35
53 BuildRequires:  mingw32-gcc
54 BuildRequires:  mingw32-gcc-c++
55 BuildRequires:  mingw32-binutils
56
57 # For the native qmake, moc programs.
58 # Note that the precise same native version is required - eg. moc will
59 # not work unless it's the same version.
60 #BuildRequires:  qt-devel = %{version}  Stupid, can't write this ...
61 BuildRequires:  qt-devel
62
63 BuildRequires:  zip
64 BuildRequires:  dos2unix
65
66 # This is required because we want qmake, but also because we
67 # install the cross-compile qmake specs into a directory owned
68 # by this package.
69 Requires:       qt-devel
70
71
72 %description
73 This package contains the Qt software toolkit for developing
74 cross-platform applications.
75
76 This is the Windows version of Qt, for use in conjunction with the
77 Fedora Windows cross-compiler.
78
79
80 %prep
81 %setup -q -n qt-win-opensource-src-%{version}
82
83 %patch0 -p1
84
85 %patch11 -p1
86
87 for f in LICENSE.GPL3 LICENSE.LGPL LGPL_EXCEPTION.txt KNOWN.ISSUES README; do
88   dos2unix --keepdate $f
89 done
90
91 # Override the .qmake.cache file.
92 rm .qmake.cache
93 sed -e s,@builddir@,$(pwd),g < %{SOURCE2} > .qmake.cache
94
95 # Cross-compilation qmake target.
96 mkdir mkspecs/fedora-win32-cross
97 cp %{SOURCE3} %{SOURCE4} mkspecs/fedora-win32-cross
98
99
100 %build
101 for d in %{subdirs}; do
102   # Precompiled headers from a previous iteration of this loop
103   # cause the compiler deep confusion, so make sure any are removed
104   # _and_ the PCH directories are fresh and empty.
105   rm -rf tmp/obj/release_shared/qt_pch.h.gch
106   mkdir -p tmp/obj/release_shared/qt_pch.h.gch
107   rm -rf tmp/obj/release_shared/qt_gui_pch.h.gch
108   mkdir -p tmp/obj/release_shared/qt_gui_pch.h.gch
109
110   # Now build in this directory.
111   pushd $d
112   qmake-qt4 -win32 *.pro
113   make %{?_smp_mflags}
114   popd
115 done
116
117
118 %install
119 rm -rf $RPM_BUILD_ROOT
120
121 for d in %{subdirs}; do
122   # As above ... WTF is Qt doing confusing make and make install??
123   rm -rf tmp/obj/release_shared/qt_pch.h.gch
124   mkdir -p tmp/obj/release_shared/qt_pch.h.gch
125   rm -rf tmp/obj/release_shared/qt_gui_pch.h.gch
126   mkdir -p tmp/obj/release_shared/qt_gui_pch.h.gch
127
128   pushd $d
129   make %{?_smp_mflags} INSTALL_ROOT=$RPM_BUILD_ROOT install
130   popd
131 done
132
133 # Qt ignores our carefully configured directories and just
134 # puts stuff in default directories.  Move them to the proper
135 # places ...
136 # (Actually this may be because we are using the native qmake)
137 mkdir -p $RPM_BUILD_ROOT%{_mingw32_includedir}
138 mv $RPM_BUILD_ROOT%{_includedir}/* $RPM_BUILD_ROOT%{_mingw32_includedir}
139 mkdir -p $RPM_BUILD_ROOT%{_mingw32_bindir}
140 mkdir -p $RPM_BUILD_ROOT%{_mingw32_libdir}
141 mv $RPM_BUILD_ROOT%{_libdir}/*.dll $RPM_BUILD_ROOT%{_mingw32_bindir}
142 mv $RPM_BUILD_ROOT%{_libdir}/*.a $RPM_BUILD_ROOT%{_mingw32_libdir}
143 rm $RPM_BUILD_ROOT%{_libdir}/qt4/bin/*
144 rm $RPM_BUILD_ROOT%{_libdir}/*.prl
145
146 # Cross-compiler qmake specs.
147 mkdir -p $RPM_BUILD_ROOT%{_libdir}/qt4/mkspecs/fedora-win32-cross
148 cp %{SOURCE3} %{SOURCE4} \
149   $RPM_BUILD_ROOT%{_libdir}/qt4/mkspecs/fedora-win32-cross
150
151
152 %clean
153 rm -rf $RPM_BUILD_ROOT
154
155
156 %files
157 %defattr(-,root,root)
158 %doc configure.output
159 %doc LICENSE.GPL3 LICENSE.LGPL LGPL_EXCEPTION.txt KNOWN.ISSUES README
160 %{_mingw32_bindir}/QtCore4.dll
161 %{_mingw32_bindir}/QtGui4.dll
162 %{_mingw32_bindir}/QtNetwork4.dll
163 %{_mingw32_bindir}/QtXml4.dll
164 %{_mingw32_bindir}/QtSvg4.dll
165 %{_mingw32_bindir}/QtSql4.dll
166 %{_mingw32_bindir}/Qt3Support4.dll
167 %{_mingw32_libdir}/libQtCore4.a
168 %{_mingw32_libdir}/libQtGui4.a
169 %{_mingw32_libdir}/libQtNetwork4.a
170 %{_mingw32_libdir}/libQtXml4.a
171 %{_mingw32_libdir}/libQtSvg4.a
172 %{_mingw32_libdir}/libQtSql4.a
173 %{_mingw32_libdir}/libQt3Support4.a
174 %{_mingw32_libdir}/libqtmain.a
175 %{_mingw32_includedir}/Qt/
176 %{_mingw32_includedir}/QtCore/
177 %{_mingw32_includedir}/QtGui/
178 %{_mingw32_includedir}/QtNetwork/
179 %{_mingw32_includedir}/QtXml/
180 %{_mingw32_includedir}/QtSvg/
181 %{_mingw32_includedir}/QtSql/
182 %{_mingw32_includedir}/Qt3Support/
183 %{_libdir}/qt4/mkspecs/fedora-win32-cross
184
185
186 %changelog
187 * Thu Mar 12 2009 Thomas Sailer <t.sailer@alumni.ethz.ch> - 4.5.0-1
188 - update to Qt 4.5.0 (release)
189 - also build QtSvg, QtSql, Qt3Support
190
191 * Sat Feb 21 2009 Richard W.M. Jones <rjones@redhat.com> - 4.5.0-0.2.rc1
192 - Update to Qt 4.5.0-rc1.
193
194 * Fri Feb 20 2009 Richard W.M. Jones <rjones@redhat.com> - 4.4.3-4
195 - Rebuild for mingw32-gcc 4.4
196
197 * Fri Feb  6 2009 Richard W.M. Jones <rjones@redhat.com> - 4.4.3-3
198 - Fix required for older W32API in Fedora 10.
199
200 * Sun Feb  1 2009 Richard W.M. Jones <rjones@redhat.com> - 4.4.3-2
201 - Initial RPM release.