commit:     59718fb00fe774f1918dd7263f016e6993dc99e5
Author:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 30 19:33:34 2016 +0000
Commit:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
CommitDate: Thu Dec  1 13:49:10 2016 +0000
URL:        https://gitweb.gentoo.org/proj/qt.git/commit/?id=59718fb0

qt5-build.eclass: introduce qt_use_disable_config

Similar to qt_use_disable_mod, this function helps avoid automagic dependencies.

 eclass/qt5-build.eclass | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/eclass/qt5-build.eclass b/eclass/qt5-build.eclass
index 9727ce7..d496ba0 100644
--- a/eclass/qt5-build.eclass
+++ b/eclass/qt5-build.eclass
@@ -388,6 +388,29 @@ qt_use_compile_test() {
        fi
 }
 
+# @FUNCTION: qt_use_disable_config
+# @USAGE: <flag> <config> <files...>
+# @DESCRIPTION:
+# <flag> is the name of a flag in IUSE.
+# <config> is the (lowercase) name of a Qt5 config entry.
+# <files...> is a list of one or more qmake project files.
+#
+# This function patches <files> to treat <config> as disabled
+# when <flag> is disabled, otherwise it does nothing.
+# This can be useful to avoid an automagic dependency when the config entry
+# is enabled on the system but the corresponding USE flag is disabled.
+qt_use_disable_config() {
+       [[ $# -ge 3 ]] || die "${FUNCNAME}() requires at least three arguments"
+
+       local flag=$1
+       local config=$2
+       shift 2
+
+       if ! use "${flag}"; then
+               echo "$@" | xargs sed -i -e "s/qtConfig(${config})/false/g" || 
die
+       fi
+}
+
 # @FUNCTION: qt_use_disable_mod
 # @USAGE: <flag> <module> <files...>
 # @DESCRIPTION:

Reply via email to