1 |
commit: d42748a60b895a504f7f9fec1cf511a7f31ccd81 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Nov 12 02:27:26 2019 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Dec 24 20:40:47 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d42748a6 |
7 |
|
8 |
kde5.eclass: Inherit ecm.eclass and drop moved functions/vars |
9 |
|
10 |
Functions moved to ecm: |
11 |
- All phase functions so far exported by kde5 |
12 |
|
13 |
Variables moved to ecm: |
14 |
- ECM_KDEINSTALLDIRS |
15 |
- KDE_DEBUG (-> ECM_DEBUG) |
16 |
- KDE_DESIGNERPLUGIN (-> split into ECM_DESIGNERPLUGIN, KDE_DESIGNERPLUGIN) |
17 |
- KDE_EXAMPLES (-> ECM_EXAMPLES) |
18 |
- KDE_HANDBOOK (-> ECM_HANDBOOK) |
19 |
- KDE_DOC_DIR (-> ECM_HANDBOOK_DIR) |
20 |
- KDE_PO_DIRS (-> ECM_PO_DIRS) |
21 |
- KDE_QTHELP (-> ECM_QTHELP) |
22 |
- KDE_TEST (-> ECM_TEST) |
23 |
|
24 |
Variables deprecated: |
25 |
- KDE_AUTODEPS (re-use as a switch to inherit ecm or cmake-utils) |
26 |
|
27 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
28 |
|
29 |
eclass/kde5.eclass | 328 ++++++++++------------------------------------------- |
30 |
1 file changed, 61 insertions(+), 267 deletions(-) |
31 |
|
32 |
diff --git a/eclass/kde5.eclass b/eclass/kde5.eclass |
33 |
index ef45ba420d7..91435167ac3 100644 |
34 |
--- a/eclass/kde5.eclass |
35 |
+++ b/eclass/kde5.eclass |
36 |
@@ -16,8 +16,9 @@ |
37 |
# This eclass unconditionally inherits kde5-functions.eclass and all its public |
38 |
# functions and variables may be considered as part of this eclass's API. |
39 |
# |
40 |
-# This eclass unconditionally inherits kde.org.eclass and cmake-utils.eclass |
41 |
-# and all their public variables and helper functions (not phase functions) may |
42 |
+# This eclass unconditionally inherits kde.org.eclass and either ecm.eclass if |
43 |
+# KDE_AUTODEPS=true (default) or cmake-utils.eclass if KDE_AUTODEPS=false. |
44 |
+# All their public variables and helper functions (not phase functions) may |
45 |
# be considered as part of this eclass's API. |
46 |
# |
47 |
# This eclass's phase functions are not intended to be mixed and matched, so if |
48 |
@@ -32,27 +33,7 @@ if [[ -z ${KDE_ORG_NAME} ]]; then |
49 |
KDE_ORG_NAME=${KMNAME:=$PN} |
50 |
fi |
51 |
|
52 |
-# @ECLASS-VARIABLE: VIRTUALX_REQUIRED |
53 |
-# @DESCRIPTION: |
54 |
-# For proper description see virtualx.eclass manpage. |
55 |
-# Here we redefine default value to be manual, if your package needs virtualx |
56 |
-# for tests you should proceed with setting VIRTUALX_REQUIRED=test. |
57 |
-: ${VIRTUALX_REQUIRED:=manual} |
58 |
- |
59 |
-inherit cmake-utils flag-o-matic kde.org kde5-functions virtualx xdg |
60 |
- |
61 |
-if [[ -v KDE_GCC_MINIMAL ]]; then |
62 |
- EXPORT_FUNCTIONS pkg_pretend |
63 |
-fi |
64 |
- |
65 |
-EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm |
66 |
- |
67 |
-# @ECLASS-VARIABLE: ECM_KDEINSTALLDIRS |
68 |
-# @DESCRIPTION: |
69 |
-# If set to "false", do nothing. |
70 |
-# For any other value, assume the package is using KDEInstallDirs macro and switch |
71 |
-# KDE_INSTALL_USE_QT_SYS_PATHS to ON. |
72 |
-: ${ECM_KDEINSTALLDIRS:=true} |
73 |
+inherit kde.org kde5-functions xdg |
74 |
|
75 |
# @ECLASS-VARIABLE: KDE_AUTODEPS |
76 |
# @DESCRIPTION: |
77 |
@@ -173,75 +154,31 @@ case ${KDE_SUBSLOT} in |
78 |
esac |
79 |
|
80 |
case ${KDE_AUTODEPS} in |
81 |
- false) ;; |
82 |
+ false) |
83 |
+ inherit cmake-utils |
84 |
+ ;; |
85 |
*) |
86 |
- BDEPEND+=" $(add_frameworks_dep extra-cmake-modules)" |
87 |
- RDEPEND+=" >=kde-frameworks/kf-env-4" |
88 |
- COMMONDEPEND+=" $(add_qt_dep qtcore)" |
89 |
- |
90 |
# all packages need breeze/oxygen icons for basic iconset, bug #564838 |
91 |
if [[ ${PN} != breeze-icons && ${PN} != oxygen-icons ]]; then |
92 |
- RDEPEND+=" || ( $(add_frameworks_dep breeze-icons) kde-frameworks/oxygen-icons:* )" |
93 |
+ ECM_NONGUI=false |
94 |
fi |
95 |
- ;; |
96 |
-esac |
97 |
- |
98 |
-case ${KDE_DEBUG} in |
99 |
- false) ;; |
100 |
- *) |
101 |
- IUSE+=" debug" |
102 |
- ;; |
103 |
-esac |
104 |
- |
105 |
-case ${KDE_DESIGNERPLUGIN} in |
106 |
- false) ;; |
107 |
- *) |
108 |
- IUSE+=" designer" |
109 |
- if [[ ${CATEGORY} = kde-apps && ${PV} = 19.0[48]* ]]; then |
110 |
- BDEPEND+=" designer? ( $(add_frameworks_dep kdesignerplugin) )" |
111 |
- else |
112 |
- BDEPEND+=" designer? ( $(add_qt_dep designer) )" |
113 |
+ # propagate deprecated variables to ecm.eclass |
114 |
+ if [[ -z ${ECM_DESIGNERPLUGIN} && ${CATEGORY} != kde-apps ]]; then |
115 |
+ ECM_DESIGNERPLUGIN=${KDE_DESIGNERPLUGIN} |
116 |
+ KDE_DESIGNERPLUGIN=false # use fallback var only for kde-apps |
117 |
fi |
118 |
-esac |
119 |
- |
120 |
-case ${KDE_EXAMPLES} in |
121 |
- false) ;; |
122 |
- *) |
123 |
- IUSE+=" examples" |
124 |
+ [[ -z ${ECM_DEBUG} ]] && ECM_DEBUG=${KDE_DEBUG} |
125 |
+ [[ -z ${ECM_EXAMPLES} ]] && ECM_EXAMPLES=${KDE_EXAMPLES} |
126 |
+ [[ -z ${ECM_HANDBOOK} ]] && ECM_HANDBOOK=${KDE_HANDBOOK} |
127 |
+ [[ -z ${ECM_HANDBOOK_DIR} ]] && ECM_HANDBOOK_DIR=${KDE_DOC_DIR} |
128 |
+ [[ -z ${ECM_PO_DIRS} ]] && ECM_PO_DIRS=${KDE_PO_DIRS} |
129 |
+ [[ -z ${ECM_QTHELP} ]] && ECM_QTHELP=${KDE_QTHELP} |
130 |
+ [[ -z ${ECM_TEST} ]] && ECM_TEST=${KDE_TEST} |
131 |
+ inherit ecm |
132 |
;; |
133 |
esac |
134 |
|
135 |
-case ${KDE_HANDBOOK} in |
136 |
- false) ;; |
137 |
- *) |
138 |
- IUSE+=" +handbook" |
139 |
- BDEPEND+=" handbook? ( $(add_frameworks_dep kdoctools) )" |
140 |
- ;; |
141 |
-esac |
142 |
- |
143 |
-case ${KDE_QTHELP} in |
144 |
- false) ;; |
145 |
- *) |
146 |
- IUSE+=" doc" |
147 |
- COMMONDEPEND+=" doc? ( $(add_qt_dep qt-docs) )" |
148 |
- BDEPEND+=" doc? ( |
149 |
- $(add_qt_dep qthelp) |
150 |
- >=app-doc/doxygen-1.8.13-r1 |
151 |
- )" |
152 |
- ;; |
153 |
-esac |
154 |
- |
155 |
-case ${KDE_TEST} in |
156 |
- false) ;; |
157 |
- *) |
158 |
- IUSE+=" test" |
159 |
- DEPEND+=" test? ( $(add_qt_dep qttest) )" |
160 |
- ;; |
161 |
-esac |
162 |
- |
163 |
-DEPEND+=" ${COMMONDEPEND}" |
164 |
-RDEPEND+=" ${COMMONDEPEND}" |
165 |
-unset COMMONDEPEND |
166 |
+EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm |
167 |
|
168 |
# @FUNCTION: kde5_pkg_pretend |
169 |
# @DESCRIPTION: |
170 |
@@ -249,7 +186,10 @@ unset COMMONDEPEND |
171 |
# phase function is only exported if KDE_GCC_MINIMAL is defined. |
172 |
kde5_pkg_pretend() { |
173 |
debug-print-function ${FUNCNAME} "$@" |
174 |
- _check_gcc_version |
175 |
+ case ${KDE_AUTODEPS} in |
176 |
+ false) ;; |
177 |
+ *) ecm_pkg_pretend ;; |
178 |
+ esac |
179 |
} |
180 |
|
181 |
# @FUNCTION: kde5_pkg_setup |
182 |
@@ -257,7 +197,10 @@ kde5_pkg_pretend() { |
183 |
# Checks if the active compiler meets the minimum version requirements. |
184 |
kde5_pkg_setup() { |
185 |
debug-print-function ${FUNCNAME} "$@" |
186 |
- _check_gcc_version |
187 |
+ case ${KDE_AUTODEPS} in |
188 |
+ false) ;; |
189 |
+ *) ecm_pkg_setup ;; |
190 |
+ esac |
191 |
} |
192 |
|
193 |
# @FUNCTION: kde5_src_unpack |
194 |
@@ -274,63 +217,10 @@ kde5_src_unpack() { |
195 |
# handling of linguas, tests, handbook etc. |
196 |
kde5_src_prepare() { |
197 |
debug-print-function ${FUNCNAME} "$@" |
198 |
- |
199 |
- cmake-utils_src_prepare |
200 |
- |
201 |
- # only build examples when required |
202 |
- if ! { in_iuse examples && use examples; } ; then |
203 |
- cmake_comment_add_subdirectory examples |
204 |
- fi |
205 |
- |
206 |
- # only enable handbook when required |
207 |
- if in_iuse handbook && ! use handbook ; then |
208 |
- cmake_comment_add_subdirectory ${KDE_DOC_DIR} |
209 |
- |
210 |
- if [[ ${KDE_HANDBOOK} = forceoptional ]] ; then |
211 |
- punt_bogus_dep KF5 DocTools |
212 |
- sed -i -e "/kdoctools_install/ s/^/#DONT/" CMakeLists.txt || die |
213 |
- fi |
214 |
- fi |
215 |
- |
216 |
- # drop translations when nls is not wanted |
217 |
- if in_iuse nls && ! use nls ; then |
218 |
- local po |
219 |
- for po in ${KDE_PO_DIRS}; do |
220 |
- if [[ -d ${po} ]] ; then |
221 |
- rm -r ${po} || die |
222 |
- fi |
223 |
- done |
224 |
- fi |
225 |
- |
226 |
- # enable only the requested translations when required |
227 |
- # always install unconditionally for kconfigwidgets - if you use language |
228 |
- # X as system language, and there is a combobox with language names, the |
229 |
- # translated language name for language Y is taken from /usr/share/locale/Y/kf5_entry.desktop |
230 |
- if [[ -v LINGUAS && ${PN} != kconfigwidgets ]] ; then |
231 |
- local po |
232 |
- for po in ${KDE_PO_DIRS}; do |
233 |
- if [[ -d ${po} ]] ; then |
234 |
- pushd ${po} > /dev/null || die |
235 |
- local lang |
236 |
- for lang in *; do |
237 |
- if [[ -e ${lang} ]] && ! has ${lang/.po/} ${LINGUAS} ; then |
238 |
- case ${lang} in |
239 |
- cmake_modules | \ |
240 |
- CMakeLists.txt | \ |
241 |
- ${PN}.pot) ;; |
242 |
- *) rm -r ${lang} || die ;; |
243 |
- esac |
244 |
- if [[ -e CMakeLists.txt ]] ; then |
245 |
- cmake_comment_add_subdirectory ${lang} |
246 |
- sed -e "/add_subdirectory([[:space:]]*${lang}\/.*[[:space:]]*)/d" \ |
247 |
- -i CMakeLists.txt || die |
248 |
- fi |
249 |
- fi |
250 |
- done |
251 |
- popd > /dev/null || die |
252 |
- fi |
253 |
- done |
254 |
- fi |
255 |
+ case ${KDE_AUTODEPS} in |
256 |
+ false) cmake-utils_src_prepare ;; |
257 |
+ *) ecm_src_prepare ;; |
258 |
+ esac |
259 |
|
260 |
# PORTING: bogus, overzealous 'en' docbook disabling is not carried over |
261 |
if [[ ${KDE_BUILD_TYPE} = release && ${CATEGORY} != kde-apps ]] ; then |
262 |
@@ -345,42 +235,6 @@ kde5_src_prepare() { |
263 |
popd > /dev/null || die |
264 |
fi |
265 |
fi |
266 |
- |
267 |
- # only build unit tests when required |
268 |
- if ! { in_iuse test && use test; } ; then |
269 |
- if [[ ${KDE_TEST} = forceoptional ]] ; then |
270 |
- punt_bogus_dep Qt5 Test |
271 |
- # if forceoptional, also cover non-kde categories |
272 |
- cmake_comment_add_subdirectory autotests test tests |
273 |
- elif [[ ${KDE_TEST} = forceoptional-recursive ]] ; then |
274 |
- punt_bogus_dep Qt5 Test |
275 |
- local f pf="${T}/${P}"-tests-optional.patch |
276 |
- touch ${pf} || die "Failed to touch patch file" |
277 |
- for f in $(find . -type f -name "CMakeLists.txt" -exec \ |
278 |
- grep -l "^\s*add_subdirectory\s*\(\s*.*\(auto|unit\)\?tests\?\s*)\s*\)" {} \;); do |
279 |
- cp ${f} ${f}.old || die "Failed to prepare patch origfile" |
280 |
- pushd ${f%/*} > /dev/null || die |
281 |
- punt_bogus_dep Qt5 Test |
282 |
- sed -i CMakeLists.txt -e \ |
283 |
- "/^#/! s/add_subdirectory\s*\(\s*.*\(auto|unit\)\?tests\?\s*)\s*\)/if(BUILD_TESTING)\n&\nendif()/" \ |
284 |
- || die |
285 |
- popd > /dev/null || die |
286 |
- diff -Naur ${f}.old ${f} 1>>${pf} |
287 |
- rm ${f}.old || die "Failed to clean up" |
288 |
- done |
289 |
- einfo "Build system was modified by KDE_TEST=forceoptional-recursive." |
290 |
- einfo "Unified diff file ready for pickup in:" |
291 |
- einfo " ${pf}" |
292 |
- einfo "Push it upstream to make this message go away." |
293 |
- elif [[ ${CATEGORY} = kde-frameworks || ${CATEGORY} = kde-plasma || ${CATEGORY} = kde-apps ]] ; then |
294 |
- cmake_comment_add_subdirectory autotests test tests |
295 |
- fi |
296 |
- fi |
297 |
- |
298 |
- # in frameworks, tests = manual tests so never build them |
299 |
- if [[ ${CATEGORY} = kde-frameworks ]] && [[ ${PN} != extra-cmake-modules ]]; then |
300 |
- cmake_comment_add_subdirectory tests |
301 |
- fi |
302 |
} |
303 |
|
304 |
# @FUNCTION: kde5_src_configure |
305 |
@@ -389,51 +243,10 @@ kde5_src_prepare() { |
306 |
# handbook, tests etc. |
307 |
kde5_src_configure() { |
308 |
debug-print-function ${FUNCNAME} "$@" |
309 |
- |
310 |
- # we rely on cmake-utils.eclass to append -DNDEBUG too |
311 |
- if in_iuse debug && ! use debug; then |
312 |
- append-cppflags -DQT_NO_DEBUG |
313 |
- fi |
314 |
- |
315 |
- local cmakeargs |
316 |
- |
317 |
- if in_iuse test && ! use test ; then |
318 |
- cmakeargs+=( -DBUILD_TESTING=OFF ) |
319 |
- |
320 |
- if [[ ${KDE_TEST} = optional ]] ; then |
321 |
- cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON ) |
322 |
- fi |
323 |
- fi |
324 |
- |
325 |
- if in_iuse handbook && ! use handbook && [[ ${KDE_HANDBOOK} = optional ]] ; then |
326 |
- cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=ON ) |
327 |
- fi |
328 |
- |
329 |
- if in_iuse designer && [[ ${KDE_DESIGNERPLUGIN} != false ]] ; then |
330 |
- if [[ ${CATEGORY} = kde-frameworks ]]; then |
331 |
- cmakeargs+=( -DBUILD_DESIGNERPLUGIN=$(usex designer) ) |
332 |
- else |
333 |
- cmakeargs+=( $(cmake-utils_use_find_package designer KF5DesignerPlugin) ) |
334 |
- fi |
335 |
- fi |
336 |
- |
337 |
- if [[ ${KDE_QTHELP} != false ]]; then |
338 |
- cmakeargs+=( -DBUILD_QCH=$(usex doc) ) |
339 |
- fi |
340 |
- |
341 |
- if [[ ${ECM_KDEINSTALLDIRS} != false ]] ; then |
342 |
- cmakeargs+=( |
343 |
- # install mkspecs in the same directory as qt stuff |
344 |
- -DKDE_INSTALL_USE_QT_SYS_PATHS=ON |
345 |
- # move handbook outside of doc dir, bug 667138 |
346 |
- -DKDE_INSTALL_DOCBUNDLEDIR="${EPREFIX}/usr/share/help" |
347 |
- ) |
348 |
- fi |
349 |
- |
350 |
- # allow the ebuild to override what we set here |
351 |
- mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}") |
352 |
- |
353 |
- cmake-utils_src_configure |
354 |
+ case ${KDE_AUTODEPS} in |
355 |
+ false) cmake-utils_src_configure ;; |
356 |
+ *) ecm_src_configure ;; |
357 |
+ esac |
358 |
} |
359 |
|
360 |
# @FUNCTION: kde5_src_compile |
361 |
@@ -442,8 +255,10 @@ kde5_src_configure() { |
362 |
# is included as part of the API just in case it's needed in the future. |
363 |
kde5_src_compile() { |
364 |
debug-print-function ${FUNCNAME} "$@" |
365 |
- |
366 |
- cmake-utils_src_compile "$@" |
367 |
+ case ${KDE_AUTODEPS} in |
368 |
+ false) cmake-utils_src_compile ;; |
369 |
+ *) ecm_src_compile ;; |
370 |
+ esac |
371 |
} |
372 |
|
373 |
# @FUNCTION: kde5_src_test |
374 |
@@ -452,30 +267,10 @@ kde5_src_compile() { |
375 |
# and virtualx. |
376 |
kde5_src_test() { |
377 |
debug-print-function ${FUNCNAME} "$@" |
378 |
- |
379 |
- _test_runner() { |
380 |
- if [[ -n "${VIRTUALDBUS_TEST}" ]]; then |
381 |
- export $(dbus-launch) |
382 |
- fi |
383 |
- |
384 |
- cmake-utils_src_test |
385 |
- } |
386 |
- |
387 |
- # When run as normal user during ebuild development with the ebuild command, the |
388 |
- # kde tests tend to access the session DBUS. This however is not possible in a real |
389 |
- # emerge or on the tinderbox. |
390 |
- # > make sure it does not happen, so bad tests can be recognized and disabled |
391 |
- unset DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID |
392 |
- |
393 |
- if [[ ${VIRTUALX_REQUIRED} = always || ${VIRTUALX_REQUIRED} = test ]]; then |
394 |
- virtx _test_runner |
395 |
- else |
396 |
- _test_runner |
397 |
- fi |
398 |
- |
399 |
- if [[ -n "${DBUS_SESSION_BUS_PID}" ]] ; then |
400 |
- kill ${DBUS_SESSION_BUS_PID} |
401 |
- fi |
402 |
+ case ${KDE_AUTODEPS} in |
403 |
+ false) cmake-utils_src_test ;; |
404 |
+ *) ecm_src_test ;; |
405 |
+ esac |
406 |
} |
407 |
|
408 |
# @FUNCTION: kde5_src_install |
409 |
@@ -483,8 +278,10 @@ kde5_src_test() { |
410 |
# Wrapper for cmake-utils_src_install. Currently doesn't do anything extra. |
411 |
kde5_src_install() { |
412 |
debug-print-function ${FUNCNAME} "$@" |
413 |
- |
414 |
- cmake-utils_src_install |
415 |
+ case ${KDE_AUTODEPS} in |
416 |
+ false) cmake-utils_src_install ;; |
417 |
+ *) ecm_src_install ;; |
418 |
+ esac |
419 |
} |
420 |
|
421 |
# @FUNCTION: kde5_pkg_preinst |
422 |
@@ -492,8 +289,10 @@ kde5_src_install() { |
423 |
# Sets up environment variables required in kde5_pkg_postinst. |
424 |
kde5_pkg_preinst() { |
425 |
debug-print-function ${FUNCNAME} "$@" |
426 |
- |
427 |
- xdg_pkg_preinst |
428 |
+ case ${KDE_AUTODEPS} in |
429 |
+ false) xdg_pkg_preinst ;; |
430 |
+ *) ecm_pkg_preinst ;; |
431 |
+ esac |
432 |
} |
433 |
|
434 |
# @FUNCTION: kde5_pkg_postinst |
435 |
@@ -501,17 +300,10 @@ kde5_pkg_preinst() { |
436 |
# Updates the various XDG caches (icon, desktop, mime) if necessary. |
437 |
kde5_pkg_postinst() { |
438 |
debug-print-function ${FUNCNAME} "$@" |
439 |
- |
440 |
- xdg_pkg_postinst |
441 |
- |
442 |
- if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then |
443 |
- if [[ ${KDE_BUILD_TYPE} = live ]]; then |
444 |
- echo |
445 |
- einfo "WARNING! This is an experimental live ebuild of ${CATEGORY}/${PN}" |
446 |
- einfo "Use it at your own risk." |
447 |
- einfo "Do _NOT_ file bugs at bugs.gentoo.org because of this ebuild!" |
448 |
- fi |
449 |
- fi |
450 |
+ case ${KDE_AUTODEPS} in |
451 |
+ false) xdg_pkg_postinst ;; |
452 |
+ *) ecm_pkg_postinst ;; |
453 |
+ esac |
454 |
} |
455 |
|
456 |
# @FUNCTION: kde5_pkg_postrm |
457 |
@@ -519,8 +311,10 @@ kde5_pkg_postinst() { |
458 |
# Updates the various XDG caches (icon, desktop, mime) if necessary. |
459 |
kde5_pkg_postrm() { |
460 |
debug-print-function ${FUNCNAME} "$@" |
461 |
- |
462 |
- xdg_pkg_postrm |
463 |
+ case ${KDE_AUTODEPS} in |
464 |
+ false) xdg_pkg_postrm ;; |
465 |
+ *) ecm_pkg_postrm ;; |
466 |
+ esac |
467 |
} |
468 |
|
469 |
fi |