diff options
| author | Michael Palimaka <kensington@gentoo.org> | 2015-04-17 02:43:31 +1000 |
|---|---|---|
| committer | Michael Palimaka <kensington@gentoo.org> | 2015-04-17 02:47:26 +1000 |
| commit | 9633b33624bebab51dcd521b28dca614880e198f (patch) | |
| tree | 1c8d35ffc168a72dfec3f980d2e8abd9a6bbcf2c | |
| parent | 1e72df927b303c317979589c33b09e2d25c66ab5 (diff) | |
| download | kde-9633b33624bebab51dcd521b28dca614880e198f.tar.gz kde-9633b33624bebab51dcd521b28dca614880e198f.tar.bz2 kde-9633b33624bebab51dcd521b28dca614880e198f.zip | |
[eclass] Introduce KDE_PUNT_BOGUS_DEPS to control the new black magic.
| -rw-r--r-- | eclass/kde5-functions.eclass | 21 | ||||
| -rw-r--r-- | eclass/kde5.eclass | 21 |
2 files changed, 35 insertions, 7 deletions
diff --git a/eclass/kde5-functions.eclass b/eclass/kde5-functions.eclass index 648dff05e3e..d618368d7f0 100644 --- a/eclass/kde5-functions.eclass +++ b/eclass/kde5-functions.eclass @@ -210,11 +210,24 @@ get_kde_version() { fi } -# @FUNCTION: punt_bogus_deps +# @FUNCTION: punt_bogus_dep +# @USAGE: <prefix> <dependency> # @DESCRIPTION: -# Remove hard-coded upstream dependencies that are not correct. -punt_bogus_deps() { - sed -e "/find_package(Qt5 /s/ Test//" -i CMakeLists.txt || die +# Removes a specified dependency from a find_package call with multiple components. +punt_bogus_dep() { + local prefix=${1} + local dep=${2} + + pcregrep -Mn "(?s)find_package\(\s*${prefix}.[^)]*?${dep}.*?\)" CMakeLists.txt > "${T}/bogus${dep}" + local length=$(wc -l "${T}/bogus${dep}" | cut -d " " -f 1) + local first=$(head -n 1 "${T}/bogus${dep}" | cut -d ":" -f 1) + local last=$(( ${length} + ${first} - 1)) + + sed -e "${first},${last}s/${dep}//" -i CMakeLists.txt || die + + if [[ ${length} = 1 ]] ; then + sed -e "/find_package(\s*${prefix}\s*REQUIRED\s*COMPONENTS\s*)/d" -i CMakeLists.txt || die + fi } fi diff --git a/eclass/kde5.eclass b/eclass/kde5.eclass index 6755541fff2..2511ba86021 100644 --- a/eclass/kde5.eclass +++ b/eclass/kde5.eclass @@ -81,6 +81,13 @@ else : ${KDE_TEST:=false} fi +# @ECLASS-VARIABLE: KDE_PUNT_BOGUS_DEPS +# @DESCRIPTION: +# If set to "none", do nothing. +# For any other value, do black magic to make hardcoded-but-optional dependencies +# optional again. An upstream solution is preferable and this is a last resort. +: ${KDE_PUNT_BOGUS_DEPS:=none} + # @ECLASS-VARIABLE: KDE_SELINUX_MODULE # @DESCRIPTION: # If set to "none", do nothing. @@ -396,9 +403,17 @@ kde5_src_prepare() { fi fi - if [[ ${CATEGORY} = kde-plasma ]] && ! use_if_iuse test ; then - punt_bogus_deps - fi + case ${KDE_PUNT_BOGUS_DEPS} in + false) ;; + *) + if ! use_if_iuse test ; then + punt_bogus_dep Qt5 Test + fi + if ! use_if_iuse handbook ; then + punt_bogus_dep KF5 DocTools + fi + ;; + esac cmake-utils_src_prepare } |
