commit: c212b9fbb0bbcf288057539afdf4b2db9f5f806e Author: Davide Pesavento <pesa <AT> gentoo <DOT> org> AuthorDate: Mon Aug 4 23:13:21 2014 +0000 Commit: Davide Pesavento <pesa <AT> gentoo <DOT> org> CommitDate: Mon Aug 4 23:13:21 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/qt.git;a=commit;h=c212b9fb
[qt5-build.eclass] Introduce qt_use_compile_test(). --- eclass/qt5-build.eclass | 49 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/eclass/qt5-build.eclass b/eclass/qt5-build.eclass index f64ab35..56ff905 100644 --- a/eclass/qt5-build.eclass +++ b/eclass/qt5-build.eclass @@ -292,22 +292,19 @@ qt5-build_src_install() { fi qt5_install_module_qconfigs - - # remove .la files since we are building only shared libraries prune_libtool_files } # @FUNCTION: qt5-build_pkg_postinst # @DESCRIPTION: -# Regenerate configuration, plus throw a message about possible -# breakages and proposed solutions. +# Regenerate configuration after installation or upgrade/downgrade. qt5-build_pkg_postinst() { qt5_regenerate_global_qconfigs } # @FUNCTION: qt5-build_pkg_postrm # @DESCRIPTION: -# Regenerate configuration when the package is completely removed. +# Regenerate configuration when a module is completely removed. qt5-build_pkg_postrm() { if [[ -z ${REPLACED_BY_VERSION} && ${PN} != qtcore ]]; then qt5_regenerate_global_qconfigs @@ -315,16 +312,40 @@ qt5-build_pkg_postrm() { } # @FUNCTION: qt_use -# @USAGE: <flag> [feature] [enableval] +# @USAGE: <flag> [feature] [enableopt] # @DESCRIPTION: -# This will echo "-${enableval}-${feature}" if <flag> is enabled, or -# "-no-${feature}" if it's disabled. If [feature] is not specified, -# <flag> will be used for that. If [enableval] is not specified, the -# "-${enableval}" prefix is omitted. +# <flag> is the name of a flag in IUSE. +# +# Echoes "-${enableopt}-${feature}" if <flag> is enabled, or "-no-${feature}" +# if it is disabled. If [feature] is not specified, it defaults to the value +# of <flag>. If [enableopt] is not specified, the whole "-${enableopt}" prefix +# is omitted. qt_use() { + [[ $# -ge 1 ]] || die "${FUNCNAME}() requires at least one argument" + use "$1" && echo "${3:+-$3}-${2:-$1}" || echo "-no-${2:-$1}" } +# @FUNCTION: qt_use_compile_test +# @USAGE: <flag> [config] +# @DESCRIPTION: +# <flag> is the name of a flag in IUSE. +# [config] is the argument of qtCompileTest, defaults to <flag>. +# +# This function is useful to disable optional dependencies that are checked +# at qmake-time using the qtCompileTest() function. If <flag> is disabled, +# the compile test is skipped and the dependency is assumed to be unavailable, +# i.e. the corresponding feature will be disabled. Note that all invocations +# of this function must happen before calling qt5-build_src_configure. +qt_use_compile_test() { + [[ $# -ge 1 ]] || die "${FUNCNAME}() requires at least one argument" + + if ! use "$1"; then + mkdir -p "${QT5_BUILD_DIR}" || die + echo "CONFIG += done_config_${2:-$1}" >> "${QT5_BUILD_DIR}"/.qmake.cache || die + fi +} + # @FUNCTION: qt_use_disable_mod # @USAGE: <flag> <module> <files...> # @DESCRIPTION: @@ -337,15 +358,15 @@ qt_use() { # This can be useful to avoid an automagic dependency when the module # is present on the system but the corresponding USE flag is disabled. qt_use_disable_mod() { - [[ $# -ge 3 ]] || die "${FUNCNAME}() requires at least 3 arguments" + [[ $# -ge 3 ]] || die "${FUNCNAME}() requires at least three arguments" local flag=$1 local module=$2 shift 2 - use "${flag}" && return - - echo "$@" | xargs sed -i -e "s/qtHaveModule(${module})/false/g" || die + if ! use "${flag}"; then + echo "$@" | xargs sed -i -e "s/qtHaveModule(${module})/false/g" || die + fi }