Sun, 14 Dec 2008 13:33:48 +0100
Update to new versions of vendor software and correct build logic.
1 ##
2 ## qt.spec -- OpenPKG RPM Specification
3 ## Copyright (c) 2008 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 ##
25 # package information
26 Name: qt
27 Summary: Cross-platform Application Framework
28 URL: http://www.trolltech.com/products/qt/
29 Vendor: Nokia Corporation
30 Packager: Michael Schloh von Bennewitz
31 Distribution: MSvB Recherche Production
32 Class: EVAL
33 Group: Development
34 License: GPL
35 Version: 4.4.3
36 Release: 20081214
38 # build options
39 %option with_tools yes
40 %option with_shared no
41 %option with_examples no
43 # list of sources
44 Source0: ftp://ftp.trolltech.com/qt/source/qt-x11-opensource-src-%{version}.tar.gz
46 # build information
47 Prefix: %{l_prefix}
48 BuildRoot: %{l_buildroot}
49 BuildPreReq: OpenPKG, openpkg >= 20050726, gcc, pkgconfig
50 PreReq: OpenPKG, openpkg >= 20050726
51 BuildPreReq: X11, png, mng, jpeg, tiff, mesa, xrender
52 PreReq: X11, png, mng, jpeg, tiff, mesa, xrender
53 BuildPreReq: openssl, zlib, libiconv, sqlite, dbus
54 PreReq: openssl, zlib, libiconv, sqlite, dbus
55 BuildPreReq: fontconfig, freetype
56 PreReq: fontconfig, freetype
57 AutoReq: no
58 AutoReqProv: no
59 Provides: QTSDK
61 %description
62 Qt is a comprehensive C++ framework for cross-platform application
63 development. Using Qt, you can develop applications and user
64 interfaces once, and deploy them across many desktop and embedded
65 operating systems without rewriting the source code.
67 %track
68 prog qt = {
69 version = %{version}
70 url = ftp://ftp.trolltech.com/qt/source/
71 regex = qt-x11-opensource-src-(__VER__)\.tar\.gz
72 }
74 %prep
75 # announce exceptional build requirements
76 ( echo "This package has exceptional storage requirements:"
77 echo " qt-%{version}-root (2,5 Go)"
78 echo " qt-x11-opensource-src-%{version} (4,5 Go)"
79 echo " qt-%{version}-<date>.<arch>-<os>-<tag>.rpm (1 Go)"
80 echo "Building with no options takes 0,5 hours on a dual core"
81 echo "2 GHz CPU, or 2 hours with all build options enabled."
82 ) | %{l_rpmtool} msg -b -t notice
84 %setup -q -n qt-x11-opensource-src-%{version}
85 x11_incdir=`%{l_rc} --query x11_incdir`
86 x11_libdir=`%{l_rc} --query x11_libdir`
87 fontconf=`%{l_prefix}/bin/pkg-config --libs-only-l --static fontconfig`
88 loclibs=''
89 x11_supdir=''
90 case "%{l_platform -t}" in
91 *-sunos* )
92 loclibs='-lsocket -lnsl'
93 [ -d /usr/X/sfw/lib ] && x11_supdir=/usr/X/sfw/lib
94 ;;
95 esac
96 ( cd mkspecs/qws
97 for plat in freebsd-generic-g++ macx-generic-g++ solaris-generic-g++;
98 do
99 ln -s $plat `echo $plat | %{l_shtool} subst -e 's;\(.*\)-generic-\(.*\);\1-x86-\2;'`
100 done
101 ) || exit $?
102 %{l_shtool} subst \
103 -e 's;\(-z[ \t][ \t]*\)\([^ \t\"][^ \t\"]*\);\1"\2";g' \
104 configure
105 %{l_shtool} subst \
106 -e "s;\(QMAKE_LIBS_X11.*\)-lfreetype -lfontconfig;\1$fontconf;" \
107 configure
108 %{l_shtool} subst \
109 -e 's;-silent|;-rpath|-silent|;' \
110 -e 's;\(RPATH_FLAGS="\)\\"\$QT_INSTALL_LIBS\\" \($RPATH_FLAGS"\);\1\2;' \
111 -e "s;\(echo.*QMAKE_RPATHDIR +=\).*\$QT_INSTALL_LIBS\\\\\"\\\";\1 $x11_libdir\";" \
112 configure
113 if [ ".$x11_supdir" != . -a -d "$x11_supdir" ]; then
114 %{l_shtool} subst \
115 -e "s;\(echo.*QMAKE_RPATHDIR += \)\($x11_libdir\\\"\)\( >> \\\"\$QTCONFIG\.tmp\\\"\);\1\2\3 \&\& \1$x11_supdir\"\3;" \
116 configure
117 fi
118 %{l_shtool} subst \
119 -e 's;\(TRY_INCLUDEPATHS = \).*\(\$\$INCLUDEPATH\);\1\2;' \
120 -e 's;/freetype2;/freetype;' \
121 config.tests/unix/freetype/freetype.pri
122 %{l_shtool} subst \
123 -e "s;^\(LIBS += \)-lfreetype -lfontconfig;\1$fontconf;" \
124 config.tests/x11/fontconfig/fontconfig.pro
125 %{l_shtool} subst \
126 -e "s;\(LIBS += -lpq\);\1 -lssl -lcrypto $loclibs;" \
127 config.tests/unix/psql/psql.pro
128 %{l_shtool} subst \
129 -e 's;^mac:\(LIBS\);\1;' \
130 config.tests/unix/iconv/iconv.pro
131 %{l_shtool} subst \
132 -e 's;^\(QMAKE_INCDIR[^a-zA-Z0-9=]*=\).*;\1 %{l_prefix}/include;' \
133 -e 's;^\(QMAKE_LIBDIR[^a-zA-Z0-9=]*=\).*;\1 %{l_prefix}/lib;' \
134 -e "s;^\(QMAKE_INCDIR_OPENGL[^=]*=\) *\(.*\);\1 %{l_prefix}/include \2;" \
135 -e "s;^\(QMAKE_LIBDIR_OPENGL[^=]*=\) *\(.*\);\1 %{l_prefix}/lib \2 $x11_supdir;" \
136 -e 's;^\(QMAKE_LFLAGS_RELEASE.*\);\1 -s;' \
137 mkspecs/qws/*/qmake.conf \
138 mkspecs/*/*.conf
139 %{l_shtool} subst \
140 -e 's;^\(QMAKE_LIBS +=.*\);\1 -liconv;' \
141 src/corelib/corelib.pro
142 %{l_shtool} subst \
143 -e "s;^\(QMAKE_INCDIR_X11[^=]*=\) *\(.*\);\1 %{l_prefix}/include \2;" \
144 -e "s;^\(QMAKE_LIBDIR_X11[^=]*=\) *\(.*\);\1 %{l_prefix}/lib \2 $x11_supdir;" \
145 mkspecs/qws/solaris*/qmake.conf \
146 mkspecs/solaris*/qmake.conf
147 %{l_shtool} subst \
148 -e 's; *\.\./3rdparty/freetype/.*;;g' \
149 -e 's;^\( *contains(QT_CONFIG, freetype) {\);\1 LIBS += -lfreetype;' \
150 src/gui/text/text.pri
151 %{l_shtool} subst \
152 -e 's;\(#include *"\)\(tiffio.h"\);\1tiff/\2;' \
153 src/plugins/imageformats/tiff/qtiffhandler.cpp
154 # for projfile in `find examples/ -name '*.pro' -print`; do
155 # echo 'CONFIG += release' >>$projfile
156 # done
158 %build
159 # protect against sloppy code inclusion of all unused subprojects
160 rm -rf src/3rdparty/[^cdhmsw]* src/3rdparty/sql* src/3rdparty/win*
162 case "%{l_platform -t}" in
163 *-aix* ) platcomp="aix-g++" ;;
164 *-freebsd* ) platcomp="freebsd-g++" ;;
165 *-hpux* ) platcomp="hpux-g++" ;;
166 *-irix* ) platcomp="irix-g++" ;;
167 *64-linux* ) platcomp="linux-g++-64" ;;
168 *-linux* ) platcomp="linux-g++" ;;
169 *-darwin* ) platcomp="macx-g++" ;;
170 *-sunos* ) platcomp="solaris-g++" ;;
171 * ) echo "Platform '%{l_platform -t}' is not supported." 2>&1; exit 1 ;;
172 esac
174 %if "%{with_shared}" == "yes"
175 # optional shared build (precedes mandatory static build)
176 echo 'yes' | ./configure \
177 -prefix %{l_prefix} \
178 -bindir %{l_prefix}/bin \
179 -libdir %{l_prefix}/lib/qt \
180 -docdir %{l_prefix}/share/qt/doc \
181 -headerdir %{l_prefix}/include \
182 -plugindir %{l_prefix}/share/qt/plugins \
183 -datadir %{l_prefix}/share/qt \
184 -translationdir %{l_prefix}/share/qt/translations \
185 -sysconfdir %{l_prefix}/etc/qt \
186 -examplesdir %{l_prefix}/share/qt/examples \
187 -demosdir %{l_prefix}/share/qt/demos \
188 -release \
189 -shared \
190 -platform $platcomp \
191 -no-sql-ibase \
192 -qt-sql-mysql \
193 -no-sql-odbc \
194 -no-sql-psql \
195 -no-sql-sqlite2 \
196 -qt-sql-sqlite \
197 -system-sqlite \
198 -openssl-linked \
199 -xmlpatterns \
200 -svg \
201 -no-webkit \
202 -system-zlib \
203 -qt-gif \
204 -system-libpng \
205 -system-libmng \
206 -system-libjpeg \
207 -system-libtiff \
208 -rpath \
209 -no-cups \
210 -iconv \
211 -pch \
212 -dbus-linked \
213 -opengl \
214 -xrender \
215 -fontconfig \
216 -freetype \
217 -no-glib
219 # sadly, webkit and glib is broken in Qt 4.4.3.
220 # default options are implicitly used, und zwar...
221 #-no-fast -exceptions -accessibility -stl -qt3support -nis
222 #-sm -xshape -xinerama -xcursor -xfixes -xrandr -tablet -xkb
224 # carry out shared build procedure
225 ( cd src
226 %{l_make} %{l_mflags -O} \
227 sub-moc sub-rcc sub-uic
228 %{l_make} %{l_mflags -O} \
229 sub-corelib sub-xml sub-network sub-gui sub-sql \
230 sub-script sub-testlib sub-qt3support sub-dbus \
231 sub-opengl sub-xmlpatterns sub-svg sub-plugins
232 ) || exit $?
234 # cache shared libs and initialize the build configuration, which
235 # would otherwise still contain references to our shared libs build
236 %{l_shtool} mkdir -f -p -m 755 dynamic
237 mv lib/* dynamic/
238 ( cd qmake
239 %{l_make} %{l_mflags} distclean
240 ) || exit $?
241 rm -f .qmake.cache
242 %endif
244 # mandatory static build (follows optional shared build)
245 echo 'yes' | ./configure \
246 -prefix %{l_prefix} \
247 -bindir %{l_prefix}/bin \
248 -libdir %{l_prefix}/lib \
249 -docdir %{l_prefix}/share/qt/doc \
250 -headerdir %{l_prefix}/include \
251 -plugindir %{l_prefix}/share/qt/plugins \
252 -datadir %{l_prefix}/share/qt \
253 -translationdir %{l_prefix}/share/qt/translations \
254 -sysconfdir %{l_prefix}/etc/qt \
255 -examplesdir %{l_prefix}/share/qt/examples \
256 -demosdir %{l_prefix}/share/qt/demos \
257 -release \
258 -static \
259 -platform $platcomp \
260 -no-sql-ibase \
261 -qt-sql-mysql \
262 -no-sql-odbc \
263 -no-sql-psql \
264 -no-sql-sqlite2 \
265 -qt-sql-sqlite \
266 -system-sqlite \
267 -openssl-linked \
268 -xmlpatterns \
269 -svg \
270 -no-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 -iconv \
280 -pch \
281 -dbus-linked \
282 -opengl \
283 -xrender \
284 -fontconfig \
285 -freetype \
286 -no-glib
288 # default options are implicitly used, und zwar...
289 #-no-fast -exceptions -accessibility -stl -qt3support -nis
290 #-sm -xshape -xinerama -xcursor -xfixes -xrandr -tablet -xkb
292 # carry out static build procedure
293 %{l_make} %{l_mflags -O} sub-src
294 %if "%{with_tools}" == "yes"
295 %{l_make} %{l_mflags -O} sub-tools
296 %endif
297 %if "%{with_examples}" == "yes"
298 %{l_make} %{l_mflags -O} \
299 sub-demos-make_default-ordered \
300 sub-examples-make_default-ordered
301 %endif
303 %install
304 rm -rf $RPM_BUILD_ROOT
306 # carry out installation procedure
307 targets="sub-moc-install_subtargets-ordered \
308 sub-rcc-install_subtargets-ordered \
309 sub-uic-install_subtargets-ordered \
310 sub-corelib-install_subtargets-ordered \
311 sub-xml-install_subtargets-ordered \
312 sub-network-install_subtargets-ordered \
313 sub-gui-install_subtargets-ordered \
314 sub-sql-install_subtargets-ordered \
315 sub-script-install_subtargets-ordered \
316 sub-testlib-install_subtargets-ordered \
317 sub-qt3support-install_subtargets-ordered \
318 sub-dbus-install_subtargets-ordered \
319 sub-uic3-install_subtargets-ordered \
320 sub-opengl-install_subtargets-ordered \
321 sub-xmlpatterns-install_subtargets-ordered \
322 sub-svg-install_subtargets-ordered \
323 sub-plugins-install_subtargets-ordered"
324 %if "%{with_tools}" == "yes"
325 targets="$targets sub-tools-install_subtargets-ordered"
326 %endif
327 %if "%{with_examples}" == "yes"
328 targets="$targets sub-demos-install_subtargets-ordered sub-examples-install_subtargets-ordered"
329 %endif
330 targets="$targets install_htmldocs install_qchdocs install_docimages install_translations install_qmake install_mkspecs"
331 %{l_make} %{l_mflags} $targets INSTALL_ROOT="$RPM_BUILD_ROOT"
333 %if "%{with_shared}" == "yes"
334 # install shared libs and symlinks
335 %{l_shtool} mkdir -f -p -m 755 \
336 $RPM_BUILD_ROOT%{l_prefix}/lib/qt
337 %{l_tar} cf - dynamic | %{l_tar} xf - -C $RPM_BUILD_ROOT%{l_prefix}/lib/qt
339 # explain nonstandard shared library placement
340 ( echo "This directory contains optional shared libraries as"
341 echo "defined by the OpenPKG build specification. Although"
342 echo "shared libraries are only optionally built (see the"
343 echo "build time 'with_shared yes' option), static libraries"
344 echo "are built and installed in the parent 'lib' directory."
345 ) >$RPM_BUILD_ROOT%{l_prefix}/lib/qt/README
347 # do not support pkg-config(1) with shared libs
348 rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/qt/pkgconfig
350 # remove temporary dynamic link paths
351 %{l_shtool} subst \
352 -e 's;\(QMAKE_PRL_BUILD_DIR[^=][^=]*=\).*\(qt-x11-opensource-src.*\);\1 /tmp/\2;' \
353 $RPM_BUILD_ROOT%{l_prefix}/lib/*.prl
354 %endif
356 # determine internal file listing
357 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
358 %{l_files_std} \
359 '%doc %{l_prefix}/share/qt/doc/*' \
360 '%not %dir %{l_prefix}/lib/pkgconfig'
362 %files -f files
364 %clean
365 rm -rf $RPM_BUILD_ROOT