1 # Copyright 1999-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # *** Please remember to update qt3.eclass when revbumping this ***
7 inherit eutils flag-o-matic toolchain-funcs
11 DESCRIPTION
="The Qt toolkit is a comprehensive C++ application development framework."
12 HOMEPAGE
="http://www.trolltech.com/"
16 IMMQT_P
="qt-x11-immodule-unified-qt3.3.8-20070321-gentoo"
18 SRC_URI
="mirror://gentoo/qt-x11-${SRCTYPE}-${PV}.tar.gz
19 ftp://ftp.trolltech.com/qt/source/qt-x11-${SRCTYPE}-${PV}.tar.gz
20 qt-copy? ( http://jyujin.de/~creidiki/qt-copy/qt-copy-${PV}-patches-${QT_COPY_SNAP}.tar.lzma )
21 immqt? ( mirror://gentoo/${IMMQT_P}.diff.bz2 )
22 immqt-bc? ( mirror://gentoo/${IMMQT_P}.diff.bz2 )"
23 LICENSE
="|| ( QPL-1.0 GPL-2 )"
26 KEYWORDS
="alpha amd64 hppa ia64 ~mips ppc ppc64 sparc x86 ~x86-fbsd"
27 IUSE
="cups debug doc examples firebird gif ipv6 mysql nas nis odbc opengl postgres qt-copy sqlite xinerama immqt immqt-bc"
29 DEPEND
="app-arch/lzma-utils
36 xinerama? ( x11-proto/xineramaproto x11-libs/libXinerama )
37 immqt? ( x11-proto/xineramaproto )
38 immqt-bc? ( x11-proto/xineramaproto )
42 >=media-libs/libmng-1.0.9
43 >=media-libs/freetype-2
45 nas? ( >=media-libs/nas-1.5 )
46 mysql? ( virtual/mysql )
47 firebird? ( dev-db/firebird )
48 opengl? ( virtual/opengl virtual/glu )
49 postgres? ( dev-db/libpq )
50 cups? ( net-print/cups )"
51 PDEPEND
="odbc? ( ~dev-db/qt-unixODBC-$PV )"
53 S
=${WORKDIR}/qt-x11-${SRCTYPE}-${PV}
58 if use immqt
&& use immqt-bc
; then
60 ewarn
"immqt and immqt-bc are exclusive. You cannot set both."
61 ewarn
"Please specify either immqt or immqt-bc."
66 ewarn
"You are going to compile binary imcompatible immodule for Qt. This means"
67 ewarn
"you have to recompile everything depending on Qt after you install it."
75 if [[ ${CXX/g++/} != ${CXX} ]]; then
77 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
80 die
"Unknown compiler ${CXX}."
84 *-freebsd*|
*-dragonfly*)
95 die
"Unknown CHOST, no platform choosed."
98 # probably this should be '*-64' for 64bit archs
99 # in a fully multilib environment (no compatibility symlinks)
100 export PLATFORM
="${PLATNAME}-${PLATCXX}"
107 sed -i -e 's:read acceptance:acceptance=yes:' configure
109 # Do not link with -rpath. See bug #75181.
110 find ${S}/mkspecs
-name qmake.conf |
xargs \
111 sed -i -e 's:QMAKE_RPATH.*:QMAKE_RPATH =:'
113 # Patch for uic includehint errors (aseigo patch)
114 epatch
${FILESDIR}/${P}-uic-fix.
patch
116 # Patch for mysql unload crash (Bug #171883)
117 epatch
${FILESDIR}/${P}-mysql-unload-crash.
diff
119 # KDE related patches
120 epatch
${FILESDIR}/0001-dnd_optimization.
patch
121 epatch
${FILESDIR}/0002-dnd_active_window_fix.
patch
122 epatch
${FILESDIR}/0038-dragobject-dont-prefer-unknown.
patch
123 epatch
${FILESDIR}/0044-qscrollview-windowactivate-fix.
diff
124 epatch
${FILESDIR}/0047-fix-kmenu-widget.
diff
125 epatch
${FILESDIR}/0048-qclipboard_hack_80072.
patch
127 # possible rce, CVE-2007-3388
128 epatch
${FILESDIR}/0081-format-string-fixes.
diff
131 epatch
${FILESDIR}/${P}-unicode-off-by-one.
patch
133 # ulibc patch (bug #100246)
134 epatch
${FILESDIR}/qt-ulibc.
patch
136 # xinerama patch: http://ktown.kde.org/~seli/xinerama/
137 epatch
"${FILESDIR}/${P}-seli-xinerama.patch"
139 epatch
${FILESDIR}/utf8-bug-qt3.
diff
141 # Visibility patch, apply only on GCC 4.1 and later for safety
142 # [[ $(gcc-major-version)$(gcc-minor-version) -ge 41 ]] && \
143 epatch
"${FILESDIR}/${P}-visibility.patch"
145 if use immqt || use immqt-bc
; then
146 epatch ..
/${IMMQT_P}.
diff
147 sh make-symlinks.sh || die
"make symlinks failed"
148 EPATCH_EXCLUDE
="0080_all_net-wm-sync-request.diff"
150 EPATCH_EXCLUDE
="0080_all_net-wm-sync-request-immqt-fix.diff"
153 if use ppc-macos
; then
154 epatch
"${FILESDIR}/${PN}-3.3.5-macos.patch"
157 # Apply QT Copy patches:
158 if use qt-copy
; then
159 EPATCH_MULTI_MSG
="Applying the KDE Qt Copy patches ..." \
160 EPATCH_SOURCE
="${WORKDIR}/qt-copy-${PV}-patches-${QT_COPY_SNAP}" EPATCH_SUFFIX
="diff" epatch
163 # known working flags wrt #77623
164 use sparc
&& export CFLAGS
="-O1" && export CXXFLAGS
="${CFLAGS}"
165 # set c/xxflags and ldflags
167 append-flags
-fno-strict-aliasing
169 if [[ $
( gcc-fullversion
) == "3.4.6" && gcc-specs-ssp
]] ; then
170 ewarn
"Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
171 append-flags
-fno-stack-protector
174 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
175 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
176 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
177 -e "s:\<QMAKE_CC\>.*=.*:QMAKE_CC=$(tc-getCC):" \
178 -e "s:\<QMAKE_CXX\>.*=.*:QMAKE_CXX=$(tc-getCXX):" \
179 -e "s:\<QMAKE_LINK\>.*=.*:QMAKE_LINK=$(tc-getCXX):" \
180 -e "s:\<QMAKE_LINK_SHLIB\>.*=.*:QMAKE_LINK_SHLIB=$(tc-getCXX):" \
181 ${S}/mkspecs
/${PLATFORM}/qmake.conf || die
183 if [ $
(get_libdir
) != "lib" ] ; then
184 sed -i -e "s:/lib$:/$(get_libdir):" \
185 ${S}/mkspecs
/${PLATFORM}/qmake.conf || die
190 export SYSCONF
=${D}${QTBASE}/etc
/settings
192 # Let's just allow writing to these directories during Qt emerge
193 # as it makes Qt much happier.
194 addwrite
"${QTBASE}/etc/settings"
195 addwrite
"${HOME}/.qt"
197 [ $
(get_libdir
) != "lib" ] && myconf
="${myconf} -L/usr/$(get_libdir)"
199 # unixODBC support is now a PDEPEND on dev-db/qt-unixODBC; see bug 14178.
200 use nas
&& myconf
="${myconf} -system-nas-sound"
201 use nis
&& myconf
="${myconf} -nis" || myconf
="${myconf} -no-nis"
202 use gif
&& myconf
="${myconf} -qt-gif" || myconf
="${myconf} -no-gif"
203 use mysql
&& myconf
="${myconf} -plugin-sql-mysql -I/usr/include/mysql -L/usr/$(get_libdir)/mysql" || myconf
="${myconf} -no-sql-mysql"
204 use postgres
&& myconf
="${myconf} -plugin-sql-psql -I/usr/include/postgresql/server -I/usr/include/postgresql/pgsql -I/usr/include/postgresql/pgsql/server" || myconf
="${myconf} -no-sql-psql"
205 use firebird
&& myconf
="${myconf} -plugin-sql-ibase -I/opt/firebird/include" || myconf
="${myconf} -no-sql-ibase"
206 use sqlite
&& myconf
="${myconf} -plugin-sql-sqlite" || myconf
="${myconf} -no-sql-sqlite"
207 use cups
&& myconf
="${myconf} -cups" || myconf
="${myconf} -no-cups"
208 use opengl
&& myconf
="${myconf} -enable-module=opengl" || myconf
="${myconf} -disable-opengl"
209 use debug
&& myconf
="${myconf} -debug" || myconf
="${myconf} -release -no-g++-exceptions"
210 use xinerama
&& myconf
="${myconf} -xinerama" || myconf
="${myconf} -no-xinerama"
212 myconf
="${myconf} -system-zlib"
214 use ipv6
&& myconf
="${myconf} -ipv6" || myconf
="${myconf} -no-ipv6"
215 use immqt-bc
&& myconf
="${myconf} -inputmethod"
216 use immqt
&& myconf
="${myconf} -inputmethod -inputmethod-ext"
218 if use ppc-macos
; then
219 myconf
="${myconf} -no-sql-ibase -no-sql-mysql -no-sql-psql -no-cups -lresolv -shared"
220 myconf
="${myconf} -I/usr/X11R6/include -L/usr/X11R6/lib"
221 myconf
="${myconf} -L${S}/lib -I${S}/include"
222 sed -i -e "s,#define QT_AOUT_UNDERSCORE,," mkspecs
/${PLATFORM}/qplatformdefs.h || die
225 export YACC
='byacc -d'
227 export LINK
="$(tc-getCXX)"
229 .
/configure
-sm -thread -stl -system-libjpeg -verbose -largefile \
230 -qt-imgfmt-{jpeg
,mng
,png
} -tablet -system-libmng \
231 -system-libpng -xft -platform ${PLATFORM} -xplatform \
232 ${PLATFORM} -xrender -prefix ${QTBASE} -libdir ${QTBASE}/$
(get_libdir
) \
233 -fast -no-sql-odbc ${myconf} -dlopen-opengl || die
235 emake src-qmake src-moc sub-src || die
237 export DYLD_LIBRARY_PATH
="${S}/lib:/usr/X11R6/lib:${DYLD_LIBRARY_PATH}"
238 export LD_LIBRARY_PATH
="${S}/lib:${LD_LIBRARY_PATH}"
240 emake sub-tools || die
242 if use examples
; then
243 emake sub-tutorial sub-examples || die
246 # Make the msg2qm utility (not made by default)
251 # Make the qembed utility (not made by default)
262 dobin tools
/msg2qm
/msg2qm
263 dobin tools
/qembed
/qembed
266 if use ppc-macos
; then
267 # dolib is broken on BSD because of missing readlink(1)
268 dodir
${QTBASE}/$
(get_libdir
)
269 cp -fR lib
/*.
{dylib
,la
,a
} ${D}/${QTBASE}/$
(get_libdir
) || die
271 cd ${D}/${QTBASE}/$
(get_libdir
)
272 for lib
in libqt-mt
* ; do
273 ln -s ${lib} ${lib/-mt/}
276 dolib.so lib
/lib
{editor
,qassistantclient
,designercore
}.a
277 dolib.so lib
/libqt-mt.la
278 dolib.so lib
/libqt-mt.so.
${PV} lib
/libqui.so
.1.0.0
279 cd ${D}/${QTBASE}/$
(get_libdir
)
281 for x
in libqui.so
; do
282 ln -s $x.1.0.0 $x.1.0
287 # version symlinks - 3.3.5->3.3->3->.so
288 ln -s libqt-mt.so.
${PV} libqt-mt.so
.3.3
289 ln -s libqt-mt.so
.3.3 libqt-mt.so
.3
290 ln -s libqt-mt.so
.3 libqt-mt.so
292 # libqt -> libqt-mt symlinks
293 ln -s libqt-mt.so.
${PV} libqt.so.
${PV}
294 ln -s libqt-mt.so
.3.3 libqt.so
.3.3
295 ln -s libqt-mt.so
.3 libqt.so
.3
296 ln -s libqt-mt.so libqt.so
301 local plugins
=$
(find plugins
-name "lib*.so" -print)
302 for x
in ${plugins}; do
303 exeinto
${QTBASE}/$
(dirname ${x})
307 # Past this point just needs to be done once
308 is_final_abi ||
return 0
312 dodir
${QTBASE}/include
/private
313 cp include
/* ${D}/${QTBASE}/include
/
314 cp include
/private
/* ${D}/${QTBASE}/include
/private
/
317 sed -i -e "s:${S}:${QTBASE}:g" ${S}/lib/*.prl
318 insinto ${QTBASE}/$(get_libdir)
322 insinto ${QTBASE}/$(get_libdir)/pkgconfig
325 # List all the multilib libdirs
327 for libdir in $(get_all_libdirs); do
328 libdirs="${libdirs}:${QTBASE}/${libdir}"
331 # environment variables
332 if use ppc-macos; then
333 cat <<EOF > ${T}/45qt3
335 ROOTPATH=${QTBASE}/bin
336 DYLD_LIBRARY_PATH=${libdirs:1}
337 QMAKESPEC=${PLATFORM}
338 MANPATH=${QTBASE}/doc/man
339 PKG_CONFIG_PATH=${QTBASE}/$(get_libdir)/pkgconfig
342 cat <<EOF > ${T}/45qt3
344 ROOTPATH=${QTBASE}/bin
346 QMAKESPEC=${PLATFORM}
347 MANPATH=${QTBASE}/doc/man
348 PKG_CONFIG_PATH=${QTBASE}/$(get_libdir)/pkgconfig
351 cat <<EOF > ${T}/50qtdir3
355 cat <<EOF > ${T}/50-qt3-revdep
356 SEARCH_DIRS="${QTBASE}"
359 insinto /etc/revdep-rebuild
360 doins ${T}/50-qt3-revdep
362 doenvd ${T}/45qt3 ${T}/50qtdir3
364 if [ "${SYMLINK_LIB}" = "yes" ]; then
365 dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) ${QTBASE}/lib
368 insinto ${QTBASE}/tools/designer
369 doins -r tools/designer/templates
372 doins -r translations
374 keepdir ${QTBASE}/etc/settings
381 if use examples; then
382 find ${S}/examples ${S}/tutorial -name Makefile | \
383 xargs sed -i -e "s
:${S}:${QTBASE}:g
"
385 cp -r ${S}/examples ${D}${QTBASE}/
386 cp -r ${S}/tutorial ${D}${QTBASE}/
390 insinto ${QTBASE}/mkspecs
391 doins -r ${S}/mkspecs/${PLATFORM}
393 sed -e "s
:${S}:${QTBASE}:g
" \
394 ${S}/.qmake.cache > ${D}${QTBASE}/.qmake.cache
396 dodoc FAQ README README-QT.TXT changes*
397 if use immqt || use immqt-bc ; then
398 dodoc ${S}/README.immodule
404 elog "After a rebuild of Qt
, it can happen that Qt plugins
(such as Qt
/KDE styles
,"
405 elog "or widgets
for the Qt designer
) are no longer recognized. If this situation
"
406 elog "occurs you should recompile the packages providing these plugins
,"
407 elog "and you should also
make sure that Qt and its plugins were compiled with the
"
408 elog "same version of gcc. Packages that may need to be rebuilt are
, for instance
,"
409 elog "kde-base
/kdelibs
, kde-base
/kdeartwork and kde-base
/kdeartwork-styles.
"
410 elog "See http
://doc.trolltech.com
/3.3/plugins-howto.html
for more infos.
"
413 if use qt-copy ; then
415 ewarn "Do NOT report bugs to Gentoo
's bugzilla when built with qt-copy!!!"