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