1 |
commit: a8e2d266582bcc9c91e3a45ac4aa41859a3f4a13 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Dec 29 15:38:48 2021 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Dec 29 18:44:22 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=a8e2d266 |
7 |
|
8 |
ecm.eclass: Introduce ecm_punt_kf_module and ecm_punt_qt_module |
9 |
|
10 |
Upstream has begun replacing |
11 |
|
12 |
find_package(Qt5 ...) |
13 |
|
14 |
with |
15 |
|
16 |
find_package(Qt${QT_MAJOR_VERSION}) ...) |
17 |
|
18 |
for optional build with Qt6 - this breaks existing ecm_punt_bogus_dep() |
19 |
regexps. There is no known usage of ecm_punt_bogus_dep with anything |
20 |
else than Qt5 or KF5, so simply replace it with two public functions |
21 |
fixed on Qt* and KF* module removal. |
22 |
|
23 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
24 |
|
25 |
eclass/ecm.eclass | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ |
26 |
1 file changed, 50 insertions(+) |
27 |
|
28 |
diff --git a/eclass/ecm.eclass b/eclass/ecm.eclass |
29 |
index baece9e6e6..9903eeef3e 100644 |
30 |
--- a/eclass/ecm.eclass |
31 |
+++ b/eclass/ecm.eclass |
32 |
@@ -312,6 +312,56 @@ _ecm_strip_handbook_translations() { |
33 |
done |
34 |
} |
35 |
|
36 |
+# @FUNCTION: _ecm_punt_kfqt_module |
37 |
+# @USAGE: <prefix> <dependency> |
38 |
+# @INTERNAL |
39 |
+# @DESCRIPTION: |
40 |
+# Removes a specified dependency from a find_package call with multiple |
41 |
+# components. |
42 |
+_ecm_punt_kfqt_module() { |
43 |
+ local prefix=${1} |
44 |
+ local dep=${2} |
45 |
+ |
46 |
+ [[ ! -e "CMakeLists.txt" ]] && return |
47 |
+ |
48 |
+ # FIXME: dep=WebKit will result in 'Widgets' over 'WebKitWidgets' (no regression) |
49 |
+ pcregrep -Mni "(?s)find_package\s*\(\s*${prefix}(\d+|\\$\{\w*\})[^)]*?${dep}.*?\)" \ |
50 |
+ CMakeLists.txt > "${T}/bogus${dep}" |
51 |
+ |
52 |
+ # pcregrep returns non-zero on no matches/error |
53 |
+ [[ $? -ne 0 ]] && return |
54 |
+ |
55 |
+ local length=$(wc -l "${T}/bogus${dep}" | cut -d " " -f 1) |
56 |
+ local first=$(head -n 1 "${T}/bogus${dep}" | cut -d ":" -f 1) |
57 |
+ local last=$(( length + first - 1)) |
58 |
+ |
59 |
+ # FIXME: may leave empty find_package($prefix) behind (no regression, non-trivial) |
60 |
+ sed -e "${first},${last}s/${dep}//" -i CMakeLists.txt || die |
61 |
+ |
62 |
+ if [[ ${length} -eq 1 ]] ; then |
63 |
+ sed -e "/find_package\s*(\s*${prefix}\([0-9]|\${[A-Z0-9_]*}\)\(\s\+\(REQUIRED\|CONFIG\|COMPONENTS\|\${[A-Z0-9_]*}\)\)\+\s*)/Is/^/# removed by ecm.eclass - /" \ |
64 |
+ -i CMakeLists.txt || die |
65 |
+ fi |
66 |
+} |
67 |
+ |
68 |
+# @FUNCTION: ecm_punt_kf_module |
69 |
+# @USAGE: <modulename> |
70 |
+# @DESCRIPTION: |
71 |
+# Removes a Frameworks (KF - matching any single-digit version) |
72 |
+# module from a find_package call with multiple components. |
73 |
+ecm_punt_kf_module() { |
74 |
+ _ecm_punt_kfqt_module kf ${1} |
75 |
+} |
76 |
+ |
77 |
+# @FUNCTION: ecm_punt_qt_module |
78 |
+# @USAGE: <modulename> |
79 |
+# @DESCRIPTION: |
80 |
+# Removes a Qt (matching any single-digit version) module from a |
81 |
+# find_package call with multiple components. |
82 |
+ecm_punt_qt_module() { |
83 |
+ _ecm_punt_kfqt_module qt ${1} |
84 |
+} |
85 |
+ |
86 |
# @FUNCTION: ecm_punt_bogus_dep |
87 |
# @USAGE: <prefix> <dependency> |
88 |
# @DESCRIPTION: |