initial import
[gentoo-soor-overlay.git] / x11-libs / qt / qt-3.3.8-r4.ebuild
blob8f1d17a868c2646ee0ddacbbf32de1096be4c739
1 # Copyright 1999-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/x11-libs/qt/qt-3.3.8-r4.ebuild,v 1.3 2007/11/10 08:49:05 phreak Exp $
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="20080119"
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="ftp://ftp.trolltech.com/qt/source/qt-x11-${SRCTYPE}-${PV}.tar.gz
19 qt-copy? ( http://eruonen.serveblog.net/patches/qt-copy-${PV}-patches-${QT_COPY_SNAP}.tar.bz2 )
20 immqt? ( mirror://gentoo/${IMMQT_P}.diff.bz2 )
21 immqt-bc? ( mirror://gentoo/${IMMQT_P}.diff.bz2 )"
22 LICENSE="|| ( QPL-1.0 GPL-2 )"
24 SLOT="3"
25 KEYWORDS="alpha amd64 hppa ia64 ~mips ppc ppc64 sparc x86 ~x86-fbsd"
26 IUSE="cups debug doc examples firebird gif ipv6 mysql nas nis odbc opengl postgres qt-copy sqlite xinerama immqt immqt-bc"
28 DEPEND="x11-libs/libXcursor
29 x11-libs/libXi
30 x11-libs/libXrandr
31 x11-libs/libSM
32 x11-proto/inputproto
33 x11-proto/xextproto
34 xinerama? ( x11-proto/xineramaproto x11-libs/libXinerama )
35 immqt? ( x11-proto/xineramaproto )
36 immqt-bc? ( x11-proto/xineramaproto )
37 virtual/xft
38 media-libs/libpng
39 media-libs/jpeg
40 >=media-libs/libmng-1.0.9
41 >=media-libs/freetype-2
42 sys-libs/zlib
43 nas? ( >=media-libs/nas-1.5 )
44 mysql? ( virtual/mysql )
45 firebird? ( dev-db/firebird )
46 opengl? ( virtual/opengl virtual/glu )
47 postgres? ( dev-db/libpq )
48 cups? ( net-print/cups )"
49 PDEPEND="odbc? ( ~dev-db/qt-unixODBC-$PV )"
51 S=${WORKDIR}/qt-x11-${SRCTYPE}-${PV}
53 QTBASE=/usr/qt/3
55 pkg_setup() {
56 if use immqt && use immqt-bc ; then
57 ewarn
58 ewarn "immqt and immqt-bc are exclusive. You cannot set both."
59 ewarn "Please specify either immqt or immqt-bc."
60 ewarn
61 die
62 elif use immqt ; then
63 ewarn
64 ewarn "You are going to compile binary imcompatible immodule for Qt. This means"
65 ewarn "you have to recompile everything depending on Qt after you install it."
66 ewarn "Be aware."
67 ewarn
70 export QTDIR=${S}
72 CXX=$(tc-getCXX)
73 if [[ ${CXX/g++/} != ${CXX} ]]; then
74 PLATCXX="g++"
75 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
76 PLATCXX="icc"
77 else
78 die "Unknown compiler ${CXX}."
81 case ${CHOST} in
82 *-freebsd*|*-dragonfly*)
83 PLATNAME="freebsd" ;;
84 *-openbsd*)
85 PLATNAME="openbsd" ;;
86 *-netbsd*)
87 PLATNAME="netbsd" ;;
88 *-darwin*)
89 PLATNAME="darwin" ;;
90 *-linux-*|*-linux)
91 PLATNAME="linux" ;;
93 die "Unknown CHOST, no platform choosed."
94 esac
96 # probably this should be '*-64' for 64bit archs
97 # in a fully multilib environment (no compatibility symlinks)
98 export PLATFORM="${PLATNAME}-${PLATCXX}"
101 src_unpack() {
102 unpack ${A}
103 cd ${S}
105 sed -i -e 's:read acceptance:acceptance=yes:' configure
107 # Do not link with -rpath. See bug #75181.
108 find ${S}/mkspecs -name qmake.conf | xargs \
109 sed -i -e 's:QMAKE_RPATH.*:QMAKE_RPATH =:'
111 # Patch for uic includehint errors (aseigo patch)
112 epatch ${FILESDIR}/${P}-uic-fix.patch
114 # Patch for mysql unload crash (Bug #171883)
115 epatch ${FILESDIR}/${P}-mysql-unload-crash.diff
117 # KDE related patches
118 epatch ${FILESDIR}/0001-dnd_optimization.patch
119 epatch ${FILESDIR}/0002-dnd_active_window_fix.patch
120 epatch ${FILESDIR}/0038-dragobject-dont-prefer-unknown.patch
121 epatch ${FILESDIR}/0044-qscrollview-windowactivate-fix.diff
122 epatch ${FILESDIR}/0047-fix-kmenu-widget.diff
123 epatch ${FILESDIR}/0048-qclipboard_hack_80072.patch
125 # possible rce, CVE-2007-3388
126 epatch ${FILESDIR}/0081-format-string-fixes.diff
128 # Bug #192472
129 epatch ${FILESDIR}/${P}-unicode-off-by-one.patch
131 # ulibc patch (bug #100246)
132 epatch ${FILESDIR}/qt-ulibc.patch
134 # xinerama patch: http://ktown.kde.org/~seli/xinerama/
135 epatch "${FILESDIR}/${P}-seli-xinerama.patch"
137 epatch ${FILESDIR}/utf8-bug-qt3.diff
139 # Visibility patch, apply only on GCC 4.1 and later for safety
140 # [[ $(gcc-major-version)$(gcc-minor-version) -ge 41 ]] && \
141 epatch "${FILESDIR}/${P}-visibility.patch"
143 if use immqt || use immqt-bc ; then
144 epatch ../${IMMQT_P}.diff
145 sh make-symlinks.sh || die "make symlinks failed"
146 EPATCH_EXCLUDE="0080_all_net-wm-sync-request.diff"
147 else
148 EPATCH_EXCLUDE="0080_all_net-wm-sync-request-immqt-fix.diff"
151 if use ppc-macos ; then
152 epatch "${FILESDIR}/${PN}-3.3.5-macos.patch"
155 # Apply QT Copy patches:
156 if use qt-copy ; then
157 EPATCH_MULTI_MSG="Applying the KDE Qt Copy patches ..." \
158 EPATCH_SOURCE="${WORKDIR}/qt-copy-${PV}-patches-${QT_COPY_SNAP}" EPATCH_SUFFIX="diff" epatch
161 # known working flags wrt #77623
162 use sparc && export CFLAGS="-O1" && export CXXFLAGS="${CFLAGS}"
163 # set c/xxflags and ldflags
164 strip-flags
165 append-flags -fno-strict-aliasing
167 if [[ $( gcc-fullversion ) == "3.4.6" && gcc-specs-ssp ]] ; then
168 ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
169 append-flags -fno-stack-protector
172 sed -i -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
173 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
174 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
175 -e "s:\<QMAKE_CC\>.*=.*:QMAKE_CC=$(tc-getCC):" \
176 -e "s:\<QMAKE_CXX\>.*=.*:QMAKE_CXX=$(tc-getCXX):" \
177 -e "s:\<QMAKE_LINK\>.*=.*:QMAKE_LINK=$(tc-getCXX):" \
178 -e "s:\<QMAKE_LINK_SHLIB\>.*=.*:QMAKE_LINK_SHLIB=$(tc-getCXX):" \
179 ${S}/mkspecs/${PLATFORM}/qmake.conf || die
181 if [ $(get_libdir) != "lib" ] ; then
182 sed -i -e "s:/lib$:/$(get_libdir):" \
183 ${S}/mkspecs/${PLATFORM}/qmake.conf || die
187 src_compile() {
188 export SYSCONF=${D}${QTBASE}/etc/settings
190 # Let's just allow writing to these directories during Qt emerge
191 # as it makes Qt much happier.
192 addwrite "${QTBASE}/etc/settings"
193 addwrite "${HOME}/.qt"
195 [ $(get_libdir) != "lib" ] && myconf="${myconf} -L/usr/$(get_libdir)"
197 # unixODBC support is now a PDEPEND on dev-db/qt-unixODBC; see bug 14178.
198 use nas && myconf="${myconf} -system-nas-sound"
199 use nis && myconf="${myconf} -nis" || myconf="${myconf} -no-nis"
200 use gif && myconf="${myconf} -qt-gif" || myconf="${myconf} -no-gif"
201 use mysql && myconf="${myconf} -plugin-sql-mysql -I/usr/include/mysql -L/usr/$(get_libdir)/mysql" || myconf="${myconf} -no-sql-mysql"
202 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"
203 use firebird && myconf="${myconf} -plugin-sql-ibase -I/opt/firebird/include" || myconf="${myconf} -no-sql-ibase"
204 use sqlite && myconf="${myconf} -plugin-sql-sqlite" || myconf="${myconf} -no-sql-sqlite"
205 use cups && myconf="${myconf} -cups" || myconf="${myconf} -no-cups"
206 use opengl && myconf="${myconf} -enable-module=opengl" || myconf="${myconf} -disable-opengl"
207 use debug && myconf="${myconf} -debug" || myconf="${myconf} -release -no-g++-exceptions"
208 use xinerama && myconf="${myconf} -xinerama" || myconf="${myconf} -no-xinerama"
210 myconf="${myconf} -system-zlib"
212 use ipv6 && myconf="${myconf} -ipv6" || myconf="${myconf} -no-ipv6"
213 use immqt-bc && myconf="${myconf} -inputmethod"
214 use immqt && myconf="${myconf} -inputmethod -inputmethod-ext"
216 if use ppc-macos ; then
217 myconf="${myconf} -no-sql-ibase -no-sql-mysql -no-sql-psql -no-cups -lresolv -shared"
218 myconf="${myconf} -I/usr/X11R6/include -L/usr/X11R6/lib"
219 myconf="${myconf} -L${S}/lib -I${S}/include"
220 sed -i -e "s,#define QT_AOUT_UNDERSCORE,," mkspecs/${PLATFORM}/qplatformdefs.h || die
223 export YACC='byacc -d'
224 tc-export CC CXX
225 export LINK="$(tc-getCXX)"
227 ./configure -sm -thread -stl -system-libjpeg -verbose -largefile \
228 -qt-imgfmt-{jpeg,mng,png} -tablet -system-libmng \
229 -system-libpng -xft -platform ${PLATFORM} -xplatform \
230 ${PLATFORM} -xrender -prefix ${QTBASE} -libdir ${QTBASE}/$(get_libdir) \
231 -fast -no-sql-odbc ${myconf} -dlopen-opengl || die
233 emake src-qmake src-moc sub-src || die
235 export DYLD_LIBRARY_PATH="${S}/lib:/usr/X11R6/lib:${DYLD_LIBRARY_PATH}"
236 export LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
238 emake sub-tools || die
240 if use examples; then
241 emake sub-tutorial sub-examples || die
244 # Make the msg2qm utility (not made by default)
245 cd ${S}/tools/msg2qm
246 ../../bin/qmake
247 emake
249 # Make the qembed utility (not made by default)
250 cd ${S}/tools/qembed
251 ../../bin/qmake
252 emake
256 src_install() {
257 # binaries
258 into ${QTBASE}
259 dobin bin/*
260 dobin tools/msg2qm/msg2qm
261 dobin tools/qembed/qembed
263 # libraries
264 if use ppc-macos; then
265 # dolib is broken on BSD because of missing readlink(1)
266 dodir ${QTBASE}/$(get_libdir)
267 cp -fR lib/*.{dylib,la,a} ${D}/${QTBASE}/$(get_libdir) || die
269 cd ${D}/${QTBASE}/$(get_libdir)
270 for lib in libqt-mt* ; do
271 ln -s ${lib} ${lib/-mt/}
272 done
273 else
274 dolib.so lib/lib{editor,qassistantclient,designercore}.a
275 dolib.so lib/libqt-mt.la
276 dolib.so lib/libqt-mt.so.${PV} lib/libqui.so.1.0.0
277 cd ${D}/${QTBASE}/$(get_libdir)
279 for x in libqui.so ; do
280 ln -s $x.1.0.0 $x.1.0
281 ln -s $x.1.0 $x.1
282 ln -s $x.1 $x
283 done
285 # version symlinks - 3.3.5->3.3->3->.so
286 ln -s libqt-mt.so.${PV} libqt-mt.so.3.3
287 ln -s libqt-mt.so.3.3 libqt-mt.so.3
288 ln -s libqt-mt.so.3 libqt-mt.so
290 # libqt -> libqt-mt symlinks
291 ln -s libqt-mt.so.${PV} libqt.so.${PV}
292 ln -s libqt-mt.so.3.3 libqt.so.3.3
293 ln -s libqt-mt.so.3 libqt.so.3
294 ln -s libqt-mt.so libqt.so
297 # plugins
298 cd ${S}
299 local plugins=$(find plugins -name "lib*.so" -print)
300 for x in ${plugins}; do
301 exeinto ${QTBASE}/$(dirname ${x})
302 doexe ${x}
303 done
305 # Past this point just needs to be done once
306 is_final_abi || return 0
308 # includes
309 cd ${S}
310 dodir ${QTBASE}/include/private
311 cp include/* ${D}/${QTBASE}/include/
312 cp include/private/* ${D}/${QTBASE}/include/private/
314 # prl files
315 sed -i -e "s:${S}:${QTBASE}:g" ${S}/lib/*.prl
316 insinto ${QTBASE}/$(get_libdir)
317 doins ${S}/lib/*.prl
319 # pkg-config file
320 insinto ${QTBASE}/$(get_libdir)/pkgconfig
321 doins ${S}/lib/*.pc
323 # List all the multilib libdirs
324 local libdirs
325 for libdir in $(get_all_libdirs); do
326 libdirs="${libdirs}:${QTBASE}/${libdir}"
327 done
329 # environment variables
330 if use ppc-macos; then
331 cat <<EOF > ${T}/45qt3
332 PATH=${QTBASE}/bin
333 ROOTPATH=${QTBASE}/bin
334 DYLD_LIBRARY_PATH=${libdirs:1}
335 QMAKESPEC=${PLATFORM}
336 MANPATH=${QTBASE}/doc/man
337 PKG_CONFIG_PATH=${QTBASE}/$(get_libdir)/pkgconfig
339 else
340 cat <<EOF > ${T}/45qt3
341 PATH=${QTBASE}/bin
342 ROOTPATH=${QTBASE}/bin
343 LDPATH=${libdirs:1}
344 QMAKESPEC=${PLATFORM}
345 MANPATH=${QTBASE}/doc/man
346 PKG_CONFIG_PATH=${QTBASE}/$(get_libdir)/pkgconfig
349 cat <<EOF > ${T}/50qtdir3
350 QTDIR=${QTBASE}
353 cat <<EOF > ${T}/50-qt3-revdep
354 SEARCH_DIRS="${QTBASE}"
357 insinto /etc/revdep-rebuild
358 doins ${T}/50-qt3-revdep
360 doenvd ${T}/45qt3 ${T}/50qtdir3
362 if [ "${SYMLINK_LIB}" = "yes" ]; then
363 dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) ${QTBASE}/lib
366 insinto ${QTBASE}/tools/designer
367 doins -r tools/designer/templates
369 insinto ${QTBASE}
370 doins -r translations
372 keepdir ${QTBASE}/etc/settings
374 if use doc; then
375 insinto ${QTBASE}
376 doins -r ${S}/doc
379 if use examples; then
380 find ${S}/examples ${S}/tutorial -name Makefile | \
381 xargs sed -i -e "s:${S}:${QTBASE}:g"
383 cp -r ${S}/examples ${D}${QTBASE}/
384 cp -r ${S}/tutorial ${D}${QTBASE}/
387 # misc build reqs
388 insinto ${QTBASE}/mkspecs
389 doins -r ${S}/mkspecs/${PLATFORM}
391 sed -e "s:${S}:${QTBASE}:g" \
392 ${S}/.qmake.cache > ${D}${QTBASE}/.qmake.cache
394 dodoc FAQ README README-QT.TXT changes*
395 if use immqt || use immqt-bc ; then
396 dodoc ${S}/README.immodule
400 pkg_postinst() {
401 echo
402 elog "After a rebuild of Qt, it can happen that Qt plugins (such as Qt/KDE styles,"
403 elog "or widgets for the Qt designer) are no longer recognized. If this situation"
404 elog "occurs you should recompile the packages providing these plugins,"
405 elog "and you should also make sure that Qt and its plugins were compiled with the"
406 elog "same version of gcc. Packages that may need to be rebuilt are, for instance,"
407 elog "kde-base/kdelibs, kde-base/kdeartwork and kde-base/kdeartwork-styles."
408 elog "See http://doc.trolltech.com/3.3/plugins-howto.html for more infos."
409 echo
411 if use qt-copy ; then
412 echo
413 ewarn "Do NOT report bugs to Gentoo's bugzilla when built with qt-copy!!!"