Add lzma-utils to DEPEND
[gentoo-soor-overlay.git] / x11-libs / qt / qt-3.3.8-r4.ebuild
blobbaf1e19e369c0638b07315380d4525e04e4c0c07
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="app-arch/lzma-utils
30 x11-libs/libXcursor
31 x11-libs/libXi
32 x11-libs/libXrandr
33 x11-libs/libSM
34 x11-proto/inputproto
35 x11-proto/xextproto
36 xinerama? ( x11-proto/xineramaproto x11-libs/libXinerama )
37 immqt? ( x11-proto/xineramaproto )
38 immqt-bc? ( x11-proto/xineramaproto )
39 virtual/xft
40 media-libs/libpng
41 media-libs/jpeg
42 >=media-libs/libmng-1.0.9
43 >=media-libs/freetype-2
44 sys-libs/zlib
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}
55 QTBASE=/usr/qt/3
57 pkg_setup() {
58 if use immqt && use immqt-bc ; then
59 ewarn
60 ewarn "immqt and immqt-bc are exclusive. You cannot set both."
61 ewarn "Please specify either immqt or immqt-bc."
62 ewarn
63 die
64 elif use immqt ; then
65 ewarn
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."
68 ewarn "Be aware."
69 ewarn
72 export QTDIR=${S}
74 CXX=$(tc-getCXX)
75 if [[ ${CXX/g++/} != ${CXX} ]]; then
76 PLATCXX="g++"
77 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
78 PLATCXX="icc"
79 else
80 die "Unknown compiler ${CXX}."
83 case ${CHOST} in
84 *-freebsd*|*-dragonfly*)
85 PLATNAME="freebsd" ;;
86 *-openbsd*)
87 PLATNAME="openbsd" ;;
88 *-netbsd*)
89 PLATNAME="netbsd" ;;
90 *-darwin*)
91 PLATNAME="darwin" ;;
92 *-linux-*|*-linux)
93 PLATNAME="linux" ;;
95 die "Unknown CHOST, no platform choosed."
96 esac
98 # probably this should be '*-64' for 64bit archs
99 # in a fully multilib environment (no compatibility symlinks)
100 export PLATFORM="${PLATNAME}-${PLATCXX}"
103 src_unpack() {
104 unpack ${A}
105 cd ${S}
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
130 # Bug #192472
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"
149 else
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
166 strip-flags
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
189 src_compile() {
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'
226 tc-export CC CXX
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)
247 cd ${S}/tools/msg2qm
248 ../../bin/qmake
249 emake
251 # Make the qembed utility (not made by default)
252 cd ${S}/tools/qembed
253 ../../bin/qmake
254 emake
258 src_install() {
259 # binaries
260 into ${QTBASE}
261 dobin bin/*
262 dobin tools/msg2qm/msg2qm
263 dobin tools/qembed/qembed
265 # libraries
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/}
274 done
275 else
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
283 ln -s $x.1.0 $x.1
284 ln -s $x.1 $x
285 done
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
299 # plugins
300 cd ${S}
301 local plugins=$(find plugins -name "lib*.so" -print)
302 for x in ${plugins}; do
303 exeinto ${QTBASE}/$(dirname ${x})
304 doexe ${x}
305 done
307 # Past this point just needs to be done once
308 is_final_abi || return 0
310 # includes
311 cd ${S}
312 dodir ${QTBASE}/include/private
313 cp include/* ${D}/${QTBASE}/include/
314 cp include/private/* ${D}/${QTBASE}/include/private/
316 # prl files
317 sed -i -e "s:${S}:${QTBASE}:g" ${S}/lib/*.prl
318 insinto ${QTBASE}/$(get_libdir)
319 doins ${S}/lib/*.prl
321 # pkg-config file
322 insinto ${QTBASE}/$(get_libdir)/pkgconfig
323 doins ${S}/lib/*.pc
325 # List all the multilib libdirs
326 local libdirs
327 for libdir in $(get_all_libdirs); do
328 libdirs="${libdirs}:${QTBASE}/${libdir}"
329 done
331 # environment variables
332 if use ppc-macos; then
333 cat <<EOF > ${T}/45qt3
334 PATH=${QTBASE}/bin
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
341 else
342 cat <<EOF > ${T}/45qt3
343 PATH=${QTBASE}/bin
344 ROOTPATH=${QTBASE}/bin
345 LDPATH=${libdirs:1}
346 QMAKESPEC=${PLATFORM}
347 MANPATH=${QTBASE}/doc/man
348 PKG_CONFIG_PATH=${QTBASE}/$(get_libdir)/pkgconfig
351 cat <<EOF > ${T}/50qtdir3
352 QTDIR=${QTBASE}
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
371 insinto ${QTBASE}
372 doins -r translations
374 keepdir ${QTBASE}/etc/settings
376 if use doc; then
377 insinto ${QTBASE}
378 doins -r ${S}/doc
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}/
389 # misc build reqs
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
402 pkg_postinst() {
403 echo
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."
411 echo
413 if use qt-copy ; then
414 echo
415 ewarn "Do NOT report bugs to Gentoo's bugzilla when built with qt-copy!!!"