1 |
Support eclass for packages that use KDE extra-cmake-modules. |
2 |
|
3 |
This eclass is intended to streamline the creation of ebuilds for packages |
4 |
that follow KDE upstream packaging conventions. It's primarily intended for |
5 |
the three upstream release groups (Frameworks, Plasma, Applications) but |
6 |
is also for any package that follows similar conventions. |
7 |
|
8 |
This eclass unconditionally inherits cmake-utils.eclass and all its public |
9 |
variables and helper functions (not phase functions) may be considered as part |
10 |
of this eclass's API. |
11 |
|
12 |
When used together with kde.org.eclass this will replace kde5.eclass and |
13 |
kde5-functions.eclass, most of the latter is becoming obsolete. |
14 |
|
15 |
--- /dev/null |
16 |
+++ b/eclass/ecm-utils.eclass |
17 |
@@ -0,0 +1,549 @@ |
18 |
+# Copyright 1999-2019 Gentoo Authors |
19 |
+# Distributed under the terms of the GNU General Public License v2 |
20 |
+ |
21 |
+# @ECLASS: ecm-utils.eclass |
22 |
+# @MAINTAINER: |
23 |
+# kde@g.o |
24 |
+# @SUPPORTED_EAPIS: 7 |
25 |
+# @BLURB: Support eclass for packages that use KDE extra-cmake-modules. |
26 |
+# @DESCRIPTION: |
27 |
+# This eclass is intended to streamline the creation of ebuilds for packages |
28 |
+# that follow KDE upstream packaging conventions. It's primarily intended for |
29 |
+# the three upstream release groups (Frameworks, Plasma, Applications) but |
30 |
+# is also for any package that follows similar conventions. |
31 |
+# |
32 |
+# This eclass unconditionally inherits cmake-utils.eclass and all its public |
33 |
+# variables and helper functions (not phase functions) may be considered as |
34 |
part |
35 |
+# of this eclass's API. |
36 |
+# |
37 |
+# This eclass's phase functions are not intended to be mixed and matched, so |
38 |
if |
39 |
+# any phase functions are overridden the version here should also be called. |
40 |
+ |
41 |
+if [[ -z ${_ECM_UTILS_ECLASS} ]]; then |
42 |
+_ECM_UTILS_ECLASS=1 |
43 |
+ |
44 |
+# @ECLASS-VARIABLE: VIRTUALX_REQUIRED |
45 |
+# @DESCRIPTION: |
46 |
+# For proper description see virtualx.eclass manpage. |
47 |
+# Here we redefine default value to be manual, if your package needs virtualx |
48 |
+# for tests you should proceed with setting VIRTUALX_REQUIRED=test. |
49 |
+: ${VIRTUALX_REQUIRED:=manual} |
50 |
+ |
51 |
+inherit cmake-utils flag-o-matic toolchain-funcs virtualx xdg |
52 |
+ |
53 |
+case ${EAPI} in |
54 |
+ 7) ;; |
55 |
+ *) die "EAPI=${EAPI:-0} is not supported" ;; |
56 |
+esac |
57 |
+ |
58 |
+if [[ -v KDE_GCC_MINIMAL ]]; then |
59 |
+ EXPORT_FUNCTIONS pkg_pretend |
60 |
+fi |
61 |
+ |
62 |
+EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_test pkg_preinst |
63 |
pkg_postinst pkg_postrm |
64 |
+ |
65 |
+# @ECLASS-VARIABLE: ECM_KDEINSTALLDIRS |
66 |
+# @DESCRIPTION: |
67 |
+# If set to "false", do nothing. |
68 |
+# For any other value, assume the package is using KDEInstallDirs macro and |
69 |
switch |
70 |
+# KDE_INSTALL_USE_QT_SYS_PATHS to ON. |
71 |
+: ${ECM_KDEINSTALLDIRS:=true} |
72 |
+ |
73 |
+# @ECLASS-VARIABLE: ECM_NONGUI |
74 |
+# @DESCRIPTION: |
75 |
+# If set to "false", add dependency on kde-frameworks/breeze-icons |
76 |
+# or kde-frameworks/oxygen-icons and run the xdg.eclass routines for |
77 |
+# pkg_preinst, pkg_postinst and pkg_postrm. |
78 |
+# For any other value, do nothing. |
79 |
+if [[ ${CATEGORY} = kde-frameworks ]]; then |
80 |
+ : ${ECM_NONGUI:=true} |
81 |
+fi |
82 |
+: ${ECM_NONGUI:=false} |
83 |
+ |
84 |
+# @ECLASS-VARIABLE: ECM_DEBUG |
85 |
+# @DESCRIPTION: |
86 |
+# If set to "false", add -DNDEBUG (via cmake-utils_src_configure) and |
87 |
+# -DQT_NO_DEBUG to CPPFLAGS. |
88 |
+# Otherwise, add debug to IUSE. |
89 |
+: ${ECM_DEBUG:=true} |
90 |
+ |
91 |
+# @ECLASS-VARIABLE: ECM_DESIGNERPLUGIN |
92 |
+# @DESCRIPTION: |
93 |
+# If set to "false", do nothing. |
94 |
+# Otherwise, add "designer" to IUSE to toggle build of designer plugins |
95 |
+# and add the necessary BDEPEND. |
96 |
+: ${ECM_DESIGNERPLUGIN:=false} |
97 |
+ |
98 |
+# @ECLASS-VARIABLE: ECM_EXAMPLES |
99 |
+# @DESCRIPTION: |
100 |
+# If set to "false", unconditionally ignore a top-level examples |
101 |
subdirectory. |
102 |
+# Otherwise, add "examples" to IUSE to toggle adding that subdirectory. |
103 |
+: ${ECM_EXAMPLES:=false} |
104 |
+ |
105 |
+# @ECLASS-VARIABLE: ECM_HANDBOOK |
106 |
+# @DESCRIPTION: |
107 |
+# If set to "false", do nothing. |
108 |
+# Otherwise, add "+handbook" to IUSE, add the appropriate dependency, and let |
109 |
+# KF5DocTools generate and install the handbook from docbook file(s) found in |
110 |
+# ECM_HANDBOOK_DIR. However if USE handbook is disabled, disable build of |
111 |
+# ECM_HANDBOOK_DIR in CMakeLists.txt. |
112 |
+# If set to "optional", config with - |
113 |
DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=ON |
114 |
+# when USE=!handbook. In case package requires KF5KDELibs4Support, see next: |
115 |
+# If set to "forceoptional", remove a KF5DocTools dependency from the root |
116 |
+# CMakeLists.txt in addition to the above. |
117 |
+: ${ECM_HANDBOOK:=false} |
118 |
+ |
119 |
+# @ECLASS-VARIABLE: ECM_HANDBOOK_DIR |
120 |
+# @DESCRIPTION: |
121 |
+# Specifies the directory containing the docbook file(s) relative to ${S} to |
122 |
be |
123 |
+# processed by KF5DocTools (kdoctools_install) if not the default. |
124 |
+: ${ECM_HANDBOOK_DIR:=doc} |
125 |
+ |
126 |
+# @ECLASS-VARIABLE: ECM_PO_DIRS |
127 |
+# @DESCRIPTION: |
128 |
+# Specifies the top-level directories of l10n files relative to ${S} to be |
129 |
+# processed by KF5I18n (ki18n_install) if not the default. If IUSE nls exists |
130 |
+# and is disabled then disable build of these directories in CMakeLists.txt. |
131 |
+: ${ECM_PO_DIRS:="po poqm"} |
132 |
+ |
133 |
+# @ECLASS-VARIABLE: ECM_QTHELP |
134 |
+# @DESCRIPTION: |
135 |
+# If set to "false", do nothing. |
136 |
+# Otherwise, add "doc" to IUSE, add the appropriate dependency, generate |
137 |
+# and install Qt compressed help files with -DBUILD_QCH=ON when USE=doc. |
138 |
+if [[ ${CATEGORY} = kde-frameworks ]]; then |
139 |
+ : ${ECM_QTHELP:=true} |
140 |
+fi |
141 |
+: ${ECM_QTHELP:=false} |
142 |
+ |
143 |
+# @ECLASS-VARIABLE: ECM_TEST |
144 |
+# @DESCRIPTION: |
145 |
+# If set to "false", do nothing. |
146 |
+# For any other value, add test to IUSE and add a dependency on dev-qt/ |
147 |
qttest:5. |
148 |
+# If set to "optional", configure with - |
149 |
DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON |
150 |
+# when USE=!test. |
151 |
+# If set to "forceoptional", remove a Qt5Test dependency and comment test |
152 |
+# subdirs from the root CMakeLists.txt in addition to the above. |
153 |
+# If set to "forceoptional-recursive", remove Qt5Test dependencies and make |
154 |
+# autotest(s), unittest(s) and test(s) subdirs from *any* CMakeLists.txt in $ |
155 |
{S} |
156 |
+# and below conditional on BUILD_TESTING. This is always meant as a short- |
157 |
term |
158 |
+# fix and creates ${T}/${P}-tests-optional.patch to refine and submit |
159 |
upstream. |
160 |
+if [[ ${CATEGORY} = kde-frameworks ]]; then |
161 |
+ : ${ECM_TEST:=true} |
162 |
+fi |
163 |
+: ${ECM_TEST:=false} |
164 |
+ |
165 |
+case ${ECM_NONGUI} in |
166 |
+ false) |
167 |
+ # gui applications need breeze or oxygen icons for basic iconset, |
168 |
bug #564838 |
169 |
+ RDEPEND+=" || ( kde-frameworks/breeze-icons:5 kde-frameworks/ |
170 |
oxygen-icons:* )" |
171 |
+ ;; |
172 |
+ *) ;; |
173 |
+esac |
174 |
+ |
175 |
+case ${ECM_DEBUG} in |
176 |
+ false) ;; |
177 |
+ *) |
178 |
+ IUSE+=" debug" |
179 |
+ ;; |
180 |
+esac |
181 |
+ |
182 |
+case ${ECM_DESIGNERPLUGIN} in |
183 |
+ false) ;; |
184 |
+ *) |
185 |
+ IUSE+=" designer" |
186 |
+ BDEPEND+=" designer? ( dev-qt/designer:5 )" |
187 |
+ ;; |
188 |
+esac |
189 |
+ |
190 |
+# @ECLASS-VARIABLE: KDE_DESIGNERPLUGIN |
191 |
+# @DESCRIPTION: |
192 |
+# If set to "false", do nothing. |
193 |
+# Otherwise, add "designer" to IUSE to toggle build of designer plugins |
194 |
+# and add the necessary BDEPEND. |
195 |
+# TODO: drop after KDE Applications 19.08.3 removal |
196 |
+: ${KDE_DESIGNERPLUGIN:=false} |
197 |
+case ${KDE_DESIGNERPLUGIN} in |
198 |
+ false) ;; |
199 |
+ *) |
200 |
+ IUSE+=" designer" |
201 |
+ BDEPEND+=" designer? ( kde-frameworks/kdesignerplugin:5 )" |
202 |
+ ;; |
203 |
+esac |
204 |
+ |
205 |
+case ${ECM_EXAMPLES} in |
206 |
+ false) ;; |
207 |
+ *) |
208 |
+ IUSE+=" examples" |
209 |
+ ;; |
210 |
+esac |
211 |
+ |
212 |
+case ${ECM_HANDBOOK} in |
213 |
+ false) ;; |
214 |
+ *) |
215 |
+ IUSE+=" +handbook" |
216 |
+ BDEPEND+=" handbook? ( kde-frameworks/kdoctools:5 )" |
217 |
+ ;; |
218 |
+esac |
219 |
+ |
220 |
+case ${ECM_QTHELP} in |
221 |
+ false) ;; |
222 |
+ *) |
223 |
+ IUSE+=" doc" |
224 |
+ COMMONDEPEND+=" doc? ( dev-qt/qt-docs:5 )" |
225 |
+ BDEPEND+=" doc? ( |
226 |
+ >=app-doc/doxygen-1.8.13-r1 |
227 |
+ dev-qt/qthelp:5 |
228 |
+ )" |
229 |
+ ;; |
230 |
+esac |
231 |
+ |
232 |
+case ${ECM_TEST} in |
233 |
+ false) ;; |
234 |
+ *) |
235 |
+ IUSE+=" test" |
236 |
+ DEPEND+=" test? ( dev-qt/qttest:5 )" |
237 |
+ RESTRICT+=" !test? ( test )" |
238 |
+ ;; |
239 |
+esac |
240 |
+ |
241 |
+BDEPEND+=" >=kde-frameworks/extra-cmake-modules-5.60.0" |
242 |
+RDEPEND+=" >=kde-frameworks/kf-env-4" |
243 |
+COMMONDEPEND+=" dev-qt/qtcore:5" |
244 |
+ |
245 |
+DEPEND+=" ${COMMONDEPEND}" |
246 |
+RDEPEND+=" ${COMMONDEPEND}" |
247 |
+unset COMMONDEPEND |
248 |
+ |
249 |
+# @ECLASS-VARIABLE: KDE_GCC_MINIMAL |
250 |
+# @DEFAULT_UNSET |
251 |
+# @DESCRIPTION: |
252 |
+# Minimum version of active GCC to require. This is checked in |
253 |
+# ecm-utils_pkg_pretend and ecm-utils_pkg_setup. |
254 |
+ |
255 |
+# @FUNCTION: _check_gcc_version |
256 |
+# @INTERNAL |
257 |
+# @DESCRIPTION: |
258 |
+# Determine if the current GCC version is acceptable, otherwise die. |
259 |
+_check_gcc_version() { |
260 |
+ if [[ ${MERGE_TYPE} != binary && -v KDE_GCC_MINIMAL ]] && tc-is-gcc; |
261 |
then |
262 |
+ |
263 |
+ local version=$(gcc-version) |
264 |
+ local major=${version%.*} |
265 |
+ local minor=${version#*.} |
266 |
+ local min_major=${KDE_GCC_MINIMAL%.*} |
267 |
+ local min_minor=${KDE_GCC_MINIMAL#*.} |
268 |
+ |
269 |
+ debug-print "GCC version check activated" |
270 |
+ debug-print "Version detected:" |
271 |
+ debug-print " - Full: ${version}" |
272 |
+ debug-print " - Major: ${major}" |
273 |
+ debug-print " - Minor: ${minor}" |
274 |
+ debug-print "Version required:" |
275 |
+ debug-print " - Major: ${min_major}" |
276 |
+ debug-print " - Minor: ${min_minor}" |
277 |
+ |
278 |
+ [[ ${major} -lt ${min_major} ]] || \ |
279 |
+ ( [[ ${major} -eq ${min_major} && ${minor} -lt $ |
280 |
{min_minor} ]] ) \ |
281 |
+ && die "Sorry, but gcc-${KDE_GCC_MINIMAL} or later is |
282 |
required for this package (found ${version})." |
283 |
+ fi |
284 |
+} |
285 |
+ |
286 |
+# @FUNCTION: ecm_punt_bogus_dep |
287 |
+# @USAGE: <prefix> <dependency> |
288 |
+# @DESCRIPTION: |
289 |
+# Removes a specified dependency from a find_package call with multiple |
290 |
components. |
291 |
+ecm_punt_bogus_dep() { |
292 |
+ local prefix=${1} |
293 |
+ local dep=${2} |
294 |
+ |
295 |
+ if [[ ! -e "CMakeLists.txt" ]]; then |
296 |
+ return |
297 |
+ fi |
298 |
+ |
299 |
+ pcregrep -Mni "(?s)find_package\s*\(\s*${prefix}[^)]*?${dep}.*?\)" |
300 |
CMakeLists.txt > "${T}/bogus${dep}" |
301 |
+ |
302 |
+ # pcregrep returns non-zero on no matches/error |
303 |
+ if [[ $? != 0 ]] ; then |
304 |
+ return |
305 |
+ fi |
306 |
+ |
307 |
+ local length=$(wc -l "${T}/bogus${dep}" | cut -d " " -f 1) |
308 |
+ local first=$(head -n 1 "${T}/bogus${dep}" | cut -d ":" -f 1) |
309 |
+ local last=$(( ${length} + ${first} - 1)) |
310 |
+ |
311 |
+ sed -e "${first},${last}s/${dep}//" -i CMakeLists.txt || die |
312 |
+ |
313 |
+ if [[ ${length} = 1 ]] ; then |
314 |
+ sed -e "/find_package\s*(\s*${prefix}\(\s\+\(REQUIRED\|CONFIG\| |
315 |
COMPONENTS\|\${[A-Z0-9_]*}\)\)\+\s*)/Is/^/# removed by kde5-functions.eclass - |
316 |
/" -i CMakeLists.txt || die |
317 |
+ fi |
318 |
+} |
319 |
+ |
320 |
+# @FUNCTION: ecm-utils_pkg_pretend |
321 |
+# @DESCRIPTION: |
322 |
+# Checks if the active compiler meets the minimum version requirements. |
323 |
+# phase function is only exported if KDE_GCC_MINIMAL is defined. |
324 |
+ecm-utils_pkg_pretend() { |
325 |
+ debug-print-function ${FUNCNAME} "$@" |
326 |
+ _check_gcc_version |
327 |
+} |
328 |
+ |
329 |
+# @FUNCTION: ecm-utils_pkg_setup |
330 |
+# @DESCRIPTION: |
331 |
+# Checks if the active compiler meets the minimum version requirements. |
332 |
+ecm-utils_pkg_setup() { |
333 |
+ debug-print-function ${FUNCNAME} "$@" |
334 |
+ _check_gcc_version |
335 |
+} |
336 |
+ |
337 |
+# @FUNCTION: ecm-utils_src_prepare |
338 |
+# @DESCRIPTION: |
339 |
+# Wrapper for cmake-utils_src_prepare with lots of extra logic for magic |
340 |
+# handling of linguas, tests, handbook etc. |
341 |
+ecm-utils_src_prepare() { |
342 |
+ debug-print-function ${FUNCNAME} "$@" |
343 |
+ |
344 |
+ cmake-utils_src_prepare |
345 |
+ |
346 |
+ # only build examples when required |
347 |
+ if ! { in_iuse examples && use examples; } ; then |
348 |
+ cmake_comment_add_subdirectory examples |
349 |
+ fi |
350 |
+ |
351 |
+ # only enable handbook when required |
352 |
+ if in_iuse handbook && ! use handbook ; then |
353 |
+ cmake_comment_add_subdirectory ${ECM_HANDBOOK_DIR} |
354 |
+ |
355 |
+ if [[ ${ECM_HANDBOOK} = forceoptional ]] ; then |
356 |
+ punt_bogus_dep KF5 DocTools |
357 |
+ sed -i -e "/kdoctools_install/ s/^/#DONT/" CMakeLists.txt || |
358 |
die |
359 |
+ fi |
360 |
+ fi |
361 |
+ |
362 |
+ # drop translations when nls is not wanted |
363 |
+ if in_iuse nls && ! use nls ; then |
364 |
+ local po |
365 |
+ for po in ${ECM_PO_DIRS}; do |
366 |
+ if [[ -d ${po} ]] ; then |
367 |
+ rm -r ${po} || die |
368 |
+ fi |
369 |
+ done |
370 |
+ fi |
371 |
+ |
372 |
+ # enable only the requested translations when required |
373 |
+ # always install unconditionally for kconfigwidgets - if you use |
374 |
language |
375 |
+ # X as system language, and there is a combobox with language names, the |
376 |
+ # translated language name for language Y is taken from |
377 |
+ # /usr/share/locale/Y/kf5_entry.desktop |
378 |
+ if [[ -v LINGUAS && ${PN} != kconfigwidgets ]] ; then |
379 |
+ local po |
380 |
+ for po in ${ECM_PO_DIRS}; do |
381 |
+ if [[ -d ${po} ]] ; then |
382 |
+ pushd ${po} > /dev/null || die |
383 |
+ local lang |
384 |
+ for lang in *; do |
385 |
+ if [[ -e ${lang} ]] && ! has ${lang/.po/} ${LINGUAS} ; |
386 |
then |
387 |
+ case ${lang} in |
388 |
+ cmake_modules | \ |
389 |
+ CMakeLists.txt | \ |
390 |
+ ${PN}.pot) ;; |
391 |
+ *) rm -r ${lang} || die ;; |
392 |
+ esac |
393 |
+ if [[ -e CMakeLists.txt ]] ; then |
394 |
+ cmake_comment_add_subdirectory ${lang} |
395 |
+ sed -e "/add_subdirectory([[:space:]]*$ |
396 |
{lang}\/.*[[:space:]]*)/d" \ |
397 |
+ -i CMakeLists.txt || die |
398 |
+ fi |
399 |
+ fi |
400 |
+ done |
401 |
+ popd > /dev/null || die |
402 |
+ fi |
403 |
+ done |
404 |
+ fi |
405 |
+ |
406 |
+ # only build unit tests when required |
407 |
+ if ! { in_iuse test && use test; } ; then |
408 |
+ if [[ ${ECM_TEST} = forceoptional ]] ; then |
409 |
+ punt_bogus_dep Qt5 Test |
410 |
+ # if forceoptional, also cover non-kde categories |
411 |
+ cmake_comment_add_subdirectory autotests test tests |
412 |
+ elif [[ ${ECM_TEST} = forceoptional-recursive ]] ; then |
413 |
+ punt_bogus_dep Qt5 Test |
414 |
+ local f pf="${T}/${P}"-tests-optional.patch |
415 |
+ touch ${pf} || die "Failed to touch patch file" |
416 |
+ for f in $(find . -type f -name "CMakeLists.txt" -exec \ |
417 |
+ grep -l "^\s*add_subdirectory\s*\(\s*.*\(auto|unit\)\? |
418 |
tests\?\s*)\s*\)" {} \;); do |
419 |
+ cp ${f} ${f}.old || die "Failed to prepare patch |
420 |
origfile" |
421 |
+ pushd ${f%/*} > /dev/null || die |
422 |
+ punt_bogus_dep Qt5 Test |
423 |
+ sed -i CMakeLists.txt -e \ |
424 |
+ "/^#/! s/add_subdirectory\s*\(\s*.*\(auto| |
425 |
unit\)\?tests\?\s*)\s*\)/if(BUILD_TESTING)\n&\nendif()/" \ |
426 |
+ || die |
427 |
+ popd > /dev/null || die |
428 |
+ diff -Naur ${f}.old ${f} 1>>${pf} |
429 |
+ rm ${f}.old || die "Failed to clean up" |
430 |
+ done |
431 |
+ eqawarn "Build system was modified by |
432 |
ECM_TEST=forceoptional-recursive." |
433 |
+ eqawarn "Unified diff file ready for pickup in:" |
434 |
+ eqawarn " ${pf}" |
435 |
+ eqawarn "Push it upstream to make this message go away." |
436 |
+ elif [[ ${CATEGORY} = kde-frameworks || ${CATEGORY} = kde-plasma |
437 |
|| ${CATEGORY} = kde-apps ]] ; then |
438 |
+ cmake_comment_add_subdirectory autotests test tests |
439 |
+ fi |
440 |
+ fi |
441 |
+ |
442 |
+ # in frameworks, tests = manual tests so never build them |
443 |
+ if [[ ${CATEGORY} = kde-frameworks ]] && [[ ${PN} != extra-cmake-modules |
444 |
]]; then |
445 |
+ cmake_comment_add_subdirectory tests |
446 |
+ fi |
447 |
+} |
448 |
+ |
449 |
+# @FUNCTION: ecm-utils_src_configure |
450 |
+# @DESCRIPTION: |
451 |
+# Wrapper for cmake-utils_src_configure with extra logic for magic handling |
452 |
of |
453 |
+# handbook, tests etc. |
454 |
+ecm-utils_src_configure() { |
455 |
+ debug-print-function ${FUNCNAME} "$@" |
456 |
+ |
457 |
+ # we rely on cmake-utils.eclass to append -DNDEBUG too |
458 |
+ if in_iuse debug && ! use debug; then |
459 |
+ append-cppflags -DQT_NO_DEBUG |
460 |
+ fi |
461 |
+ |
462 |
+ local cmakeargs |
463 |
+ |
464 |
+ if in_iuse test && ! use test ; then |
465 |
+ cmakeargs+=( -DBUILD_TESTING=OFF ) |
466 |
+ |
467 |
+ if [[ ${ECM_TEST} = optional ]] ; then |
468 |
+ cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_Qt5Test=ON ) |
469 |
+ fi |
470 |
+ fi |
471 |
+ |
472 |
+ if in_iuse handbook && ! use handbook && [[ ${ECM_HANDBOOK} = optional |
473 |
]] ; then |
474 |
+ cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=ON ) |
475 |
+ fi |
476 |
+ |
477 |
+ if in_iuse designer && [[ ${ECM_DESIGNERPLUGIN} != false ]]; then |
478 |
+ cmakeargs+=( -DBUILD_DESIGNERPLUGIN=$(usex designer) ) |
479 |
+ fi |
480 |
+ |
481 |
+ # TODO: drop after KDE Applications 19.08.3 removal |
482 |
+ if in_iuse designer && [[ ${KDE_DESIGNERPLUGIN} != false ]] ; then |
483 |
+ cmakeargs+=( $(cmake-utils_use_find_package designer |
484 |
KF5DesignerPlugin) ) |
485 |
+ fi |
486 |
+ |
487 |
+ if [[ ${ECM_QTHELP} != false ]]; then |
488 |
+ cmakeargs+=( -DBUILD_QCH=$(usex doc) ) |
489 |
+ fi |
490 |
+ |
491 |
+ if [[ ${ECM_KDEINSTALLDIRS} != false ]] ; then |
492 |
+ cmakeargs+=( |
493 |
+ # install mkspecs in the same directory as qt stuff |
494 |
+ -DKDE_INSTALL_USE_QT_SYS_PATHS=ON |
495 |
+ # move handbook outside of doc dir, bug 667138 |
496 |
+ -DKDE_INSTALL_DOCBUNDLEDIR="${EPREFIX}/usr/share/help" |
497 |
+ ) |
498 |
+ fi |
499 |
+ |
500 |
+ # allow the ebuild to override what we set here |
501 |
+ mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}") |
502 |
+ |
503 |
+ cmake-utils_src_configure |
504 |
+} |
505 |
+ |
506 |
+# @FUNCTION: ecm-utils_src_compile |
507 |
+# @DESCRIPTION: |
508 |
+# Wrapper for cmake-utils_src_compile. Currently doesn't do anything extra, |
509 |
but |
510 |
+# is included as part of the API just in case it's needed in the future. |
511 |
+ecm-utils_src_compile() { |
512 |
+ debug-print-function ${FUNCNAME} "$@" |
513 |
+ |
514 |
+ cmake-utils_src_compile "$@" |
515 |
+} |
516 |
+ |
517 |
+# @FUNCTION: ecm-utils_src_test |
518 |
+# @DESCRIPTION: |
519 |
+# Wrapper for cmake-utils_src_test with extra logic for magic handling of |
520 |
dbus |
521 |
+# and virtualx. |
522 |
+ecm-utils_src_test() { |
523 |
+ debug-print-function ${FUNCNAME} "$@" |
524 |
+ |
525 |
+ _test_runner() { |
526 |
+ if [[ -n "${VIRTUALDBUS_TEST}" ]]; then |
527 |
+ export $(dbus-launch) |
528 |
+ fi |
529 |
+ |
530 |
+ cmake-utils_src_test |
531 |
+ } |
532 |
+ |
533 |
+ # When run as normal user during ebuild development with the ebuild |
534 |
command, the |
535 |
+ # kde tests tend to access the session DBUS. This however is not |
536 |
possible in a real |
537 |
+ # emerge or on the tinderbox. |
538 |
+ # > make sure it does not happen, so bad tests can be recognized and |
539 |
disabled |
540 |
+ unset DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID |
541 |
+ |
542 |
+ if [[ ${VIRTUALX_REQUIRED} = always || ${VIRTUALX_REQUIRED} = test ]]; |
543 |
then |
544 |
+ virtx _test_runner |
545 |
+ else |
546 |
+ _test_runner |
547 |
+ fi |
548 |
+ |
549 |
+ if [[ -n "${DBUS_SESSION_BUS_PID}" ]] ; then |
550 |
+ kill ${DBUS_SESSION_BUS_PID} |
551 |
+ fi |
552 |
+} |
553 |
+ |
554 |
+# @FUNCTION: ecm-utils_src_install |
555 |
+# @DESCRIPTION: |
556 |
+# Wrapper for cmake-utils_src_install. Currently doesn't do anything extra, |
557 |
but |
558 |
+# is included as part of the API just in case it's needed in the future. |
559 |
+ecm-utils_src_install() { |
560 |
+ debug-print-function ${FUNCNAME} "$@" |
561 |
+ |
562 |
+ cmake-utils_src_install |
563 |
+} |
564 |
+ |
565 |
+# @FUNCTION: ecm-utils_pkg_preinst |
566 |
+# @DESCRIPTION: |
567 |
+# Sets up environment variables required in ecm-utils_pkg_postinst. |
568 |
+ecm-utils_pkg_preinst() { |
569 |
+ debug-print-function ${FUNCNAME} "$@" |
570 |
+ |
571 |
+ case ${ECM_NONGUI} in |
572 |
+ false) xdg_pkg_preinst ;; |
573 |
+ *) ;; |
574 |
+ esac |
575 |
+} |
576 |
+ |
577 |
+# @FUNCTION: ecm-utils_pkg_postinst |
578 |
+# @DESCRIPTION: |
579 |
+# Updates the various XDG caches (icon, desktop, mime) if necessary. |
580 |
+ecm-utils_pkg_postinst() { |
581 |
+ debug-print-function ${FUNCNAME} "$@" |
582 |
+ |
583 |
+ case ${ECM_NONGUI} in |
584 |
+ false) xdg_pkg_postinst ;; |
585 |
+ *) ;; |
586 |
+ esac |
587 |
+ |
588 |
+ if [[ -n ${_KDE_ORG_ECLASS} ]] && [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]] && |
589 |
[[ ${KDE_BUILD_TYPE} = live ]]; then |
590 |
+ einfo "WARNING! This is an experimental live ebuild of $ |
591 |
{CATEGORY}/${PN}" |
592 |
+ einfo "Use it at your own risk." |
593 |
+ einfo "Do _NOT_ file bugs at bugs.gentoo.org because of this |
594 |
ebuild!" |
595 |
+ fi |
596 |
+} |
597 |
+ |
598 |
+# @FUNCTION: ecm-utils_pkg_postrm |
599 |
+# @DESCRIPTION: |
600 |
+# Updates the various XDG caches (icon, desktop, mime) if necessary. |
601 |
+ecm-utils_pkg_postrm() { |
602 |
+ debug-print-function ${FUNCNAME} "$@" |
603 |
+ |
604 |
+ case ${ECM_NONGUI} in |
605 |
+ false) xdg_pkg_postrm ;; |
606 |
+ *) ;; |
607 |
+ esac |
608 |
+} |
609 |
+ |
610 |
+fi |