summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2022-01-08 14:08:23 +0100
committerAndreas Sturmlechner <asturm@gentoo.org>2022-01-08 22:07:35 +0100
commita45df0bf254f811b5bb38a827eeb02a84985c1c3 (patch)
treecbf34f128667e30be0d997f04ed435be2c9c4b07 /eclass
parentpackage.mask: mask old spyder versions and dead plugins for removal (diff)
downloadgentoo-a45df0bf254f811b5bb38a827eeb02a84985c1c3.tar.gz
gentoo-a45df0bf254f811b5bb38a827eeb02a84985c1c3.tar.bz2
gentoo-a45df0bf254f811b5bb38a827eeb02a84985c1c3.zip
ecm.eclass: Introduce ecm_punt_kf_module and ecm_punt_qt_module
Upstream has begun replacing find_package(Qt5 ...) with find_package(Qt${QT_MAJOR_VERSION}) ...) for optional build with Qt6 - this breaks existing ecm_punt_bogus_dep() regexps. There is no known usage of ecm_punt_bogus_dep with anything else than Qt5 or KF5, so simply replace it with two public functions fixed on Qt* and KF* module removal. Also add '${dep}' info to 'removed by ecm.eclass' output. Replaces ecm_punt_bogus_dep(). Closes: https://bugs.gentoo.org/830729 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ecm.eclass51
1 files changed, 50 insertions, 1 deletions
diff --git a/eclass/ecm.eclass b/eclass/ecm.eclass
index baece9e6e637..e81ecd180cc2 100644
--- a/eclass/ecm.eclass
+++ b/eclass/ecm.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: ecm.eclass
@@ -312,6 +312,55 @@ _ecm_strip_handbook_translations() {
done
}
+# @FUNCTION: _ecm_punt_kfqt_module
+# @INTERNAL
+# @USAGE: <prefix> <dependency>
+# @DESCRIPTION:
+# Removes a specified dependency from a find_package call with multiple
+# components.
+_ecm_punt_kfqt_module() {
+ local prefix=${1}
+ local dep=${2}
+
+ [[ ! -e "CMakeLists.txt" ]] && return
+
+ # FIXME: dep=WebKit will result in 'Widgets' over 'WebKitWidgets' (no regression)
+ pcregrep -Mni "(?s)find_package\s*\(\s*${prefix}(\d+|\\$\{\w*\})[^)]*?${dep}.*?\)" \
+ CMakeLists.txt > "${T}/bogus${dep}"
+
+ # pcregrep returns non-zero on no matches/error
+ [[ $? -ne 0 ]] && return
+
+ 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} -eq 1 ]] ; then
+ sed -e "/find_package\s*(\s*${prefix}\([0-9]\|\${[A-Z0-9_]*}\)\(\s\+\(REQUIRED\|CONFIG\|COMPONENTS\|\${[A-Z0-9_]*}\)\)\+\s*)/Is/^/# '${dep}' removed by ecm.eclass - /" \
+ -i CMakeLists.txt || die
+ fi
+}
+
+# @FUNCTION: ecm_punt_kf_module
+# @USAGE: <modulename>
+# @DESCRIPTION:
+# Removes a Frameworks (KF - matching any single-digit version)
+# module from a find_package call with multiple components.
+ecm_punt_kf_module() {
+ _ecm_punt_kfqt_module kf ${1}
+}
+
+# @FUNCTION: ecm_punt_qt_module
+# @USAGE: <modulename>
+# @DESCRIPTION:
+# Removes a Qt (matching any single-digit version) module from a
+# find_package call with multiple components.
+ecm_punt_qt_module() {
+ _ecm_punt_kfqt_module qt ${1}
+}
+
# @FUNCTION: ecm_punt_bogus_dep
# @USAGE: <prefix> <dependency>
# @DESCRIPTION: