Introduce functions from -edge eclass. Use them for 4.7.0_beta2 ebuild for now
authorMarkos Chandras <hwoarang@gentoo.org>
Thu, 8 Jul 2010 15:45:01 +0000 (15:45 +0000)
committerMarkos Chandras <hwoarang@gentoo.org>
Thu, 8 Jul 2010 15:45:01 +0000 (15:45 +0000)
eclass/qt4-build.eclass

index c131d80b011c53616244632ab6e3281d538605c4..3a02a67ec797f4ead75c4fcc964e923b4910d8b7 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2009 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.76 2010/07/03 15:49:39 ayoy Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.77 2010/07/08 15:45:01 hwoarang Exp $
 
 # @ECLASS: qt4-build.eclass
 # @MAINTAINER:
@@ -162,13 +162,19 @@ qt4-build_src_unpack() {
 qt4-build_src_prepare() {
        setqtenv
        cd "${S}"
-
+       
        # fix qt 4.7 regression that skips -fvisibility=hidden
        if version_is_at_least "4.7.0_beta1"; then
                sed -e "s/^gcc|g++)/*gcc|*g++)/" \
                        -i config.tests/unix/fvisibility.test ||
                                die "visibility fixing sed failed"
        fi
+       # fix libx11 dependency on non X packages
+       if version_is_at_least "4.7.0_beta2"; then
+               local NOLIBX11PKG="qt-core qt-dbus qt-script qt-sql qt-test qt-xmlpatterns"
+               hasq ${PN} ${NOLIBX11PKG} && qt_nolibx11
+               [[ ${PN} == "qt-assistant" ]] && qt_assistant_cleanup
+       fi
 
        if use aqua; then
                # provide a proper macx-g++-64
@@ -751,4 +757,37 @@ qt_mkspecs_dir() {
        echo "${spec}"
 }
 
+# @FUNCTION: qt_assistant_cleanup
+# @RETURN: nothing
+# @DESCRIPTION:
+# Tries to clean up tools.pro for qt-assistant ebuilds
+# Meant to be called in src_prepare
+qt_assistant_cleanup() {
+       # different versions (and branches...) may need different handling,
+       # add a case if you need special handling
+       case "${MY_PV_EXTRA}" in
+               *kde-qt*)
+                       sed -e "/^[ \t]*porting/,/^[ \t]*win32.*activeqt$/d" \
+                               -e "/mac/,/^embedded.*makeqpf$/d" \
+                               -i tools/tools.pro || die "patching tools.pro failed"
+               ;;
+               *)
+                       sed -e "/^[ \t]*porting/,/^[ \t]*win32.*activeqt$/d" \
+                               -e "/mac/,/^embedded.*makeqpf$/d" \
+                               -e "s/^\([ \t]*pixeltool\) /\1 qdoc3 /" \
+                               -i tools/tools.pro || die "patching tools.pro failed"
+               ;;
+       esac
+}
+
+# @FUNCTION: qt_nolibx11
+# @RETURN: nothing
+# @DESCRIPTION:
+# Ignore X11 tests for packages that don't need X libraries installed
+qt_nolibx11() {
+       einfo "removing X11 check to allow X-less compilation"
+       sed -i "/unixtests\/compile.test.*config.tests\/x11\/xlib/,/fi$/d" "${S}"/configure ||
+               die "x11 check sed failed"
+}
+
 EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install src_test pkg_postrm pkg_postinst