/[gentoo-x86]/eclass/kde5.eclass
Gentoo

Contents of /eclass/kde5.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (show annotations) (download)
Mon Aug 3 14:03:00 2015 UTC (3 years, 8 months ago) by kensington
Branch: MAIN
CVS Tags: HEAD
Changes since 1.13: +7 -1 lines
Do not compress handbooks.

1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/kde5.eclass,v 1.13 2015/07/06 15:48:51 kensington Exp $
4
5 # @ECLASS: kde5.eclass
6 # @MAINTAINER:
7 # kde@gentoo.org
8 # @BLURB: Support eclass for KDE 5-related packages.
9 # @DESCRIPTION:
10 # The kde5.eclass provides support for building KDE 5-related packages.
11
12 if [[ -z ${_KDE5_ECLASS} ]]; then
13 _KDE5_ECLASS=1
14
15 # @ECLASS-VARIABLE: VIRTUALX_REQUIRED
16 # @DESCRIPTION:
17 # For proper description see virtualx.eclass manpage.
18 # Here we redefine default value to be manual, if your package needs virtualx
19 # for tests you should proceed with setting VIRTUALX_REQUIRED=test.
20 : ${VIRTUALX_REQUIRED:=manual}
21
22 inherit kde5-functions fdo-mime flag-o-matic gnome2-utils versionator virtualx eutils cmake-utils
23
24 if [[ ${KDE_BUILD_TYPE} = live ]]; then
25 case ${KDE_SCM} in
26 svn) inherit subversion ;;
27 git) inherit git-r3 ;;
28 esac
29 fi
30
31 EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm
32
33 # @ECLASS-VARIABLE: QT_MINIMAL
34 # @DESCRIPTION:
35 # Minimal Qt version to require for the package.
36 : ${QT_MINIMAL:=5.4.1}
37
38 # @ECLASS-VARIABLE: KDE_AUTODEPS
39 # @DESCRIPTION:
40 # If set to "false", do nothing.
41 # For any other value, add a dependency on dev-qt/qtcore:5 and kde-frameworks/extra-cmake-modules:5.
42 : ${KDE_AUTODEPS:=true}
43
44 # @ECLASS-VARIABLE: KDE_BLOCK_SLOT4
45 # @DESCRIPTION:
46 # This variable is used when KDE_AUTODEPS is set.
47 # If set to "true", add RDEPEND block on kde-{base,apps}/${PN}:4
48 : ${KDE_BLOCK_SLOT4:=true}
49
50 # @ECLASS-VARIABLE: KDE_DEBUG
51 # @DESCRIPTION:
52 # If set to "false", unconditionally build with -DNDEBUG.
53 # Otherwise, add debug to IUSE to control building with that flag.
54 : ${KDE_DEBUG:=true}
55
56 # @ECLASS-VARIABLE: KDE_DOXYGEN
57 # @DESCRIPTION:
58 # If set to "false", do nothing.
59 # Otherwise, add "doc" to IUSE, add appropriate dependencies, and generate and
60 # install API documentation.
61 if [[ ${CATEGORY} = kde-frameworks ]]; then
62 : ${KDE_DOXYGEN:=true}
63 else
64 : ${KDE_DOXYGEN:=false}
65 fi
66
67 # @ECLASS-VARIABLE: KDE_EXAMPLES
68 # @DESCRIPTION:
69 # If set to "false", unconditionally ignore a top-level examples subdirectory.
70 # Otherwise, add "examples" to IUSE to toggle adding that subdirectory.
71 : ${KDE_EXAMPLES:=false}
72
73 # @ECLASS-VARIABLE: KDE_HANDBOOK
74 # @DESCRIPTION:
75 # If set to "false", do nothing.
76 # Otherwise, add "+handbook" to IUSE, add the appropriate dependency, and
77 # generate and install KDE handbook.
78 : ${KDE_HANDBOOK:=false}
79
80 # @ECLASS-VARIABLE: KDE_TEST
81 # @DESCRIPTION:
82 # If set to "false", do nothing.
83 # For any other value, add test to IUSE and add a dependency on dev-qt/qttest:5.
84 if [[ ${CATEGORY} = kde-frameworks ]]; then
85 : ${KDE_TEST:=true}
86 else
87 : ${KDE_TEST:=false}
88 fi
89
90 # @ECLASS-VARIABLE: KDE_PUNT_BOGUS_DEPS
91 # @DESCRIPTION:
92 # If set to "false", do nothing.
93 # For any other value, do black magic to make hardcoded-but-optional dependencies
94 # optional again. An upstream solution is preferable and this is a last resort.
95 : ${KDE_PUNT_BOGUS_DEPS:=false}
96
97 # @ECLASS-VARIABLE: KDE_SELINUX_MODULE
98 # @DESCRIPTION:
99 # If set to "none", do nothing.
100 # For any other value, add selinux to IUSE, and depending on that useflag
101 # add a dependency on sec-policy/selinux-${KDE_SELINUX_MODULE} to (R)DEPEND.
102 : ${KDE_SELINUX_MODULE:=none}
103
104 if [[ ${KDEBASE} = kdevelop ]]; then
105 HOMEPAGE="http://www.kdevelop.org/"
106 else
107 HOMEPAGE="http://www.kde.org/"
108 fi
109
110 LICENSE="GPL-2"
111
112 if [[ ${CATEGORY} = kde-frameworks ]]; then
113 SLOT=5/$(get_version_component_range 1-2)
114 else
115 SLOT=5
116 fi
117
118 case ${KDE_AUTODEPS} in
119 false) ;;
120 *)
121 if [[ ${KDE_BUILD_TYPE} = live ]]; then
122 case ${CATEGORY} in
123 kde-frameworks)
124 FRAMEWORKS_MINIMAL=9999
125 ;;
126 kde-plasma)
127 FRAMEWORKS_MINIMAL=9999
128 ;;
129 *) ;;
130 esac
131 fi
132
133 DEPEND+=" $(add_frameworks_dep extra-cmake-modules)"
134 RDEPEND+=" >=kde-frameworks/kf-env-3"
135 COMMONDEPEND+=" >=dev-qt/qtcore-${QT_MINIMAL}:5"
136
137 if [[ ${CATEGORY} = kde-plasma ]]; then
138 RDEPEND+="
139 !kde-apps/kde4-l10n[-minimal(-)]
140 !kde-base/kde-l10n:4[-minimal(-)]
141 "
142 fi
143
144 if [[ ${KDE_BLOCK_SLOT4} = true && ${CATEGORY} = kde-apps ]]; then
145 RDEPEND+=" !kde-apps/${PN}:4"
146 fi
147 ;;
148 esac
149
150 case ${KDE_DOXYGEN} in
151 false) ;;
152 *)
153 IUSE+=" doc"
154 DEPEND+=" doc? (
155 $(add_frameworks_dep kapidox)
156 app-doc/doxygen
157 )"
158 ;;
159 esac
160
161 case ${KDE_DEBUG} in
162 false) ;;
163 *)
164 IUSE+=" debug"
165 ;;
166 esac
167
168 case ${KDE_EXAMPLES} in
169 false) ;;
170 *)
171 IUSE+=" examples"
172 ;;
173 esac
174
175 case ${KDE_HANDBOOK} in
176 false) ;;
177 *)
178 IUSE+=" +handbook"
179 DEPEND+=" handbook? ( $(add_frameworks_dep kdoctools) )"
180 ;;
181 esac
182
183 case ${KDE_TEST} in
184 false) ;;
185 *)
186 IUSE+=" test"
187 DEPEND+=" test? ( >=dev-qt/qttest-${QT_MINIMAL}:5 )"
188 ;;
189 esac
190
191 case ${KDE_SELINUX_MODULE} in
192 none) ;;
193 *)
194 IUSE+=" selinux"
195 RDEPEND+=" selinux? ( sec-policy/selinux-${KDE_SELINUX_MODULE} )"
196 ;;
197 esac
198
199 DEPEND+=" ${COMMONDEPEND} dev-util/desktop-file-utils"
200 RDEPEND+=" ${COMMONDEPEND}"
201 unset COMMONDEPEND
202
203 if [[ -n ${KMNAME} && ${KMNAME} != ${PN} && ${KDE_BUILD_TYPE} = release ]]; then
204 S=${WORKDIR}/${KMNAME}-${PV}
205 fi
206
207 # Determine fetch location for released tarballs
208 _calculate_src_uri() {
209 debug-print-function ${FUNCNAME} "$@"
210
211 local _kmname
212
213 if [[ -n ${KMNAME} ]]; then
214 _kmname=${KMNAME}
215 else
216 _kmname=${PN}
217 fi
218
219 case ${PN} in
220 kdelibs4support | \
221 khtml | \
222 kjs | \
223 kjsembed | \
224 kmediaplayer | \
225 kross | \
226 krunner)
227 _kmname="portingAids/${_kmname}"
228 ;;
229 esac
230
231 DEPEND+=" app-arch/xz-utils"
232
233 case ${CATEGORY} in
234 kde-apps)
235 case ${PV} in
236 ??.?.[6-9]? | ??.??.[6-9]? )
237 SRC_URI="mirror://kde/unstable/applications/${PV}/src/${_kmname}-${PV}.tar.xz"
238 RESTRICT+=" mirror"
239 ;;
240 *)
241 SRC_URI="mirror://kde/stable/applications/${PV}/src/${_kmname}-${PV}.tar.xz" ;;
242 esac
243 ;;
244 kde-frameworks)
245 SRC_URI="mirror://kde/stable/frameworks/${PV%.*}/${_kmname}-${PV}.tar.xz" ;;
246 kde-plasma)
247 case ${PV} in
248 5.?.[6-9]? )
249 # Plasma 5 beta releases
250 SRC_URI="mirror://kde/unstable/plasma/${PV}/${_kmname}-${PV}.tar.xz"
251 RESTRICT+=" mirror"
252 ;;
253 *)
254 # Plasma 5 stable releases
255 SRC_URI="mirror://kde/stable/plasma/${PV}/${_kmname}-${PV}.tar.xz" ;;
256 esac
257 ;;
258 esac
259 }
260
261 # Determine fetch location for live sources
262 _calculate_live_repo() {
263 debug-print-function ${FUNCNAME} "$@"
264
265 SRC_URI=""
266
267 case ${KDE_SCM} in
268 svn)
269 # @ECLASS-VARIABLE: ESVN_MIRROR
270 # @DESCRIPTION:
271 # This variable allows easy overriding of default kde mirror service
272 # (anonsvn) with anything else you might want to use.
273 ESVN_MIRROR=${ESVN_MIRROR:=svn://anonsvn.kde.org/home/kde}
274
275 local branch_prefix="KDE"
276
277 if [[ -n ${KMNAME} ]]; then
278 branch_prefix="${KMNAME}"
279 fi
280
281 ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${branch_prefix}/${PN}"
282 ;;
283 git)
284 # @ECLASS-VARIABLE: EGIT_MIRROR
285 # @DESCRIPTION:
286 # This variable allows easy overriding of default kde mirror service
287 # (anongit) with anything else you might want to use.
288 EGIT_MIRROR=${EGIT_MIRROR:=git://anongit.kde.org}
289
290 local _kmname
291
292 # @ECLASS-VARIABLE: EGIT_REPONAME
293 # @DESCRIPTION:
294 # This variable allows overriding of default repository
295 # name. Specify only if this differ from PN and KMNAME.
296 if [[ -n ${EGIT_REPONAME} ]]; then
297 # the repository and kmname different
298 _kmname=${EGIT_REPONAME}
299 elif [[ -n ${KMNAME} ]]; then
300 _kmname=${KMNAME}
301 else
302 _kmname=${PN}
303 fi
304
305 if [[ ${PV} != 9999 && ${CATEGORY} = kde-plasma ]]; then
306 EGIT_BRANCH="Plasma/$(get_version_component_range 1-2)"
307 fi
308
309 EGIT_REPO_URI="${EGIT_MIRROR}/${_kmname}"
310 ;;
311 esac
312 }
313
314 case ${KDE_BUILD_TYPE} in
315 live) _calculate_live_repo ;;
316 *) _calculate_src_uri ;;
317 esac
318
319 debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SRC_URI is ${SRC_URI}"
320
321 # @FUNCTION: kde5_pkg_pretend
322 # @DESCRIPTION:
323 # Do some basic settings
324 kde5_pkg_pretend() {
325 debug-print-function ${FUNCNAME} "$@"
326 _check_gcc_version
327 }
328
329 # @FUNCTION: kde5_pkg_setup
330 # @DESCRIPTION:
331 # Do some basic settings
332 kde5_pkg_setup() {
333 debug-print-function ${FUNCNAME} "$@"
334 _check_gcc_version
335 }
336
337 # @FUNCTION: kde5_src_unpack
338 # @DESCRIPTION:
339 # Function for unpacking KDE 5.
340 kde5_src_unpack() {
341 debug-print-function ${FUNCNAME} "$@"
342
343 if [[ ${KDE_BUILD_TYPE} = live ]]; then
344 case ${KDE_SCM} in
345 svn)
346 subversion_src_unpack
347 ;;
348 git)
349 git-r3_src_unpack
350 ;;
351 esac
352 else
353 default
354 fi
355 }
356
357 # @FUNCTION: kde5_src_prepare
358 # @DESCRIPTION:
359 # Function for preparing the KDE 5 sources.
360 kde5_src_prepare() {
361 debug-print-function ${FUNCNAME} "$@"
362
363 # only build examples when required
364 if ! use_if_iuse examples || ! use examples ; then
365 comment_add_subdirectory examples
366 fi
367
368 # only enable handbook when required
369 if ! use_if_iuse handbook ; then
370 comment_add_subdirectory doc
371 fi
372
373 # enable only the requested translations
374 # when required
375 if [[ ${KDE_BUILD_TYPE} = release ]] ; then
376 if [[ -d po ]] ; then
377 pushd po > /dev/null
378 for lang in *; do
379 if ! has ${lang} ${LINGUAS} ; then
380 if [[ ${lang} != CMakeLists.txt ]] ; then
381 rm -rf ${lang}
382 fi
383 if [[ -e CMakeLists.txt ]] ; then
384 comment_add_subdirectory ${lang}
385 fi
386 fi
387 done
388 popd > /dev/null
389 fi
390
391 if [[ ${KDE_HANDBOOK} = true ]] ; then
392 pushd doc > /dev/null
393 for lang in *; do
394 if ! has ${lang} ${LINGUAS} ; then
395 comment_add_subdirectory ${lang}
396 fi
397 done
398 popd > /dev/null
399 fi
400 else
401 rm -rf po
402 fi
403
404 # in frameworks, tests = manual tests so never
405 # build them
406 if [[ ${CATEGORY} = kde-frameworks ]]; then
407 comment_add_subdirectory tests
408 fi
409
410 if [[ ${CATEGORY} = kde-frameworks || ${CATEGORY} = kde-plasma || ${CATEGORY} = kde-apps ]] ; then
411 # only build unit tests when required
412 if ! use_if_iuse test ; then
413 comment_add_subdirectory autotests
414 comment_add_subdirectory tests
415 fi
416 fi
417
418 case ${KDE_PUNT_BOGUS_DEPS} in
419 false) ;;
420 *)
421 if ! use_if_iuse test ; then
422 punt_bogus_dep Qt5 Test
423 fi
424 if ! use_if_iuse handbook ; then
425 punt_bogus_dep KF5 DocTools
426 fi
427 ;;
428 esac
429
430 cmake-utils_src_prepare
431 }
432
433 # @FUNCTION: kde5_src_configure
434 # @DESCRIPTION:
435 # Function for configuring the build of KDE 5.
436 kde5_src_configure() {
437 debug-print-function ${FUNCNAME} "$@"
438
439 # we rely on cmake-utils.eclass to append -DNDEBUG too
440 if ! use_if_iuse debug; then
441 append-cppflags -DQT_NO_DEBUG
442 fi
443
444 local cmakeargs
445
446 if ! use_if_iuse test ; then
447 cmakeargs+=( -DBUILD_TESTING=OFF )
448 fi
449
450 # install mkspecs in the same directory as qt stuff
451 cmakeargs+=(-DKDE_INSTALL_USE_QT_SYS_PATHS=ON)
452
453 # allow the ebuild to override what we set here
454 mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}")
455
456 cmake-utils_src_configure
457 }
458
459 # @FUNCTION: kde5_src_compile
460 # @DESCRIPTION:
461 # Function for compiling KDE 5.
462 kde5_src_compile() {
463 debug-print-function ${FUNCNAME} "$@"
464
465 cmake-utils_src_compile "$@"
466
467 # Build doxygen documentation if applicable
468 if use_if_iuse doc ; then
469 kgenapidox . || die
470 fi
471 }
472
473 # @FUNCTION: kde5_src_test
474 # @DESCRIPTION:
475 # Function for testing KDE 5.
476 kde5_src_test() {
477 debug-print-function ${FUNCNAME} "$@"
478
479 _test_runner() {
480 if [[ -n "${VIRTUALDBUS_TEST}" ]]; then
481 export $(dbus-launch)
482 fi
483
484 cmake-utils_src_test
485 }
486
487 # When run as normal user during ebuild development with the ebuild command, the
488 # kde tests tend to access the session DBUS. This however is not possible in a real
489 # emerge or on the tinderbox.
490 # > make sure it does not happen, so bad tests can be recognized and disabled
491 unset DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID
492
493 if [[ ${VIRTUALX_REQUIRED} = always || ${VIRTUALX_REQUIRED} = test ]]; then
494 VIRTUALX_COMMAND="_test_runner" virtualmake
495 else
496 _test_runner
497 fi
498
499 if [[ -n "${DBUS_SESSION_BUS_PID}" ]] ; then
500 kill ${DBUS_SESSION_BUS_PID}
501 fi
502 }
503
504 # @FUNCTION: kde5_src_install
505 # @DESCRIPTION:
506 # Function for installing KDE 5.
507 kde5_src_install() {
508 debug-print-function ${FUNCNAME} "$@"
509
510 # Install doxygen documentation if applicable
511 if use_if_iuse doc ; then
512 dodoc -r apidocs/html
513 fi
514
515 cmake-utils_src_install
516
517 # We don't want ${PREFIX}/share/doc/HTML to be compressed,
518 # because then khelpcenter can't find the docs
519 if [[ -d ${ED}/${PREFIX}/share/doc/HTML ]]; then
520 docompress -x ${PREFIX}/share/doc/HTML
521 fi
522 }
523
524 # @FUNCTION: kde5_pkg_preinst
525 # @DESCRIPTION:
526 # Function storing icon caches
527 kde5_pkg_preinst() {
528 debug-print-function ${FUNCNAME} "$@"
529
530 gnome2_icon_savelist
531 }
532
533 # @FUNCTION: kde5_pkg_postinst
534 # @DESCRIPTION:
535 # Function to rebuild the KDE System Configuration Cache after an application has been installed.
536 kde5_pkg_postinst() {
537 debug-print-function ${FUNCNAME} "$@"
538
539 gnome2_icon_cache_update
540 fdo-mime_desktop_database_update
541 }
542
543 # @FUNCTION: kde5_pkg_postrm
544 # @DESCRIPTION:
545 # Function to rebuild the KDE System Configuration Cache after an application has been removed.
546 kde5_pkg_postrm() {
547 debug-print-function ${FUNCNAME} "$@"
548
549 gnome2_icon_cache_update
550 fdo-mime_desktop_database_update
551 }
552
553 fi

  ViewVC Help
Powered by ViewVC 1.1.20