LZMA'd patch tarballs.
[gentoo-soor-overlay.git] / x11-libs / qt / qt-3.3.8-r4.ebuild
blobcbf08773eb3a9bf5154cc14e94a334798b4028bc
1 # Copyright 1999-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
5 # *** Please remember to update qt3.eclass when revbumping this ***
7 inherit eutils flag-o-matic toolchain-funcs
9 SRCTYPE="free"
10 QT_COPY_SNAP="1.1"
11 DESCRIPTION="The Qt toolkit is a comprehensive C++ application development framework."
12 HOMEPAGE="http://www.trolltech.com/"
14 RESTRICT="primaryuri"
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 )"
25 SLOT="3"
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="x11-libs/libXcursor
30 x11-libs/libXi
31 x11-libs/libXrandr
32 x11-libs/libSM
33 x11-proto/inputproto
34 x11-proto/xextproto
35 xinerama? ( x11-proto/xineramaproto x11-libs/libXinerama )
36 immqt? ( x11-proto/xineramaproto )
37 immqt-bc? ( x11-proto/xineramaproto )
38 virtual/xft
39 media-libs/libpng
40 media-libs/jpeg
41 >=media-libs/libmng-1.0.9
42 >=media-libs/freetype-2
43 sys-libs/zlib
44 nas? ( >=media-libs/nas-1.5 )
45 mysql? ( virtual/mysql )
46 firebird? ( dev-db/firebird )
47 opengl? ( virtual/opengl virtual/glu )
48 postgres? ( dev-db/libpq )
49 cups? ( net-print/cups )"
50 PDEPEND="odbc? ( ~dev-db/qt-unixODBC-$PV )"
52 S=${WORKDIR}/qt-x11-${SRCTYPE}-${PV}
54 QTBASE=/usr/qt/3
56 pkg_setup() {
57 if use immqt && use immqt-bc ; then
58 ewarn
59 ewarn "immqt and immqt-bc are exclusive. You cannot set both."
60 ewarn "Please specify either immqt or immqt-bc."
61 ewarn
62 die
63 elif use immqt ; then
64 ewarn
65 ewarn "You are going to compile binary imcompatible immodule for Qt. This means"
66 ewarn "you have to recompile everything depending on Qt after you install it."
67 ewarn "Be aware."
68 ewarn
71 export QTDIR=${S}
73 CXX=$(tc-getCXX)
74 if [[ ${CXX/g++/} != ${CXX} ]]; then
75 PLATCXX="g++"
76 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
77 PLATCXX="icc"
78 else
79 die "Unknown compiler ${CXX}."
82 case ${CHOST} in
83 *-freebsd*|*-dragonfly*)
84 PLATNAME="freebsd" ;;
85 *-openbsd*)
86 PLATNAME="openbsd" ;;
87 *-netbsd*)
88 PLATNAME="netbsd" ;;
89 *-darwin*)
90 PLATNAME="darwin" ;;
91 *-linux-*|*-linux)
92 PLATNAME="linux" ;;
94 die "Unknown CHOST, no platform choosed."
95 esac
97 # probably this should be '*-64' for 64bit archs
98 # in a fully multilib environment (no compatibility symlinks)
99 export PLATFORM="${PLATNAME}-${PLATCXX}"
102 src_unpack() {
103 unpack ${A}
104 cd ${S}
106 sed -i -e 's:read acceptance:acceptance=yes:' configure
108 # Do not link with -rpath. See bug #75181.
109 find ${S}/mkspecs -name qmake.conf | xargs \
110 sed -i -e 's:QMAKE_RPATH.*:QMAKE_RPATH =:'
112 # Patch for uic includehint errors (aseigo patch)
113 epatch ${FILESDIR}/${P}-uic-fix.patch
115 # Patch for mysql unload crash (Bug #171883)
116 epatch ${FILESDIR}/${P}-mysql-unload-crash.diff
118 # KDE related patches
119 epatch ${FILESDIR}/0001-dnd_optimization.patch
120 epatch ${FILESDIR}/0002-dnd_active_window_fix.patch
121 epatch ${FILESDIR}/0038-dragobject-dont-prefer-unknown.patch
122 epatch ${FILESDIR}/0044-qscrollview-windowactivate-fix.diff
123 epatch ${FILESDIR}/0047-fix-kmenu-widget.diff
124 epatch ${FILESDIR}/0048-qclipboard_hack_80072.patch
126 # possible rce, CVE-2007-3388
127 epatch ${FILESDIR}/0081-format-string-fixes.diff
129 # Bug #192472
130 epatch ${FILESDIR}/${P}-unicode-off-by-one.patch
132 # ulibc patch (bug #100246)
133 epatch ${FILESDIR}/qt-ulibc.patch
135 # xinerama patch: http://ktown.kde.org/~seli/xinerama/
136 epatch "${FILESDIR}/${P}-seli-xinerama.patch"
138 epatch ${FILESDIR}/utf8-bug-qt3.diff
140 # Visibility patch, apply only on GCC 4.1 and later for safety
141 # [[ $(gcc-major-version)$(gcc-minor-version) -ge 41 ]] && \
142 epatch "${FILESDIR}/${P}-visibility.patch"
144 if use immqt || use immqt-bc ; then
145 epatch ../${IMMQT_P}.diff
146 sh make-symlinks.sh || die "make symlinks failed"
147 EPATCH_EXCLUDE="0080_all_net-wm-sync-request.diff"
148 else
149 EPATCH_EXCLUDE="0080_all_net-wm-sync-request-immqt-fix.diff"
152 if use ppc-macos ; then
153 epatch "${FILESDIR}/${PN}-3.3.5-macos.patch"
156 # Apply QT Copy patches:
157 if use qt-copy ; then
158 EPATCH_MULTI_MSG="Applying the KDE Qt Copy patches ..." \
159 EPATCH_SOURCE="${WORKDIR}/qt-copy-${PV}-patches-${QT_COPY_SNAP}" EPATCH_SUFFIX="diff" epatch
162 # known working flags wrt #77623
163 use sparc && export CFLAGS="-O1" && export CXXFLAGS="${CFLAGS}"
164 # set c/xxflags and ldflags
165 strip-flags
166 append-flags -fno-strict-aliasing
168 if [[ $( gcc-fullversion ) == "3.4.6" && gcc-specs-ssp ]] ; then
169 ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
170 append-flags -fno-stack-protector
173 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
174 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
175 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
176 -e "s:\<QMAKE_CC\>.*=.*:QMAKE_CC=$(tc-getCC):" \
177 -e "s:\<QMAKE_CXX\>.*=.*:QMAKE_CXX=$(tc-getCXX):" \
178 -e "s:\<QMAKE_LINK\>.*=.*:QMAKE_LINK=$(tc-getCXX):" \
179 -e "s:\<QMAKE_LINK_SHLIB\>.*=.*:QMAKE_LINK_SHLIB=$(tc-getCXX):" \
180 ${S}/mkspecs/${PLATFORM}/qmake.conf || die
182 if [ $(get_libdir) != "lib" ] ; then
183 sed -i -e "s:/lib$:/$(get_libdir):" \
184 ${S}/mkspecs/${PLATFORM}/qmake.conf || die
188 src_compile() {
189 export SYSCONF=${D}${QTBASE}/etc/settings
191 # Let's just allow writing to these directories during Qt emerge
192 # as it makes Qt much happier.
193 addwrite "${QTBASE}/etc/settings"
194 addwrite "${HOME}/.qt"
196 [ $(get_libdir) != "lib" ] && myconf="${myconf} -L/usr/$(get_libdir)"
198 # unixODBC support is now a PDEPEND on dev-db/qt-unixODBC; see bug 14178.
199 use nas && myconf="${myconf} -system-nas-sound"
200 use nis && myconf="${myconf} -nis" || myconf="${myconf} -no-nis"
201 use gif && myconf="${myconf} -qt-gif" || myconf="${myconf} -no-gif"
202 use mysql && myconf="${myconf} -plugin-sql-mysql -I/usr/include/mysql -L/usr/$(get_libdir)/mysql" || myconf="${myconf} -no-sql-mysql"
203 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"
204 use firebird && myconf="${myconf} -plugin-sql-ibase -I/opt/firebird/include" || myconf="${myconf} -no-sql-ibase"
205 use sqlite && myconf="${myconf} -plugin-sql-sqlite" || myconf="${myconf} -no-sql-sqlite"
206 use cups && myconf="${myconf} -cups" || myconf="${myconf} -no-cups"
207 use opengl && myconf="${myconf} -enable-module=opengl" || myconf="${myconf} -disable-opengl"
208 use debug && myconf="${myconf} -debug" || myconf="${myconf} -release -no-g++-exceptions"
209 use xinerama && myconf="${myconf} -xinerama" || myconf="${myconf} -no-xinerama"
211 myconf="${myconf} -system-zlib"
213 use ipv6 && myconf="${myconf} -ipv6" || myconf="${myconf} -no-ipv6"
214 use immqt-bc && myconf="${myconf} -inputmethod"
215 use immqt && myconf="${myconf} -inputmethod -inputmethod-ext"
217 if use ppc-macos ; then
218 myconf="${myconf} -no-sql-ibase -no-sql-mysql -no-sql-psql -no-cups -lresolv -shared"
219 myconf="${myconf} -I/usr/X11R6/include -L/usr/X11R6/lib"
220 myconf="${myconf} -L${S}/lib -I${S}/include"
221 sed -i -e "s,#define QT_AOUT_UNDERSCORE,," mkspecs/${PLATFORM}/qplatformdefs.h || die
224 export YACC='byacc -d'
225 tc-export CC CXX
226 export LINK="$(tc-getCXX)"
228 ./configure -sm -thread -stl -system-libjpeg -verbose -largefile \
229 -qt-imgfmt-{jpeg,mng,png} -tablet -system-libmng \
230 -system-libpng -xft -platform ${PLATFORM} -xplatform \
231 ${PLATFORM} -xrender -prefix ${QTBASE} -libdir ${QTBASE}/$(get_libdir) \
232 -fast -no-sql-odbc ${myconf} -dlopen-opengl || die
234 emake src-qmake src-moc sub-src || die
236 export DYLD_LIBRARY_PATH="${S}/lib:/usr/X11R6/lib:${DYLD_LIBRARY_PATH}"
237 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
239 emake sub-tools || die
241 if use examples; then
242 emake sub-tutorial sub-examples || die
245 # Make the msg2qm utility (not made by default)
246 cd ${S}/tools/msg2qm
247 ../../bin/qmake
248 emake
250 # Make the qembed utility (not made by default)
251 cd ${S}/tools/qembed
252 ../../bin/qmake
253 emake
257 src_install() {
258 # binaries
259 into ${QTBASE}
260 dobin bin/*
261 dobin tools/msg2qm/msg2qm
262 dobin tools/qembed/qembed
264 # libraries
265 if use ppc-macos; then
266 # dolib is broken on BSD because of missing readlink(1)
267 dodir ${QTBASE}/$(get_libdir)
268 cp -fR lib/*.{dylib,la,a} ${D}/${QTBASE}/$(get_libdir) || die
270 cd ${D}/${QTBASE}/$(get_libdir)
271 for lib in libqt-mt* ; do
272 ln -s ${lib} ${lib/-mt/}
273 done
274 else
275 dolib.so lib/lib{editor,qassistantclient,designercore}.a
276 dolib.so lib/libqt-mt.la
277 dolib.so lib/libqt-mt.so.${PV} lib/libqui.so.1.0.0
278 cd ${D}/${QTBASE}/$(get_libdir)
280 for x in libqui.so ; do
281 ln -s $x.1.0.0 $x.1.0
282 ln -s $x.1.0 $x.1
283 ln -s $x.1 $x
284 done
286 # version symlinks - 3.3.5->3.3->3->.so
287 ln -s libqt-mt.so.${PV} libqt-mt.so.3.3
288 ln -s libqt-mt.so.3.3 libqt-mt.so.3
289 ln -s libqt-mt.so.3 libqt-mt.so
291 # libqt -> libqt-mt symlinks
292 ln -s libqt-mt.so.${PV} libqt.so.${PV}
293 ln -s libqt-mt.so.3.3 libqt.so.3.3
294 ln -s libqt-mt.so.3 libqt.so.3
295 ln -s libqt-mt.so libqt.so
298 # plugins
299 cd ${S}
300 local plugins=$(find plugins -name "lib*.so" -print)
301 for x in ${plugins}; do
302 exeinto ${QTBASE}/$(dirname ${x})
303 doexe ${x}
304 done
306 # Past this point just needs to be done once
307 is_final_abi || return 0
309 # includes
310 cd ${S}
311 dodir ${QTBASE}/include/private
312 cp include/* ${D}/${QTBASE}/include/
313 cp include/private/* ${D}/${QTBASE}/include/private/
315 # prl files
316 sed -i -e "s:${S}:${QTBASE}:g" ${S}/lib/*.prl
317 insinto ${QTBASE}/$(get_libdir)
318 doins ${S}/lib/*.prl
320 # pkg-config file
321 insinto ${QTBASE}/$(get_libdir)/pkgconfig
322 doins ${S}/lib/*.pc
324 # List all the multilib libdirs
325 local libdirs
326 for libdir in $(get_all_libdirs); do
327 libdirs="${libdirs}:${QTBASE}/${libdir}"
328 done
330 # environment variables
331 if use ppc-macos; then
332 cat <<EOF > ${T}/45qt3
333 PATH=${QTBASE}/bin
334 ROOTPATH=${QTBASE}/bin
335 DYLD_LIBRARY_PATH=${libdirs:1}
336 QMAKESPEC=${PLATFORM}
337 MANPATH=${QTBASE}/doc/man
338 PKG_CONFIG_PATH=${QTBASE}/$(get_libdir)/pkgconfig
340 else
341 cat <<EOF > ${T}/45qt3
342 PATH=${QTBASE}/bin
343 ROOTPATH=${QTBASE}/bin
344 LDPATH=${libdirs:1}
345 QMAKESPEC=${PLATFORM}
346 MANPATH=${QTBASE}/doc/man
347 PKG_CONFIG_PATH=${QTBASE}/$(get_libdir)/pkgconfig
350 cat <<EOF > ${T}/50qtdir3
351 QTDIR=${QTBASE}
354 cat <<EOF > ${T}/50-qt3-revdep
355 SEARCH_DIRS="${QTBASE}"
358 insinto /etc/revdep-rebuild
359 doins ${T}/50-qt3-revdep
361 doenvd ${T}/45qt3 ${T}/50qtdir3
363 if [ "${SYMLINK_LIB}" = "yes" ]; then
364 dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) ${QTBASE}/lib
367 insinto ${QTBASE}/tools/designer
368 doins -r tools/designer/templates
370 insinto ${QTBASE}
371 doins -r translations
373 keepdir ${QTBASE}/etc/settings
375 if use doc; then
376 insinto ${QTBASE}
377 doins -r ${S}/doc
380 if use examples; then
381 find ${S}/examples ${S}/tutorial -name Makefile | \
382 xargs sed -i -e "s:${S}:${QTBASE}:g"
384 cp -r ${S}/examples ${D}${QTBASE}/
385 cp -r ${S}/tutorial ${D}${QTBASE}/
388 # misc build reqs
389 insinto ${QTBASE}/mkspecs
390 doins -r ${S}/mkspecs/${PLATFORM}
392 sed -e "s:${S}:${QTBASE}:g" \
393 ${S}/.qmake.cache > ${D}${QTBASE}/.qmake.cache
395 dodoc FAQ README README-QT.TXT changes*
396 if use immqt || use immqt-bc ; then
397 dodoc ${S}/README.immodule
401 pkg_postinst() {
402 echo
403 elog "After a rebuild of Qt, it can happen that Qt plugins (such as Qt/KDE styles,"
404 elog "or widgets for the Qt designer) are no longer recognized. If this situation"
405 elog "occurs you should recompile the packages providing these plugins,"
406 elog "and you should also make sure that Qt and its plugins were compiled with the"
407 elog "same version of gcc. Packages that may need to be rebuilt are, for instance,"
408 elog "kde-base/kdelibs, kde-base/kdeartwork and kde-base/kdeartwork-styles."
409 elog "See http://doc.trolltech.com/3.3/plugins-howto.html for more infos."
410 echo
412 if use qt-copy ; then
413 echo
414 ewarn "Do NOT report bugs to Gentoo's bugzilla when built with qt-copy!!!"