/[gentoo-x86]/eclass/kde4-functions.eclass
Gentoo

Diff of /eclass/kde4-functions.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 Revision 1.6
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-2008 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.2 2008/02/03 15:03:02 zlin Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.6 2008/05/15 19:49:32 ingmar Exp $
4 4
5# @ECLASS: kde4-functions.eclass 5# @ECLASS: kde4-functions.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# kde@gentoo.org 7# kde@gentoo.org
8# @BLURB: Common ebuild functions for monolithic and split KDE 4 packages 8# @BLURB: Common ebuild functions for monolithic and split KDE 4 packages
63kde-base/kdebase kde-base/kappfinder 63kde-base/kdebase kde-base/kappfinder
64kde-base/kdebase kde-base/kdepasswd 64kde-base/kdebase kde-base/kdepasswd
65kde-base/kdebase kde-base/kdialog 65kde-base/kdebase kde-base/kdialog
66kde-base/kdebase kde-base/keditbookmarks 66kde-base/kdebase kde-base/keditbookmarks
67kde-base/kdebase kde-base/kfind 67kde-base/kdebase kde-base/kfind
68kde-base/kdebase kde-base/kinfocenter
68kde-base/kdebase kde-base/konqueror 69kde-base/kdebase kde-base/konqueror
69kde-base/kdebase kde-base/konsole 70kde-base/kdebase kde-base/konsole
70kde-base/kdebase kde-base/kwrite 71kde-base/kdebase kde-base/kwrite
71kde-base/kdebase kde-base/libkonq 72kde-base/kdebase kde-base/libkonq
72kde-base/kdebase kde-base/nsplugins 73kde-base/kdebase kde-base/nsplugins
78kde-base/kdebase kde-base/kdebugdialog 79kde-base/kdebase kde-base/kdebugdialog
79kde-base/kdebase kde-base/kde-menu 80kde-base/kdebase kde-base/kde-menu
80kde-base/kdebase kde-base/kdesu 81kde-base/kdebase kde-base/kdesu
81kde-base/kdebase kde-base/kfile 82kde-base/kdebase kde-base/kfile
82kde-base/kdebase kde-base/khelpcenter 83kde-base/kdebase kde-base/khelpcenter
84kde-base/kdebase kde-base/kiconfinder
83kde-base/kdebase kde-base/kioclient 85kde-base/kdebase kde-base/kioclient
84kde-base/kdebase kde-base/kmimetypefinder 86kde-base/kdebase kde-base/kmimetypefinder
85kde-base/kdebase kde-base/knetattach 87kde-base/kdebase kde-base/knetattach
86kde-base/kdebase kde-base/knewstuff 88kde-base/kdebase kde-base/knewstuff
87kde-base/kdebase kde-base/knotify 89kde-base/kdebase kde-base/knotify
94kde-base/kdebase kde-base/ktraderclient 96kde-base/kdebase kde-base/ktraderclient
95kde-base/kdebase kde-base/kuiserver 97kde-base/kdebase kde-base/kuiserver
96kde-base/kdebase kde-base/kurifilter-plugins 98kde-base/kdebase kde-base/kurifilter-plugins
97kde-base/kdebase kde-base/nepomuk 99kde-base/kdebase kde-base/nepomuk
98kde-base/kdebase kde-base/phonon 100kde-base/kdebase kde-base/phonon
101kde-base/kdebase kde-base/solid-hardware
99kde-base/kdebase kde-base/soliduiserver 102kde-base/kdebase kde-base/soliduiserver
100kde-base/kdebase kde-base/kcheckpass 103kde-base/kdebase kde-base/kcheckpass
101kde-base/kdebase kde-base/kcminit 104kde-base/kdebase kde-base/kcminit
102kde-base/kdebase kde-base/kdebase-startkde 105kde-base/kdebase kde-base/kdebase-startkde
103kde-base/kdebase kde-base/kstartupconfig 106kde-base/kdebase kde-base/kstartupconfig
152kde-base/kdeedu kde-base/kturtle 155kde-base/kdeedu kde-base/kturtle
153kde-base/kdeedu kde-base/kwordquiz 156kde-base/kdeedu kde-base/kwordquiz
154kde-base/kdeedu kde-base/libkdeedu 157kde-base/kdeedu kde-base/libkdeedu
155kde-base/kdeedu kde-base/marble 158kde-base/kdeedu kde-base/marble
156kde-base/kdeedu kde-base/parley 159kde-base/kdeedu kde-base/parley
160kde-base/kdeedu kde-base/step
157kde-base/kdegames kde-base/bovo 161kde-base/kdegames kde-base/bovo
158kde-base/kdegames kde-base/katomic 162kde-base/kdegames kde-base/katomic
159kde-base/kdegames kde-base/kbattleship 163kde-base/kdegames kde-base/kbattleship
160kde-base/kdegames kde-base/kblackbox 164kde-base/kdegames kde-base/kblackbox
161kde-base/kdegames kde-base/kbounce 165kde-base/kdegames kde-base/kbounce
166kde-base/kdegames kde-base/kdiamond
162kde-base/kdegames kde-base/kfourinline 167kde-base/kdegames kde-base/kfourinline
163kde-base/kdegames kde-base/kgoldrunner 168kde-base/kdegames kde-base/kgoldrunner
164kde-base/kdegames kde-base/kiriki 169kde-base/kdegames kde-base/kiriki
165kde-base/kdegames kde-base/kjumpingcube 170kde-base/kdegames kde-base/kjumpingcube
166kde-base/kdegames kde-base/klines 171kde-base/kdegames kde-base/klines
167kde-base/kdegames kde-base/kmahjongg 172kde-base/kdegames kde-base/kmahjongg
168kde-base/kdegames kde-base/kmines 173kde-base/kdegames kde-base/kmines
169kde-base/kdegames kde-base/knetwalk 174kde-base/kdegames kde-base/knetwalk
170kde-base/kdegames kde-base/kolf 175kde-base/kdegames kde-base/kolf
176kde-base/kdegames kde-base/kollision
171kde-base/kdegames kde-base/konquest 177kde-base/kdegames kde-base/konquest
172kde-base/kdegames kde-base/kpat 178kde-base/kdegames kde-base/kpat
173kde-base/kdegames kde-base/kreversi 179kde-base/kdegames kde-base/kreversi
174kde-base/kdegames kde-base/ksame 180kde-base/kdegames kde-base/ksame
175kde-base/kdegames kde-base/kshisen 181kde-base/kdegames kde-base/kshisen
176kde-base/kdegames kde-base/kspaceduel 182kde-base/kdegames kde-base/kspaceduel
177kde-base/kdegames kde-base/ksquares 183kde-base/kdegames kde-base/ksquares
178kde-base/kdegames kde-base/ksudoku 184kde-base/kdegames kde-base/ksudoku
179kde-base/kdegames kde-base/ktuberling 185kde-base/kdegames kde-base/ktuberling
186kde-base/kdegames kde-base/kubrick
180kde-base/kdegames kde-base/libkdegames 187kde-base/kdegames kde-base/libkdegames
181kde-base/kdegames kde-base/libkmahjongg 188kde-base/kdegames kde-base/libkmahjongg
182kde-base/kdegames kde-base/lskat 189kde-base/kdegames kde-base/lskat
183kde-base/kdegraphics kde-base/gwenview 190kde-base/kdegraphics kde-base/gwenview
184kde-base/kdegraphics kde-base/kamera 191kde-base/kdegraphics kde-base/kamera
189kde-base/kdegraphics kde-base/kruler 196kde-base/kdegraphics kde-base/kruler
190kde-base/kdegraphics kde-base/ksnapshot 197kde-base/kdegraphics kde-base/ksnapshot
191kde-base/kdegraphics kde-base/libkscan 198kde-base/kdegraphics kde-base/libkscan
192kde-base/kdegraphics kde-base/okular 199kde-base/kdegraphics kde-base/okular
193kde-base/kdegraphics kde-base/svgpart 200kde-base/kdegraphics kde-base/svgpart
201kde-base/kdemultimedia kde-base/dragonplayer
194kde-base/kdemultimedia kde-base/juk 202kde-base/kdemultimedia kde-base/juk
195kde-base/kdemultimedia kde-base/kdemultimedia-kioslaves 203kde-base/kdemultimedia kde-base/kdemultimedia-kioslaves
196kde-base/kdemultimedia kde-base/kmix 204kde-base/kdemultimedia kde-base/kmix
197kde-base/kdemultimedia kde-base/kscd 205kde-base/kdemultimedia kde-base/kscd
198kde-base/kdemultimedia kde-base/libkcddb 206kde-base/kdemultimedia kde-base/libkcddb
267kde-base/kdeutils kde-base/ark 275kde-base/kdeutils kde-base/ark
268kde-base/kdeutils kde-base/kcalc 276kde-base/kdeutils kde-base/kcalc
269kde-base/kdeutils kde-base/kcharselect 277kde-base/kdeutils kde-base/kcharselect
270kde-base/kdeutils kde-base/kdessh 278kde-base/kdeutils kde-base/kdessh
271kde-base/kdeutils kde-base/kdf 279kde-base/kdeutils kde-base/kdf
272kde-base/kdeutils kde-base/kedit
273kde-base/kdeutils kde-base/kfloppy 280kde-base/kdeutils kde-base/kfloppy
274kde-base/kdeutils kde-base/kgpg 281kde-base/kdeutils kde-base/kgpg
275kde-base/kdeutils kde-base/khexedit
276kde-base/kdeutils kde-base/kjots 282kde-base/kdeutils kde-base/kjots
277kde-base/kdeutils kde-base/kmilo 283kde-base/kdeutils kde-base/kmilo
278kde-base/kdeutils kde-base/kregexpeditor 284kde-base/kdeutils kde-base/kregexpeditor
279kde-base/kdeutils kde-base/kdessh 285kde-base/kdeutils kde-base/kdessh
280kde-base/kdeutils kde-base/ktimer 286kde-base/kdeutils kde-base/ktimer
348# 354#
349# Note that kde4-base.eclass already does this. 355# Note that kde4-base.eclass already does this.
350buildsycoca() { 356buildsycoca() {
351 debug-print-function ${FUNCNAME} "$@" 357 debug-print-function ${FUNCNAME} "$@"
352 358
353 if [[ -x ${KDEDIR}/bin/kbuildsycoca4 ]] && [[ -z "${ROOT}" || "${ROOT}" == "/" ]]; then 359 if [[ -x ${KDEDIR}/bin/kbuildsycoca4 && -z "${ROOT%%/}" ]]; then
354 # First of all, make sure that the /usr/share/services directory exists 360 # First of all, make sure that the /usr/share/services directory exists
355 # and it has the right permissions 361 # and it has the right permissions
356 mkdir -p /usr/share/services 362 mkdir -p /usr/share/services
357 chown root:0 /usr/share/services 363 chown root:0 /usr/share/services
358 chmod 0755 /usr/share/services 364 chmod 0755 /usr/share/services
359 365
360 # kbuildsycoca4 needs a running dbus session to work correctly. 366 # kbuildsycoca4 needs a running dbus session to work correctly.
361 # We have to start a new dbus session, because the DBUS_SESSION_BUS_ADDRESS in the environment 367 # We have to start a new dbus session, because the DBUS_SESSION_BUS_ADDRESS in the environment
362 # could from from the user's environment (through su [without '-']), causing kbuildsycoca4 to hang. 368 # could from from the user's environment (through su [without '-']), causing kbuildsycoca4 to hang.
363 369
364 einfo "Starting dbus session for kbuildsycoca4" 370 echo "Starting dbus session for kbuildsycoca4"
365 local _i 371 local _i
366 for _i in $(dbus-launch); do 372 for _i in $(dbus-launch); do
367 # We export both the ADDRESS _and_ the PID. We need the latter only to kill our session. 373 # We export both the ADDRESS _and_ the PID. We need the latter only to kill our session.
368 debug-print "Exporting: ${_i}" 374 debug-print "Exporting: ${_i}"
369 export "${_i}"; 375 export "${_i}";
370 done 376 done
371 debug-print "kbuildsycoca4 is using ${DBUS_SESSION_BUS_ADDRESS}" 377 debug-print "kbuildsycoca4 is using ${DBUS_SESSION_BUS_ADDRESS}"
372 378
373 ebegin "Running kbuildsycoca4 to build global database" 379 ebegin "Running kbuildsycoca4 to build global database"
374 # This is needed because we support multiple kde versions installed together. 380 # This is needed because we support multiple kde versions installed together.
375 XDG_DATA_DIRS="/usr/share:${KDEDIRS}/share:/usr/local/share" 381 XDG_DATA_DIRS="/usr/share:${KDEDIRS//:/\/share:}/share:/usr/local/share" \
376 ${KDEDIR}/bin/kbuildsycoca4 --global --noincremental &> /dev/null 382 ${KDEDIR}/bin/kbuildsycoca4 --global --noincremental &> /dev/null
377 eend $? 383 eend $?
378 384
379 einfo "Killing dbus session for kbuildsycoca4" 385 echo "Killing dbus session for kbuildsycoca4"
380 debug-print "ADDRES ${DBUS_SESSION_BUS_ADDRESS}" 386 debug-print "ADDRESS ${DBUS_SESSION_BUS_ADDRESS}"
381 debug-print "PID: ${DBUS_SESSION_BUS_PID}" 387 debug-print "PID: ${DBUS_SESSION_BUS_PID}"
382 kill ${DBUS_SESSION_BUS_PID} 388 kill ${DBUS_SESSION_BUS_PID}
383 eend $? 389 eend $?
384 unset DBUS_SESSION_BUS_ADDRES DBUS_SESSION_BUS_PID 390 unset DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID
385 391
386 # For some reason this directory gets created with noone other than root 392 # For some reason this directory gets created with noone other than root
387 # being able to read it. Hence we chmod it. 393 # being able to read it. Hence we chmod it.
388 chmod -R 0755 "${ROOT}"/usr/share/kde4 394 chmod -R 0755 "${ROOT}"/usr/share/kde4
389 fi 395 fi
394# @DESCRIPTION: 400# @DESCRIPTION:
395# recursively comment all add_subdirectory instructions in listed directories 401# recursively comment all add_subdirectory instructions in listed directories
396# except the ones in cmake/. 402# except the ones in cmake/.
397comment_all_add_subdirectory() { 403comment_all_add_subdirectory() {
398 find "$@" -name CMakeLists.txt -print0 | grep -vFzZ "./cmake" | \ 404 find "$@" -name CMakeLists.txt -print0 | grep -vFzZ "./cmake" | \
399 xargs -0 sed -i -e '/add_subdirectory/s/^/#DONOTCOMPILE /' || \ 405 xargs -0 sed -i -e '/add_subdirectory/s/^/#DONOTCOMPILE /' -e '/ADD_SUBDIRECTORY/s/^/#DONOTCOMPILE /' || \
400 die "${LINENO}: Initial sed died" 406 die "${LINENO}: Initial sed died"
407}
408
409# @ECLASS-VARIABLE: KDE_LINGUAS
410# @DESCRIPTION:
411# This is a whitespace-separated list of translations that this ebuild supports.
412# These translations automatically get added to IUSE. Therefore ebuilds must set
413# this variable before inheriting any eclasses. To only enable selected
414# translations ebuilds must call enable_selected_linguas(). kde4-base.eclass does
415# this for you.
416#
417# Example: KDE_LINGUAS="en_GB de nl"
418for _lingua in ${KDE_LINGUAS}; do
419 IUSE="${IUSE} linguas_${_lingua}"
420done
421
422# @FUNCTION: enable_selected_linguas
423# @DESCRIPTION:
424# Enable translations based on LINGUAS settings and what translations are
425# supported (see KDE_LINGUAS). By default translations are found in "${S}"/po
426# but this default can be overridden by defining KDE_LINGUAS_DIR.
427enable_selected_linguas() {
428 local lingua
429 comment_all_add_subdirectory "${KDE_LINGUAS_DIR:-${S}/po}"
430 for lingua in ${KDE_LINGUAS}; do
431 if use linguas_${lingua}; then
432 sed -e "/add_subdirectory([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
433 -e "/ADD_SUBDIRECTORY([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
434 -i "${KDE_LINGUAS_DIR:-${S}/po}"/CMakeLists.txt || die "Sed to uncomment linguas_${lingua} failed."
435 fi
436 done
401} 437}
402 438
403# @ECLASS-VARIABLE: QT4_BUILT_WITH_USE_CHECK 439# @ECLASS-VARIABLE: QT4_BUILT_WITH_USE_CHECK
404# @DESCRIPTION: 440# @DESCRIPTION:
405# A list of USE flags that x11-libs/qt:4 needs to be built with. 441# A list of USE flags that x11-libs/qt:4 needs to be built with.
468kde4-functions_check_use() { 504kde4-functions_check_use() {
469 # I like to keep flags sorted 505 # I like to keep flags sorted
470 QT4_BUILT_WITH_USE_CHECK=$(echo "${QT4_BUILT_WITH_USE_CHECK}" | \ 506 QT4_BUILT_WITH_USE_CHECK=$(echo "${QT4_BUILT_WITH_USE_CHECK}" | \
471 tr '[:space:]' '\n' | sort | xargs) 507 tr '[:space:]' '\n' | sort | xargs)
472 508
509 local line missing
510 if [[ -n ${KDE4_BUILT_WITH_USE_CHECK[@]} && $(declare -p KDE4_BUILT_WITH_USE_CHECK) = 'declare -a '* ]]; then
511 KDE4_BUILT_WITH_USE_CHECK=("x11-libs/qt:4 ${QT4_BUILT_WITH_USE_CHECK}"
512 "${KDE4_BUILT_WITH_USE_CHECK[@]}")
513
514 for line in "${KDE4_BUILT_WITH_USE_CHECK[@]}"; do
515 [[ -z ${line} ]] && continue
516 if ! _kde4-functions_built_with_use ${line}; then
517 missing=true
518 fi
519 done
520 else
473 KDE4_BUILT_WITH_USE_CHECK="x11-libs/qt:4 ${QT4_BUILT_WITH_USE_CHECK} 521 KDE4_BUILT_WITH_USE_CHECK="x11-libs/qt:4 ${QT4_BUILT_WITH_USE_CHECK}
474 ${KDE4_BUILT_WITH_USE_CHECK}" 522 ${KDE4_BUILT_WITH_USE_CHECK}"
475 523
476 local line missing
477 while read line; do 524 while read line; do
478 [[ -z ${line} ]] && continue 525 [[ -z ${line} ]] && continue
479 if ! _kde4-functions_built_with_use ${line}; then 526 if ! _kde4-functions_built_with_use ${line}; then
480 missing=true 527 missing=true
481 fi 528 fi
482 done <<< "${KDE4_BUILT_WITH_USE_CHECK}" 529 done <<< "${KDE4_BUILT_WITH_USE_CHECK}"
530 fi
483 if [[ -n ${missing} ]]; then 531 if [[ -n ${missing} ]]; then
484 echo 532 echo
485 eerror "Flags marked with an * are missing." 533 eerror "Flags marked with an * are missing."
486 die "Missing USE flags found" 534 die "Missing USE flags found"
487 fi 535 fi

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.20