Sat, 04 Jul 2009 20:51:55 +0200
Update version, correct postgresql built logic, and include webkit.
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.
32 # package information
33 Name: qt
34 Summary: Cross-platform Application Framework
35 URL: http://www.trolltech.com/products/qt/
36 Vendor: Nokia Corporation
37 Packager: Michael Schloh von Bennewitz
38 Distribution: MSvB Recherche Production
39 Class: EVAL
40 Group: Development
41 License: GPL
42 Version: 4.5.2
43 Release: 20090702
45 # build options
46 %option with_tools yes
47 %option with_mysql no
48 %option with_pgsql no
49 %option with_shared no
50 %option with_examples no
52 # list of sources
53 Source0: ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-%{version}.tar.gz
55 # build information
56 Prefix: %{l_prefix}
57 BuildRoot: %{l_buildroot}
58 BuildPreReq: OpenPKG, openpkg >= 20050726, make, gcc, pkgconfig
59 PreReq: OpenPKG, openpkg >= 20050726
60 BuildPreReq: X11, png, mng, jpeg, tiff, mesa, xrender
61 PreReq: X11, png, mng, jpeg, tiff, mesa, xrender
62 BuildPreReq: openssl, zlib, libiconv, sqlite, dbus
63 PreReq: openssl, zlib, libiconv, sqlite, dbus
64 BuildPreReq: fontconfig, freetype
65 PreReq: fontconfig, freetype
66 %if "%{with_mysql}" == "yes"
67 BuildPreReq: mysql
68 PreReq: mysql
69 %endif
70 %if "%{with_pgsql}" == "yes"
71 BuildPreReq: postgresql
72 PreReq: postgresql
73 %endif
74 AutoReq: no
75 AutoReqProv: no
76 Provides: QTSDK
78 %description
79 Qt is a comprehensive C++ framework for cross-platform application
80 development. Using Qt, you can develop applications and user
81 interfaces once, and deploy them across many desktop and embedded
82 operating systems without rewriting the source code. This package
83 distribution builds all modules of the Qt/X11 Open Source Edition.
85 %track
86 prog qt = {
87 version = %{version}
88 url = ftp://ftp.trolltech.com/qt/source/
89 regex = qt-x11-opensource-src-(__VER__)\.tar\.gz
90 }
92 %prep
93 # announce exceptional build requirements
94 ( echo "This package has exceptional storage requirements:"
95 echo " qt-%{version}-root (2,5 Go)"
96 echo " qt-x11-opensource-src-%{version} (4,5 Go)"
97 echo " qt-%{version}-<date>.<arch>-<os>-<tag>.rpm (1 Go)"
98 echo "Building with no options takes 0,5 hours on a dual core"
99 echo "2 GHz CPU, or 2 hours with all build options enabled."
100 ) | %{l_rpmtool} msg -b -t notice
102 %setup -q -n qt-x11-opensource-src-%{version}
103 x11_incdir=`%{l_rc} --query x11_incdir`
104 x11_libdir=`%{l_rc} --query x11_libdir`
105 fontconflibs=`%{l_prefix}/bin/pkg-config --libs-only-l --static fontconfig`
106 openssllibs=`%{l_prefix}/bin/pkg-config --libs --static openssl`
108 loclibs=''
109 case "%{l_platform -t}" in
110 *-sunos* )
111 loclibs='-lsocket -lnsl'
112 ;;
113 esac
114 ( cd mkspecs/qws
115 for plat in freebsd-generic-g++ macx-generic-g++ solaris-generic-g++;
116 do
117 ln -s $plat `echo $plat | %{l_shtool} subst -e 's;\(.*\)-generic-\(.*\);\1-x86-\2;'`
118 done
119 ) || exit $?
120 %{l_shtool} subst \
121 -e 's;\(-z[\t ][\t ]*\)\([^\t \"][^\t \"]*\);\1"\2";g' \
122 configure
123 %{l_shtool} subst \
124 -e "s;\(QMAKE_LIBS_X11.*\)-lfreetype -lfontconfig;\1$fontconflibs;" \
125 configure
126 %{l_shtool} subst \
127 -e "s;\(OPENSSL_LIBS *=\) *-lssl -lcrypto;\1 $openssllibs;" \
128 configure
129 %{l_shtool} subst \
130 -e 's;-silent|;-rpath|-silent|;' \
131 -e 's;\(RPATH_FLAGS="\)\\"\$QT_INSTALL_LIBS\\" \($RPATH_FLAGS"\);\1\2;' \
132 -e "s;\(echo.*QMAKE_RPATHDIR +=\).*\$QT_INSTALL_LIBS\\\\\"\\\";\1 $x11_libdir\";" \
133 configure
134 %{l_shtool} subst \
135 -e 's;\(TRY_INCLUDEPATHS = \).*\(\$\$INCLUDEPATH\);\1\2;' \
136 -e 's;/freetype2;/freetype;' \
137 config.tests/unix/freetype/freetype.pri
138 %{l_shtool} subst \
139 -e "s;^\(LIBS += \)-lfreetype -lfontconfig;\1$fontconflibs;" \
140 config.tests/x11/fontconfig/fontconfig.pro
141 %{l_shtool} subst \
142 -e "s;\(LIBS += -lpq\);\1 `%{l_prefix}/bin/pg_config --libs` $loclibs;" \
143 config.tests/unix/psql/psql.pro
144 %{l_shtool} subst \
145 -e 's;^mac:\(LIBS\);\1;' \
146 config.tests/unix/iconv/iconv.pro
147 %{l_shtool} subst \
148 -e 's;LIBS .*= -lpq$;LIBS += -lpq -lssl -lcrypto;' \
149 src/sql/drivers/drivers.pri
150 %{l_shtool} subst \
151 -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" \
152 src/corelib/kernel/kernel.pri \
153 src/gui/kernel/kernel.pri
154 %{l_shtool} subst \
155 -e "s;QMAKE_CXXFLAGS \*= \$\$QT_CFLAGS_PSQL;INCPATH += `pg_config --includedir 2>/dev/null | %{l_shtool} subst -e 's;-I;;g'`;g" \
156 -e "s;QMAKE_CXXFLAGS \*= \$\$QT_CFLAGS_MYSQL;INCPATH += `mysql_config --include 2>/dev/null | %{l_shtool} subst -e 's;-I;;g'`;g" \
157 -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" \
158 src/plugins/sqldrivers/mysql/mysql.pro \
159 src/plugins/sqldrivers/psql/psql.pro \
160 src/plugins/sqldrivers/sqlite/sqlite.pro \
161 src/sql/drivers/drivers.pri
162 %{l_shtool} subst \
163 -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" \
164 src/dbus/dbus.pro
165 %{l_shtool} subst \
166 -e 's;^\(QMAKE_INCDIR[^a-zA-Z0-9=]*=\).*;\1 %{l_prefix}/include;' \
167 -e 's;^\(QMAKE_LIBDIR[^a-zA-Z0-9=]*=\).*;\1 %{l_prefix}/lib;' \
168 -e "s;^\(QMAKE_INCDIR_OPENGL[^=]*=\) *\(.*\);\1 %{l_prefix}/include \2;" \
169 -e "s;^\(QMAKE_LIBDIR_OPENGL[^=]*=\) *\(.*\);\1 %{l_prefix}/lib \2;" \
170 -e 's;^\(QMAKE_LFLAGS_RELEASE.*\);\1 -s;' \
171 mkspecs/qws/*/qmake.conf \
172 mkspecs/*/*.conf
173 %{l_shtool} subst \
174 -e 's;^\(QMAKE_LIBS +=.*\);\1 -liconv;' \
175 src/corelib/corelib.pro
176 %{l_shtool} subst \
177 -e "s;^\(QMAKE_INCDIR_X11[^=]*=\).*;\1 %{l_prefix}/include $x11_incdir;" \
178 -e "s;^\(QMAKE_LIBDIR_X11[^=]*=\).*;\1 %{l_prefix}/lib $x11_libdir;" \
179 mkspecs/qws/solaris*/qmake.conf \
180 mkspecs/solaris*/qmake.conf
181 %{l_shtool} subst \
182 -e 's; *\.\./3rdparty/freetype/.*;;g' \
183 -e 's;^\( *contains(QT_CONFIG, freetype) {\);\1 LIBS += -lfreetype;' \
184 src/gui/text/text.pri
185 %{l_shtool} subst \
186 -e 's;\(#include *"\)\(tiffio.h"\);\1tiff/\2;' \
187 src/plugins/imageformats/tiff/qtiffhandler.cpp
188 %{l_shtool} subst \
189 -e 's;\(CONFIG[\t ]*+=[\t ]*qt\);\1 x11;' \
190 tools/qtconfig/qtconfig.pro
191 # for projfile in `find examples/ -name '*.pro' -print`; do
192 # echo 'CONFIG += release' >>$projfile
193 # done
195 %build
196 # protect against sloppy code inclusion of all unused subprojects
197 rm -rf src/3rdparty/[^cdhmsw]* src/3rdparty/sql* src/3rdparty/win*
199 # detect which platform for which to build
200 case "%{l_platform -t}" in
201 sun4[uv]-sunos* | amd64-sunos* ) platcomp="solaris-g++-64" ;;
202 i?86-sunos* ) platcomp="solaris-g++" ;;
203 amd64-linux* ) platcomp="linux-g++-64" ;;
204 i?86-linux* ) platcomp="linux-g++" ;;
205 amd64-freebsd* | i?86-freebsd* ) platcomp="freebsd-g++" ;;
206 *-aix* ) platcomp="aix-g++" ;;
207 *-darwin* ) platcomp="macx-g++" ;;
208 *-hpux* ) platcomp="hpux-g++" ;;
209 *-irix* ) platcomp="irix-g++" ;;
210 * ) echo "Platform '%{l_platform -t}' is not supported." 2>&1; exit 1 ;;
211 esac
213 # detect which architecture extensions are available
214 archflags=''
215 case "%{l_platform -t}" in
216 amd64-* )
217 break
218 ;;
219 * )
220 archflags='-no-sse2 -no-3dnow'
221 ;;
222 esac
224 %if "%{with_shared}" == "yes"
225 # optional shared build (precedes mandatory static build)
226 echo 'yes' | ./configure \
227 $archflags \
228 -opensource \
229 -prefix %{l_prefix} \
230 -bindir %{l_prefix}/bin \
231 -libdir %{l_prefix}/lib/qt \
232 -docdir %{l_prefix}/share/qt/doc \
233 -headerdir %{l_prefix}/include \
234 -plugindir %{l_prefix}/lib/qt/plugins \
235 -datadir %{l_prefix}/share/qt \
236 -translationdir %{l_prefix}/share/qt/translations \
237 -sysconfdir %{l_prefix}/etc/qt \
238 -examplesdir %{l_prefix}/share/qt/examples \
239 -demosdir %{l_prefix}/share/qt/demos \
240 -release \
241 -shared \
242 -platform $platcomp \
243 -no-sql-ibase \
244 %if "%{with_mysql}" == "yes"
245 -qt-sql-mysql \
246 -plugin-sql-mysql \
247 %else
248 -no-sql-mysql \
249 %endif
250 %if "%{with_pgsql}" == "yes"
251 -qt-sql-psql \
252 -plugin-sql-psql \
253 %else
254 -no-sql-psql \
255 %endif
256 -no-sql-odbc \
257 -system-sqlite \
258 -qt-sql-sqlite \
259 -plugin-sql-sqlite \
260 -no-sql-sqlite2 \
261 -openssl-linked \
262 -xmlpatterns \
263 -svg \
264 -system-zlib \
265 -qt-gif \
266 -system-libpng \
267 -system-libmng \
268 -system-libjpeg \
269 -system-libtiff \
270 -rpath \
271 -no-cups \
272 -iconv \
273 -pch \
274 -dbus-linked \
275 -opengl \
276 -xrender \
277 -fontconfig \
278 -freetype \
279 -no-glib
281 # default options are implicitly used, for example...
282 #-no-fast -exceptions -accessibility -stl -qt3support -nis
283 #-sm -xshape -xinerama -xcursor -xfixes -xrandr -tablet -xkb
285 # carry out shared build procedure
286 ( cd src
287 %{l_make} %{l_mflags -O} \
288 sub-moc sub-rcc sub-uic
289 %{l_make} %{l_mflags -O} \
290 sub-corelib sub-xml sub-network sub-gui sub-sql \
291 sub-script sub-testlib sub-qt3support sub-dbus \
292 sub-opengl sub-xmlpatterns sub-svg sub-plugins
293 ) || exit $?
295 # arthur plugin requires libQtDesigner
296 ( cd demos
297 ( cd ../tools/designer/src/lib
298 %{l_make} %{l_mflags -O} staticlib
299 ) || exit $?
300 %{l_make} %{l_mflags -O} sub-arthurplugin
301 ( cd ../tools/designer/src/lib
302 %{l_make} %{l_mflags -O} distclean
303 ) || exit $?
304 ) || exit $?
306 # cache shared libs and initialize the build configuration, which
307 # would otherwise still contain references to our shared libs build
308 %{l_shtool} mkdir -f -p -m 755 dynamic
309 mv lib/* dynamic/
310 ( cd qmake
311 %{l_make} %{l_mflags} distclean
312 ) || exit $?
313 rm -f .qmake.cache
314 %endif
316 # mandatory static build (follows optional shared build)
317 echo 'yes' | ./configure \
318 $archflags \
319 -opensource \
320 -prefix %{l_prefix} \
321 -bindir %{l_prefix}/bin \
322 -libdir %{l_prefix}/lib \
323 -docdir %{l_prefix}/share/qt/doc \
324 -headerdir %{l_prefix}/include \
325 -plugindir %{l_prefix}/lib/qt/plugins \
326 -datadir %{l_prefix}/share/qt \
327 -translationdir %{l_prefix}/share/qt/translations \
328 -sysconfdir %{l_prefix}/etc/qt \
329 -examplesdir %{l_prefix}/share/qt/examples \
330 -demosdir %{l_prefix}/share/qt/demos \
331 -release \
332 -static \
333 -platform $platcomp \
334 -no-sql-ibase \
335 %if "%{with_mysql}" == "yes"
336 -qt-sql-mysql \
337 %else
338 -no-sql-mysql \
339 %endif
340 %if "%{with_pgsql}" == "yes"
341 -qt-sql-psql \
342 %else
343 -no-sql-psql \
344 %endif
345 -no-sql-odbc \
346 -system-sqlite \
347 -qt-sql-sqlite \
348 -no-sql-sqlite2 \
349 -openssl-linked \
350 -xmlpatterns \
351 -svg \
352 -system-zlib \
353 -qt-gif \
354 -system-libpng \
355 -system-libmng \
356 -system-libjpeg \
357 -system-libtiff \
358 -rpath \
359 -no-cups \
360 -iconv \
361 -pch \
362 -dbus-linked \
363 -opengl \
364 -xrender \
365 -fontconfig \
366 -freetype \
367 -no-glib
369 # default options are implicitly used, for example...
370 #-no-fast -exceptions -accessibility -stl -qt3support -nis
371 #-sm -xshape -xinerama -xcursor -xfixes -xrandr -tablet -xkb
373 # carry out static build procedure
374 %{l_make} %{l_mflags -O} sub-src
375 %if "%{with_tools}" == "yes"
376 %{l_make} %{l_mflags -O} sub-tools
377 %endif
378 %if "%{with_examples}" == "yes"
379 %{l_make} %{l_mflags -O} \
380 sub-demos-make_default-ordered \
381 sub-examples-make_default-ordered
382 %endif
384 %install
385 rm -rf $RPM_BUILD_ROOT
387 # carry out installation procedure
388 targets="sub-moc-install_subtargets-ordered \
389 sub-rcc-install_subtargets-ordered \
390 sub-uic-install_subtargets-ordered \
391 sub-corelib-install_subtargets-ordered \
392 sub-xml-install_subtargets-ordered \
393 sub-network-install_subtargets-ordered \
394 sub-gui-install_subtargets-ordered \
395 sub-sql-install_subtargets-ordered \
396 sub-script-install_subtargets-ordered \
397 sub-testlib-install_subtargets-ordered \
398 sub-qt3support-install_subtargets-ordered \
399 sub-dbus-install_subtargets-ordered \
400 sub-uic3-install_subtargets-ordered \
401 sub-opengl-install_subtargets-ordered \
402 sub-xmlpatterns-install_subtargets-ordered \
403 sub-svg-install_subtargets-ordered \
404 sub-plugins-install_subtargets-ordered"
405 %if "%{with_tools}" == "yes"
406 targets="$targets sub-tools-install_subtargets-ordered"
407 %endif
408 %if "%{with_examples}" == "yes"
409 targets="$targets sub-demos-install_subtargets-ordered sub-examples-install_subtargets-ordered"
410 %endif
411 targets="$targets install_htmldocs install_qchdocs install_docimages install_translations install_qmake install_mkspecs"
412 %{l_make} %{l_mflags} $targets INSTALL_ROOT="$RPM_BUILD_ROOT"
414 %if "%{with_shared}" == "yes"
415 # install shared libs and symlinks
416 %{l_shtool} mkdir -f -p -m 755 \
417 $RPM_BUILD_ROOT%{l_prefix}/lib/qt
418 %{l_tar} cf - dynamic | %{l_tar} xf - -C $RPM_BUILD_ROOT%{l_prefix}/lib/qt
420 # offer limited support of pkg-config(1) for shared libs
421 # substitution unfortunately only handles paths with no whitespace
422 %{l_shtool} subst \
423 -e "s;[^\t ][^\t ]*qt-x11-opensource-src-%{version};%{l_prefix};g" \
424 $RPM_BUILD_ROOT%{l_prefix}/lib/qt/dynamic/pkgconfig/*
426 # explain nonstandard shared library placement
427 ( echo "This OpenPKG Qt build is using the with_shared option."
428 echo ""
429 echo "This directory contains optional shared libraries as"
430 echo "defined by the OpenPKG build specification. Although"
431 echo "shared libraries have been optionally built (see the"
432 echo "build time 'with_shared yes' option), static libraries"
433 echo "were built by default as usual, and installed in the"
434 echo "standard library directory %{l_prefix}/lib."
435 echo ""
436 echo "To build applications using shared libraries instead,"
437 echo "please direct pkg-config(1) to use the properdefinitions"
438 echo "by setting the environment variable PKG_CONFIG_PATH to "
439 echo "%{l_prefix}/lib/qt/dynamic/pkgconfig."
440 ) >$RPM_BUILD_ROOT%{l_prefix}/lib/qt/README
442 # remove temporary dynamic link paths
443 %{l_shtool} subst \
444 -e "s;-L\([\t ]*\)[^\t ][^\t ]*qt-x11-opensource-src-%{version}\(/[^\t ][^\t ]*\);-L\1%{l_prefix}\2;g" \
445 -e "s;\([\t ][\t ]*\)[^\t ][^\t ]*\(qt-x11-opensource-src-%{version}.*\);\1/tmp/\2;" \
446 $RPM_BUILD_ROOT%{l_prefix}/lib/qt/dynamic/*.prl \
447 $RPM_BUILD_ROOT%{l_prefix}/lib/qt/dynamic/*.la
448 %endif
450 # determine internal file listing
451 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
452 %{l_files_std} \
453 '%doc %{l_prefix}/share/qt/doc/*/*' \
454 '%not %dir %{l_prefix}/lib/pkgconfig'
456 %files -f files
458 %clean
459 rm -rf $RPM_BUILD_ROOT