Fri, 02 Oct 2009 14:32:11 +0200
Use new file server URL for source files now hosted by nokia.
1 ##
2 ## qt.spec -- OpenPKG RPM Specification
3 ## Copyright (c) 2009 Michael Schloh von Bennewitz <michael@schloh.com>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # FIXME: MSvB: It appears that bugs in current versions of binutils
25 # FIXME: MSvB: fail to properly link Qt object code, resulting in
26 # FIXME: MSvB: 'ld: libQt*.so: pthread_mutex...: invalid version 6
27 # FIXME: MSvB: libQt*.so: could not read symbols: Bad value'
28 # FIXME: MSvB: The effects of these bugs are platform dependent.
29 # FIXME: MSvB: Solaris 11 IA-32 builds fail while Linux 2.6.25.18
30 # FIXME: MSvB: AMD64 builds succeed.
31 # FIXME: MSvB:
32 # FIXME: MSvB: GNU iconv integration is flawed in Qt 4.5.2, and
33 # FIXME: MSvB: has been disabled in this build until a new release
34 # FIXME: MSvB: corrects the problem.
36 # package information
37 Name: qt
38 Summary: Cross Platform Application Framework
39 URL: http://www.trolltech.com/products/qt/
40 Vendor: Nokia Corporation
41 Packager: Michael Schloh von Bennewitz
42 Distribution: MSvB Recherche Production
43 Class: EVAL
44 Group: Development
45 License: GPL
46 Version: 4.5.3
47 Release: 20091001
49 # build options
50 %option with_tools yes
51 %option with_mysql no
52 %option with_pgsql no
53 %option with_shared no
54 %option with_examples no
56 # list of sources
57 Source0: ftp://ftp.qt.nokia.com/qt/source/qt-x11-opensource-src-%{version}.tar.gz
59 # build information
60 Prefix: %{l_prefix}
61 BuildRoot: %{l_buildroot}
62 BuildPreReq: OpenPKG, openpkg >= 20050726, make, gcc, pkgconfig
63 PreReq: OpenPKG, openpkg >= 20050726
64 BuildPreReq: X11, png, mng, jpeg, tiff, mesa, xrender
65 PreReq: X11, png, mng, jpeg, tiff, mesa, xrender
66 BuildPreReq: openssl, zlib, libiconv, sqlite, dbus
67 PreReq: openssl, zlib, libiconv, sqlite, dbus
68 BuildPreReq: fontconfig, freetype
69 PreReq: fontconfig, freetype
70 %if "%{with_mysql}" == "yes"
71 BuildPreReq: mysql
72 PreReq: mysql
73 %endif
74 %if "%{with_pgsql}" == "yes"
75 BuildPreReq: postgresql
76 PreReq: postgresql
77 %endif
78 AutoReq: no
79 AutoReqProv: no
80 Provides: QTSDK
82 %description
83 Qt is a comprehensive C++ framework for cross-platform application
84 development. Using Qt, you can develop applications and user
85 interfaces once, and deploy them across many desktop and embedded
86 operating systems without rewriting the source code. This package
87 distribution builds all modules of the Qt/X11 Open Source Edition.
89 %track
90 prog qt = {
91 version = %{version}
92 url = ftp://ftp.trolltech.com/qt/source/
93 regex = qt-x11-opensource-src-(__VER__)\.tar\.gz
94 }
96 %prep
97 # announce exceptional build requirements
98 ( echo "This package has exceptional storage requirements:"
99 echo " qt-%{version}-root (2,5 Go)"
100 echo " qt-x11-opensource-src-%{version} (4,5 Go)"
101 echo " qt-%{version}-<date>.<arch>-<os>-<tag>.rpm (1 Go)"
102 echo "Building with no options takes 0,5 hours on a dual core"
103 echo "2 GHz CPU, or 2 hours with all build options enabled."
104 ) | %{l_rpmtool} msg -b -t notice
106 %setup -q -n qt-x11-opensource-src-%{version}
107 x11_incdir=`%{l_rc} --query x11_incdir`
108 x11_libdir=`%{l_rc} --query x11_libdir`
109 fontconflibs=`%{l_prefix}/bin/pkg-config --libs-only-l --static fontconfig`
110 openssllibs=`%{l_prefix}/bin/pkg-config --libs --static openssl`
112 loclibs=''
113 case "%{l_platform -t}" in
114 *-sunos* )
115 loclibs='-lsocket -lnsl'
116 ;;
117 esac
118 ( cd mkspecs/qws
119 for plat in freebsd-generic-g++ macx-generic-g++ solaris-generic-g++;
120 do
121 ln -s $plat `echo $plat | %{l_shtool} subst -e 's;\(.*\)-generic-\(.*\);\1-x86-\2;'`
122 done
123 ) || exit $?
124 %{l_shtool} subst \
125 -e 's;\(-z[\t ][\t ]*\)\([^\t \"][^\t \"]*\);\1"\2";g' \
126 configure
127 %{l_shtool} subst \
128 -e "s;\(QMAKE_LIBS_X11.*\)-lfreetype -lfontconfig;\1$fontconflibs;" \
129 configure
130 %{l_shtool} subst \
131 -e "s;\(OPENSSL_LIBS *=\) *-lssl -lcrypto;\1 $openssllibs;" \
132 configure
133 %{l_shtool} subst \
134 -e 's;-silent|;-rpath|-silent|;' \
135 -e 's;\(RPATH_FLAGS="\)\\"\$QT_INSTALL_LIBS\\" \($RPATH_FLAGS"\);\1\2;' \
136 -e "s;\(echo.*QMAKE_RPATHDIR +=\).*\$QT_INSTALL_LIBS\\\\\"\\\";\1 $x11_libdir\";" \
137 configure
138 %{l_shtool} subst \
139 -e 's;\(TRY_INCLUDEPATHS = \).*\(\$\$INCLUDEPATH\);\1\2;' \
140 -e 's;/freetype2;/freetype;' \
141 config.tests/unix/freetype/freetype.pri
142 %{l_shtool} subst \
143 -e "s;^\(LIBS += \)-lfreetype -lfontconfig;\1$fontconflibs;" \
144 config.tests/x11/fontconfig/fontconfig.pro
145 echo 'INCLUDEPATH += /usr/include/wacomcfg' \
146 >>src/gui/kernel/x11.pri
147 %{l_shtool} subst \
148 -e "s;\(LIBS += -lpq\);\1 `%{l_prefix}/bin/pg_config --libs` $loclibs;" \
149 config.tests/unix/psql/psql.pro
150 %{l_shtool} subst \
151 -e 's;^mac:\(LIBS\);\1;' \
152 config.tests/unix/iconv/iconv.pro
153 %{l_shtool} subst \
154 -e 's;LIBS .*= -lpq$;LIBS += -lpq -lssl -lcrypto;' \
155 src/sql/drivers/drivers.pri
156 %{l_shtool} subst \
157 -e "s;QMAKE_CXXFLAGS += \$\$QT_CFLAGS_GLIB;INCPATH += `pkg-config --cflags-only-I glib-2.0 gthread-2.0 2>/dev/null | %{l_shtool} subst -e 's;-I;;g'`;g" \
158 src/corelib/kernel/kernel.pri \
159 src/gui/kernel/kernel.pri
160 %{l_shtool} subst \
161 -e "s;QMAKE_CXXFLAGS \*= \$\$QT_CFLAGS_PSQL;INCPATH += `pg_config --includedir 2>/dev/null | %{l_shtool} subst -e 's;-I;;g'`;g" \
162 -e "s;QMAKE_CXXFLAGS \*= \$\$QT_CFLAGS_MYSQL;INCPATH += `mysql_config --include 2>/dev/null | %{l_shtool} subst -e 's;-I;;g'`;g" \
163 -e "s;QMAKE_CXXFLAGS \*= \$\$QT_CFLAGS_SQLITE;INCPATH += `pkg-config --cflags-only-I sqlite3 2>/dev/null | %{l_shtool} subst -e 's;-I;;g'`;g" \
164 src/plugins/sqldrivers/mysql/mysql.pro \
165 src/plugins/sqldrivers/psql/psql.pro \
166 src/plugins/sqldrivers/sqlite/sqlite.pro \
167 src/sql/drivers/drivers.pri
168 %{l_shtool} subst \
169 -e "s;QMAKE_CXXFLAGS += \$\$QT_CFLAGS_DBUS;INCPATH += `pkg-config --cflags-only-I dbus-1 2>/dev/null | %{l_shtool} subst -e 's;-I;;g'`;g" \
170 src/dbus/dbus.pro
171 %{l_shtool} subst \
172 -e 's;^\(QMAKE_INCDIR[^a-zA-Z0-9=]*=\).*;\1 %{l_prefix}/include;' \
173 -e 's;^\(QMAKE_LIBDIR[^a-zA-Z0-9=]*=\).*;\1 %{l_prefix}/lib;' \
174 -e "s;^\(QMAKE_INCDIR_OPENGL[^=]*=\) *\(.*\);\1 %{l_prefix}/include \2;" \
175 -e "s;^\(QMAKE_LIBDIR_OPENGL[^=]*=\) *\(.*\);\1 %{l_prefix}/lib \2;" \
176 -e 's;^\(QMAKE_LFLAGS_RELEASE.*\);\1 -s;' \
177 mkspecs/qws/*/qmake.conf \
178 mkspecs/*/*.conf
179 %{l_shtool} subst \
180 -e 's;^\(QMAKE_LIBS +=.*\);\1 -liconv;' \
181 src/corelib/corelib.pro
182 %{l_shtool} subst \
183 -e "s;^\(QMAKE_INCDIR_X11[^=]*=\).*;\1 %{l_prefix}/include $x11_incdir;" \
184 -e "s;^\(QMAKE_LIBDIR_X11[^=]*=\).*;\1 %{l_prefix}/lib $x11_libdir;" \
185 mkspecs/qws/solaris*/qmake.conf \
186 mkspecs/solaris*/qmake.conf
187 %{l_shtool} subst \
188 -e 's; *\.\./3rdparty/freetype/.*;;g' \
189 -e 's;^\( *contains(QT_CONFIG, freetype) {\);\1 LIBS += -lfreetype;' \
190 src/gui/text/text.pri
191 %{l_shtool} subst \
192 -e 's;\(#include *"\)\(tiffio.h"\);\1tiff/\2;' \
193 src/plugins/imageformats/tiff/qtiffhandler.cpp
194 %{l_shtool} subst \
195 -e 's;\(CONFIG[\t ]*+=[\t ]*qt\);\1 x11;' \
196 tools/qtconfig/qtconfig.pro
197 # for projfile in `find examples/ -name '*.pro' -print`; do
198 # echo 'CONFIG += release' >>$projfile
199 # done
201 %build
202 # protect against sloppy code inclusion of all unused subprojects
203 rm -rf src/3rdparty/[^cdhmsw]* src/3rdparty/sql* src/3rdparty/win*
205 # detect which platform for which to build
206 case "%{l_platform -t}" in
207 sun4[uv]-sunos* | amd64-sunos* ) platcomp="solaris-g++-64" ;;
208 i?86-sunos* ) platcomp="solaris-g++" ;;
209 amd64-linux* ) platcomp="linux-g++-64" ;;
210 i?86-linux* ) platcomp="linux-g++" ;;
211 amd64-freebsd* | i?86-freebsd* ) platcomp="freebsd-g++" ;;
212 *-aix* ) platcomp="aix-g++" ;;
213 *-darwin* ) platcomp="macx-g++" ;;
214 *-hpux* ) platcomp="hpux-g++" ;;
215 *-irix* ) platcomp="irix-g++" ;;
216 * ) echo "Platform '%{l_platform -t}' is not supported." 2>&1; exit 1 ;;
217 esac
219 # detect which architecture extensions are available
220 archflags=''
221 case "%{l_platform -t}" in
222 amd64-* )
223 break
224 ;;
225 * )
226 archflags='-no-sse2 -no-3dnow'
227 ;;
228 esac
230 %if "%{with_shared}" == "yes"
231 # optional shared build (precedes mandatory static build)
232 echo 'yes' | ./configure \
233 $archflags \
234 -opensource \
235 -prefix %{l_prefix} \
236 -bindir %{l_prefix}/bin \
237 -libdir %{l_prefix}/lib/qt \
238 -docdir %{l_prefix}/share/qt/doc \
239 -headerdir %{l_prefix}/include \
240 -plugindir %{l_prefix}/lib/qt/plugins \
241 -datadir %{l_prefix}/share/qt \
242 -translationdir %{l_prefix}/share/qt/translations \
243 -sysconfdir %{l_prefix}/etc/qt \
244 -examplesdir %{l_prefix}/share/qt/examples \
245 -demosdir %{l_prefix}/share/qt/demos \
246 -release \
247 -shared \
248 -platform $platcomp \
249 -no-sql-ibase \
250 %if "%{with_mysql}" == "yes"
251 -qt-sql-mysql \
252 -plugin-sql-mysql \
253 %else
254 -no-sql-mysql \
255 %endif
256 %if "%{with_pgsql}" == "yes"
257 -qt-sql-psql \
258 -plugin-sql-psql \
259 %else
260 -no-sql-psql \
261 %endif
262 -no-sql-odbc \
263 -system-sqlite \
264 -qt-sql-sqlite \
265 -plugin-sql-sqlite \
266 -no-sql-sqlite2 \
267 -openssl-linked \
268 -xmlpatterns \
269 -svg \
270 -webkit \
271 -system-zlib \
272 -qt-gif \
273 -system-libpng \
274 -system-libmng \
275 -system-libjpeg \
276 -system-libtiff \
277 -rpath \
278 -no-cups \
279 -no-iconv \
280 -pch \
281 -dbus-linked \
282 -opengl \
283 -xrender \
284 -fontconfig \
285 -freetype \
286 -no-glib
288 # default options are implicitly used, for example...
289 #-no-fast -exceptions -accessibility -stl -qt3support -nis
290 #-sm -xshape -xinerama -xcursor -xfixes -xrandr -tablet -xkb
292 # carry out shared build procedure
293 ( cd src
294 %{l_make} %{l_mflags -O} \
295 sub-moc sub-rcc sub-uic sub-uic3
296 %{l_make} %{l_mflags -O} \
297 sub-corelib sub-xml sub-network sub-gui sub-sql \
298 sub-script sub-testlib sub-qt3support sub-dbus \
299 sub-opengl sub-xmlpatterns sub-svg sub-plugins \
300 sub-webkit sub-scripttools
301 ) || exit $?
303 # arthur plugin requires libQtDesigner
304 ( cd demos
305 ( cd ../tools/designer/src/lib
306 %{l_make} %{l_mflags -O} staticlib
307 ) || exit $?
308 %{l_make} %{l_mflags -O} sub-arthurplugin
309 ( cd ../tools/designer/src/lib
310 %{l_make} %{l_mflags -O} distclean
311 ) || exit $?
312 ) || exit $?
314 # cache shared libs and initialize the build configuration, which
315 # would otherwise still contain references to our shared libs build
316 %{l_shtool} mkdir -f -p -m 755 dynamic
317 mv lib/* dynamic/
318 ( cd qmake
319 %{l_make} %{l_mflags} distclean
320 ) || exit $?
321 rm -f .qmake.cache
322 %endif
324 # mandatory static build (follows optional shared build)
325 echo 'yes' | ./configure \
326 $archflags \
327 -opensource \
328 -prefix %{l_prefix} \
329 -bindir %{l_prefix}/bin \
330 -libdir %{l_prefix}/lib \
331 -docdir %{l_prefix}/share/qt/doc \
332 -headerdir %{l_prefix}/include \
333 -plugindir %{l_prefix}/lib/qt/plugins \
334 -datadir %{l_prefix}/share/qt \
335 -translationdir %{l_prefix}/share/qt/translations \
336 -sysconfdir %{l_prefix}/etc/qt \
337 -examplesdir %{l_prefix}/share/qt/examples \
338 -demosdir %{l_prefix}/share/qt/demos \
339 -release \
340 -static \
341 -platform $platcomp \
342 -no-sql-ibase \
343 %if "%{with_mysql}" == "yes"
344 -qt-sql-mysql \
345 %else
346 -no-sql-mysql \
347 %endif
348 %if "%{with_pgsql}" == "yes"
349 -qt-sql-psql \
350 %else
351 -no-sql-psql \
352 %endif
353 -no-sql-odbc \
354 -system-sqlite \
355 -qt-sql-sqlite \
356 -no-sql-sqlite2 \
357 -openssl-linked \
358 -xmlpatterns \
359 -svg \
360 -webkit \
361 -system-zlib \
362 -qt-gif \
363 -system-libpng \
364 -system-libmng \
365 -system-libjpeg \
366 -system-libtiff \
367 -rpath \
368 -no-cups \
369 -no-iconv \
370 -pch \
371 -dbus-linked \
372 -opengl \
373 -xrender \
374 -fontconfig \
375 -freetype \
376 -no-glib
378 # default options are implicitly used, for example...
379 #-no-fast -exceptions -accessibility -stl -qt3support -nis
380 #-sm -xshape -xinerama -xcursor -xfixes -xrandr -tablet -xkb
382 # carry out static build procedure
383 %{l_make} %{l_mflags -O} sub-src
384 %if "%{with_tools}" == "yes"
385 %{l_make} %{l_mflags -O} sub-tools
386 %endif
387 %if "%{with_examples}" == "yes"
388 %{l_make} %{l_mflags -O} \
389 sub-demos-make_default-ordered \
390 sub-examples-make_default-ordered
391 %endif
393 %install
394 rm -rf $RPM_BUILD_ROOT
396 # carry out installation procedure
397 targets="sub-tools-bootstrap-install_subtargets-ordered \
398 sub-moc-install_subtargets-ordered \
399 sub-rcc-install_subtargets-ordered \
400 sub-uic-install_subtargets-ordered \
401 sub-corelib-install_subtargets-ordered \
402 sub-xml-install_subtargets-ordered \
403 sub-network-install_subtargets-ordered \
404 sub-gui-install_subtargets-ordered \
405 sub-sql-install_subtargets-ordered \
406 sub-script-install_subtargets-ordered \
407 sub-testlib-install_subtargets-ordered \
408 sub-qt3support-install_subtargets-ordered \
409 sub-dbus-install_subtargets-ordered \
410 sub-uic3-install_subtargets-ordered \
411 sub-opengl-install_subtargets-ordered \
412 sub-xmlpatterns-install_subtargets-ordered \
413 sub-svg-install_subtargets-ordered \
414 sub-webkit-install_subtargets-ordered \
415 sub-scripttools-install_subtargets-ordered \
416 sub-plugins-install_subtargets-ordered"
417 %if "%{with_tools}" == "yes"
418 targets="$targets sub-tools-install_subtargets-ordered sub-tools-qdoc3-install_subtargets-ordered"
419 %endif
420 %if "%{with_examples}" == "yes"
421 targets="$targets sub-demos-install_subtargets-ordered sub-examples-install_subtargets-ordered"
422 %endif
423 targets="$targets install_htmldocs install_qchdocs install_docimages install_qmake install_mkspecs"
424 %{l_make} %{l_mflags} $targets INSTALL_ROOT="$RPM_BUILD_ROOT"
426 %if "%{with_shared}" == "yes"
427 # install shared libs and symlinks
428 %{l_shtool} mkdir -f -p -m 755 \
429 $RPM_BUILD_ROOT%{l_prefix}/lib/qt
430 %{l_tar} cf - dynamic | %{l_tar} xf - -C $RPM_BUILD_ROOT%{l_prefix}/lib/qt
432 # offer limited support of pkg-config(1) for shared libs
433 # substitution unfortunately only handles paths with no whitespace
434 %{l_shtool} subst \
435 -e "s;[^\t ][^\t ]*qt-x11-opensource-src-%{version};%{l_prefix};g" \
436 $RPM_BUILD_ROOT%{l_prefix}/lib/qt/dynamic/pkgconfig/*
438 # explain nonstandard shared library placement
439 ( echo "This OpenPKG Qt build is using the with_shared option."
440 echo ""
441 echo "This directory contains optional shared libraries as"
442 echo "defined by the OpenPKG build specification. Although"
443 echo "shared libraries have been optionally built (see the"
444 echo "build time 'with_shared yes' option), static libraries"
445 echo "were built by default as usual, and installed in the"
446 echo "standard library directory %{l_prefix}/lib."
447 echo ""
448 echo "To build applications using shared libraries instead,"
449 echo "please direct pkg-config(1) to use the properdefinitions"
450 echo "by setting the environment variable PKG_CONFIG_PATH to "
451 echo "%{l_prefix}/lib/qt/dynamic/pkgconfig."
452 ) >$RPM_BUILD_ROOT%{l_prefix}/lib/qt/README
454 # remove temporary dynamic link paths
455 %{l_shtool} subst \
456 -e "s;-L\([\t ]*\)[^\t ][^\t ]*qt-x11-opensource-src-%{version}\(/[^\t ][^\t ]*\);-L\1%{l_prefix}\2;g" \
457 -e "s;\([\t ][\t ]*\)[^\t ][^\t ]*\(qt-x11-opensource-src-%{version}.*\);\1/tmp/\2;" \
458 $RPM_BUILD_ROOT%{l_prefix}/lib/qt/dynamic/*.prl \
459 $RPM_BUILD_ROOT%{l_prefix}/lib/qt/dynamic/*.la
460 %endif
462 # determine internal file listing
463 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
464 %{l_files_std} \
465 '%doc %{l_prefix}/share/qt/doc/*/*' \
466 '%not %dir %{l_prefix}/lib/pkgconfig'
468 %files -f files
470 %clean
471 rm -rf $RPM_BUILD_ROOT