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

Contents of /eclass/kde4-functions.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Mon Mar 10 21:40:05 2008 UTC (6 years, 4 months ago) by zlin
Branch: MAIN
Changes since 1.2: +2 -1 lines
Add kinfocenter to KDE4_DERIVATION_MAP for KDE 4.0.2.

1 ingmar 1.1 # Copyright 1999-2008 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 zlin 1.3 # $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.2 2008/02/03 15:03:02 zlin Exp $
4 ingmar 1.1
5     # @ECLASS: kde4-functions.eclass
6     # @MAINTAINER:
7     # kde@gentoo.org
8     # @BLURB: Common ebuild functions for monolithic and split KDE 4 packages
9     # @DESCRIPTION:
10     # This eclass contains all functions shared by the different eclasses,
11     # for KDE 4 monolithic and split ebuilds.
12     #
13     # NOTE: This eclass uses the SLOT dependencies from EAPI="1" or compatible,
14     # hence you must define EAPI="1" in the ebuild, before inheriting any eclasses.
15    
16     # @ECLASS-VARIABLE: KDEBASE
17     # @DESCRIPTION:
18     # This gets set to a non-zero value when a package is considered a kde or
19     # koffice ebuild.
20    
21     if [[ "${CATEGORY}" == "kde-base" ]]; then
22     debug-print "${ECLASS}: KDEBASE ebuild recognized"
23     KDEBASE="kde-base"
24     fi
25    
26     # is this a koffice ebuild?
27     if [[ "${KMNAME}" == "koffice" || "${PN}" == "koffice" ]]; then
28     debug-print "${ECLASS}: KOFFICE ebuild recognized"
29     KDEBASE="koffice"
30     fi
31    
32     # @ECLASS-VARIABLE: KDE_DERIVATION_MAP
33     # @DESCRIPTION:
34     # Map of the monolithic->split ebuild derivation.
35     # Used to build dependencies describing the relationships between them:
36     # Monolithic ebuilds block their split counterparts in the same slot, and vice versa.
37     #
38     # Also see get-parent-package(), get-child-packages(), is-parent-package()
39     KDE_DERIVATION_MAP='
40     kde-base/kdeaccessibility kde-base/kdeaccessibility-colorschemes
41     kde-base/kdeaccessibility kde-base/kdeaccessibility-iconthemes
42     kde-base/kdeaccessibility kde-base/kmag
43     kde-base/kdeaccessibility kde-base/kmousetool
44     kde-base/kdeaccessibility kde-base/kmouth
45     kde-base/kdeaccessibility kde-base/kttsd
46     kde-base/kdeadmin kde-base/kcron
47     kde-base/kdeadmin kde-base/kdat
48     kde-base/kdeadmin kde-base/knetworkconf
49     kde-base/kdeadmin kde-base/ksysv
50     kde-base/kdeadmin kde-base/kuser
51     kde-base/kdeadmin kde-base/lilo-config
52     kde-base/kdeadmin kde-base/secpolicy
53     kde-base/kdeartwork kde-base/kdeartwork-colorschemes
54     kde-base/kdeartwork kde-base/kdeartwork-emoticons
55     kde-base/kdeartwork kde-base/kdeartwork-icewm-themes
56     kde-base/kdeartwork kde-base/kdeartwork-iconthemes
57     kde-base/kdeartwork kde-base/kdeartwork-kscreensaver
58     kde-base/kdeartwork kde-base/kdeartwork-kworldclock
59     kde-base/kdeartwork kde-base/kdeartwork-sounds
60     kde-base/kdeartwork kde-base/kdeartwork-styles
61     kde-base/kdeartwork kde-base/kdeartwork-wallpapers
62     kde-base/kdebase kde-base/dolphin
63     kde-base/kdebase kde-base/kappfinder
64     kde-base/kdebase kde-base/kdepasswd
65     kde-base/kdebase kde-base/kdialog
66     kde-base/kdebase kde-base/keditbookmarks
67     kde-base/kdebase kde-base/kfind
68 zlin 1.3 kde-base/kdebase kde-base/kinfocenter
69 ingmar 1.1 kde-base/kdebase kde-base/konqueror
70     kde-base/kdebase kde-base/konsole
71     kde-base/kdebase kde-base/kwrite
72     kde-base/kdebase kde-base/libkonq
73     kde-base/kdebase kde-base/nsplugins
74     kde-base/kdebase kde-base/drkonqi
75     kde-base/kdebase kde-base/kcmshell
76     kde-base/kdebase kde-base/kcontrol
77     kde-base/kdebase kde-base/kdebase-data
78     kde-base/kdebase kde-base/kdebase-kioslaves
79     kde-base/kdebase kde-base/kdebugdialog
80     kde-base/kdebase kde-base/kde-menu
81     kde-base/kdebase kde-base/kdesu
82     kde-base/kdebase kde-base/kfile
83     kde-base/kdebase kde-base/khelpcenter
84     kde-base/kdebase kde-base/kioclient
85     kde-base/kdebase kde-base/kmimetypefinder
86     kde-base/kdebase kde-base/knetattach
87     kde-base/kdebase kde-base/knewstuff
88     kde-base/kdebase kde-base/knotify
89     kde-base/kdebase kde-base/kpasswdserver
90     kde-base/kdebase kde-base/kquitapp
91     kde-base/kdebase kde-base/kreadconfig
92     kde-base/kdebase kde-base/kstart
93     kde-base/kdebase kde-base/kstyles
94     kde-base/kdebase kde-base/ktimezoned
95     kde-base/kdebase kde-base/ktraderclient
96     kde-base/kdebase kde-base/kuiserver
97     kde-base/kdebase kde-base/kurifilter-plugins
98     kde-base/kdebase kde-base/nepomuk
99     kde-base/kdebase kde-base/phonon
100     kde-base/kdebase kde-base/soliduiserver
101     kde-base/kdebase kde-base/kcheckpass
102     kde-base/kdebase kde-base/kcminit
103     kde-base/kdebase kde-base/kdebase-startkde
104     kde-base/kdebase kde-base/kstartupconfig
105     kde-base/kdebase kde-base/kde-menu-icons
106     kde-base/kdebase kde-base/kde-wallpapers
107     kde-base/kdebase kde-base/kdm
108     kde-base/kdebase kde-base/khotkeys
109     kde-base/kdebase kde-base/klipper
110     kde-base/kdebase kde-base/kmenuedit
111     kde-base/kdebase kde-base/krunner
112     kde-base/kdebase kde-base/kscreensaver
113     kde-base/kdebase kde-base/ksmserver
114     kde-base/kdebase kde-base/ksplash
115     kde-base/kdebase kde-base/ksysguard
116     kde-base/kdebase kde-base/ksystraycmd
117     kde-base/kdebase kde-base/ktip
118     kde-base/kdebase kde-base/kwin
119     kde-base/kdebase kde-base/libkworkspace
120     kde-base/kdebase kde-base/libplasma
121     kde-base/kdebase kde-base/libtaskmanager
122     kde-base/kdebase kde-base/plasma
123     kde-base/kdebase kde-base/solid
124     kde-base/kdebase kde-base/systemsettings
125     kde-base/kdebindings kde-base/kalyptus
126     kde-base/kdebindings kde-base/kdejava
127     kde-base/kdebindings kde-base/kimono
128     kde-base/kdebindings kde-base/kjsembed
129     kde-base/kdebindings kde-base/korundum
130     kde-base/kdebindings kde-base/krosspython
131     kde-base/kdebindings kde-base/krossruby
132     kde-base/kdebindings kde-base/pykde4
133     kde-base/kdebindings kde-base/qyoto
134     kde-base/kdebindings kde-base/qtjava
135     kde-base/kdebindings kde-base/qtruby
136     kde-base/kdebindings kde-base/qtsharp
137     kde-base/kdebindings kde-base/smoke
138     kde-base/kdebindings kde-base/xparts
139     kde-base/kdeedu kde-base/blinken
140     kde-base/kdeedu kde-base/kalgebra
141     kde-base/kdeedu kde-base/kalzium
142     kde-base/kdeedu kde-base/kanagram
143     kde-base/kdeedu kde-base/kbruch
144     kde-base/kdeedu kde-base/kgeography
145     kde-base/kdeedu kde-base/khangman
146     kde-base/kdeedu kde-base/kig
147     kde-base/kdeedu kde-base/kiten
148     kde-base/kdeedu kde-base/klettres
149     kde-base/kdeedu kde-base/kmplot
150     kde-base/kdeedu kde-base/kpercentage
151     kde-base/kdeedu kde-base/kstars
152     kde-base/kdeedu kde-base/ktouch
153     kde-base/kdeedu kde-base/kturtle
154     kde-base/kdeedu kde-base/kwordquiz
155     kde-base/kdeedu kde-base/libkdeedu
156     kde-base/kdeedu kde-base/marble
157     kde-base/kdeedu kde-base/parley
158     kde-base/kdegames kde-base/bovo
159     kde-base/kdegames kde-base/katomic
160     kde-base/kdegames kde-base/kbattleship
161     kde-base/kdegames kde-base/kblackbox
162     kde-base/kdegames kde-base/kbounce
163     kde-base/kdegames kde-base/kfourinline
164     kde-base/kdegames kde-base/kgoldrunner
165     kde-base/kdegames kde-base/kiriki
166     kde-base/kdegames kde-base/kjumpingcube
167     kde-base/kdegames kde-base/klines
168     kde-base/kdegames kde-base/kmahjongg
169     kde-base/kdegames kde-base/kmines
170     kde-base/kdegames kde-base/knetwalk
171     kde-base/kdegames kde-base/kolf
172     kde-base/kdegames kde-base/konquest
173     kde-base/kdegames kde-base/kpat
174     kde-base/kdegames kde-base/kreversi
175     kde-base/kdegames kde-base/ksame
176     kde-base/kdegames kde-base/kshisen
177     kde-base/kdegames kde-base/kspaceduel
178     kde-base/kdegames kde-base/ksquares
179     kde-base/kdegames kde-base/ksudoku
180     kde-base/kdegames kde-base/ktuberling
181     kde-base/kdegames kde-base/libkdegames
182     kde-base/kdegames kde-base/libkmahjongg
183     kde-base/kdegames kde-base/lskat
184     kde-base/kdegraphics kde-base/gwenview
185     kde-base/kdegraphics kde-base/kamera
186     kde-base/kdegraphics kde-base/kcolorchooser
187     kde-base/kdegraphics kde-base/kgamma
188     kde-base/kdegraphics kde-base/kghostview
189     kde-base/kdegraphics kde-base/kolourpaint
190     kde-base/kdegraphics kde-base/kruler
191     kde-base/kdegraphics kde-base/ksnapshot
192     kde-base/kdegraphics kde-base/libkscan
193     kde-base/kdegraphics kde-base/okular
194     kde-base/kdegraphics kde-base/svgpart
195     kde-base/kdemultimedia kde-base/juk
196     kde-base/kdemultimedia kde-base/kdemultimedia-kioslaves
197     kde-base/kdemultimedia kde-base/kmix
198     kde-base/kdemultimedia kde-base/kscd
199     kde-base/kdemultimedia kde-base/libkcddb
200     kde-base/kdemultimedia kde-base/libkcompactdisc
201     kde-base/kdenetwork kde-base/kdenetwork-filesharing
202     kde-base/kdenetwork kde-base/kdnssd
203     kde-base/kdenetwork kde-base/kget
204     kde-base/kdenetwork kde-base/knewsticker
205     kde-base/kdenetwork kde-base/kopete
206     kde-base/kdenetwork kde-base/kppp
207     kde-base/kdenetwork kde-base/krdc
208     kde-base/kdenetwork kde-base/krfb
209     kde-base/kdepim kde-base/akonadi
210     kde-base/kdepim kde-base/akregator
211     kde-base/kdepim kde-base/certmanager
212     kde-base/kdepim kde-base/kabc2mutt
213     kde-base/kdepim kde-base/kabcclient
214     kde-base/kdepim kde-base/kaddressbook
215     kde-base/kdepim kde-base/kalarm
216     kde-base/kdepim kde-base/kdemaildir
217     kde-base/kdepim kde-base/kdepim-kioslaves
218     kde-base/kdepim kde-base/kdepim-kresources
219     kde-base/kdepim kde-base/kdepim-wizards
220     kde-base/kdepim kde-base/kfeed
221     kde-base/kdepim kde-base/kitchensync
222     kde-base/kdepim kde-base/kleopatra
223     kde-base/kdepim kde-base/kmail
224     kde-base/kdepim kde-base/kmailcvt
225     kde-base/kdepim kde-base/kmobiletools
226     kde-base/kdepim kde-base/knode
227     kde-base/kdepim kde-base/knotes
228     kde-base/kdepim kde-base/kode
229     kde-base/kdepim kde-base/konsolekalendar
230     kde-base/kdepim kde-base/kontact
231     kde-base/kdepim kde-base/kontact-specialdates
232     kde-base/kdepim kde-base/korganizer
233     kde-base/kdepim kde-base/korn
234     kde-base/kdepim kde-base/kpilot
235     kde-base/kdepim kde-base/ktimetracker
236     kde-base/kdepim kde-base/ktnef
237     kde-base/kdepim kde-base/libkdepim
238     kde-base/kdepim kde-base/libkholidays
239     kde-base/kdepim kde-base/libkleo
240     kde-base/kdepim kde-base/libkpgp
241     kde-base/kdepim kde-base/libksieve
242     kde-base/kdepim kde-base/mailtransport
243     kde-base/kdepim kde-base/mimelib
244     kde-base/kdepim kde-base/networkstatus
245     kde-base/kdesdk kde-base/cervisia
246     kde-base/kdesdk kde-base/kdeaccounts-plugin
247     kde-base/kdesdk kde-base/kapptemplate
248     kde-base/kdesdk kde-base/kate
249     kde-base/kdesdk kde-base/kbabel
250     kde-base/kdesdk kde-base/kbugbuster
251     kde-base/kdesdk kde-base/kcachegrind
252     kde-base/kdesdk kde-base/kdesdk-kioslaves
253     kde-base/kdesdk kde-base/kdesdk-misc
254     kde-base/kdesdk kde-base/kdesdk-scripts
255     kde-base/kdesdk kde-base/kmtrace
256     kde-base/kdesdk kde-base/kompare
257     kde-base/kdesdk kde-base/kspy
258     kde-base/kdesdk kde-base/kstartperf
259     kde-base/kdesdk kde-base/strigi-analyzer
260     kde-base/kdesdk kde-base/kuiviewer
261     kde-base/kdesdk kde-base/poxml
262     kde-base/kdesdk kde-base/umbrello
263     kde-base/kdetoys kde-base/amor
264     kde-base/kdetoys kde-base/kteatime
265     kde-base/kdetoys kde-base/ktux
266     kde-base/kdetoys kde-base/kweather
267     kde-base/kdetoys kde-base/kworldclock
268     kde-base/kdeutils kde-base/ark
269     kde-base/kdeutils kde-base/kcalc
270     kde-base/kdeutils kde-base/kcharselect
271     kde-base/kdeutils kde-base/kdessh
272     kde-base/kdeutils kde-base/kdf
273     kde-base/kdeutils kde-base/kedit
274     kde-base/kdeutils kde-base/kfloppy
275     kde-base/kdeutils kde-base/kgpg
276     kde-base/kdeutils kde-base/khexedit
277     kde-base/kdeutils kde-base/kjots
278     kde-base/kdeutils kde-base/kmilo
279     kde-base/kdeutils kde-base/kregexpeditor
280     kde-base/kdeutils kde-base/kdessh
281     kde-base/kdeutils kde-base/ktimer
282     kde-base/kdeutils kde-base/kwallet
283     kde-base/kdeutils kde-base/superkaramba
284     kde-base/kdeutils kde-base/sweeper
285     kde-base/kdewebdev kde-base/kfilereplace
286     kde-base/kdewebdev kde-base/kimagemapeditor
287     kde-base/kdewebdev kde-base/klinkstatus
288     kde-base/kdewebdev kde-base/kxsldbg
289     kde-base/kdewebdev kde-base/quanta
290     app-office/koffice app-office/karbon
291     app-office/koffice app-office/kchart
292     app-office/koffice app-office/kexi
293     app-office/koffice app-office/kformula
294     app-office/koffice app-office/kivio
295     app-office/koffice app-office/koffice-data
296     app-office/koffice app-office/koffice-libs
297     app-office/koffice app-office/koshell
298     app-office/koffice app-office/kplato
299     app-office/koffice app-office/kpresenter
300     app-office/koffice app-office/krita
301     app-office/koffice app-office/kspread
302     app-office/koffice app-office/kugar
303     app-office/koffice app-office/kword
304     '
305    
306     # @FUNCTION: get-parent-package
307     # @USAGE: <split ebuild>
308     # @DESCRIPTION:
309     # Echoes the name of the monolithic package that a given split ebuild was derived from.
310     get-parent-package() {
311     local parent child
312     while read parent child; do
313     if [[ "${child}" == "$1" ]]; then
314     echo ${parent}
315     return 0
316     fi
317     done <<< "$KDE_DERIVATION_MAP"
318     die "Package $target not found in KDE_DERIVATION_MAP, please report bug"
319     }
320    
321     # @FUNCTION: get-child-packages
322     # @USAGE: <monolithic ebuild>
323     # @DESCRIPTION:
324     # Echoes the names of all (split) ebuilds derived from a given monolithic ebuild.
325     get-child-packages() {
326     local parent child
327     while read parent child; do
328     [[ "${parent}" == "$1" ]] && echo -n "${child} "
329     done <<< "$KDE_DERIVATION_MAP"
330     }
331    
332     # @FUNCTION: is-parent-package
333     # @USAGE: <$CATEGORY/$PN>
334     # @DESCRIPTION:
335     # Returns zero exit-status if the given package is a parent (monolithic) ebuild.
336     # Returns non-zero exit-status if it's not.
337     is-parent-package() {
338     local parent child
339     while read parent child; do
340     [[ "${parent}" == "$1" ]] && return 0
341     done <<< "$KDE_DERIVATION_MAP"
342     return 1
343     }
344    
345     # @FUNCTION: buildsycoca
346     # @DESCRIPTION:
347     # Function to rebuild the KDE System Configuration Cache.
348     # All KDE ebuilds should run this in pkg_postinst and pkg_postrm.
349     #
350     # Note that kde4-base.eclass already does this.
351     buildsycoca() {
352     debug-print-function ${FUNCNAME} "$@"
353    
354     if [[ -x ${KDEDIR}/bin/kbuildsycoca4 ]] && [[ -z "${ROOT}" || "${ROOT}" == "/" ]]; then
355     # First of all, make sure that the /usr/share/services directory exists
356     # and it has the right permissions
357     mkdir -p /usr/share/services
358     chown root:0 /usr/share/services
359     chmod 0755 /usr/share/services
360    
361     # kbuildsycoca4 needs a running dbus session to work correctly.
362     # We have to start a new dbus session, because the DBUS_SESSION_BUS_ADDRESS in the environment
363     # could from from the user's environment (through su [without '-']), causing kbuildsycoca4 to hang.
364    
365     einfo "Starting dbus session for kbuildsycoca4"
366     local _i
367     for _i in $(dbus-launch); do
368     # We export both the ADDRESS _and_ the PID. We need the latter only to kill our session.
369     debug-print "Exporting: ${_i}"
370     export "${_i}";
371     done
372     debug-print "kbuildsycoca4 is using ${DBUS_SESSION_BUS_ADDRESS}"
373    
374     ebegin "Running kbuildsycoca4 to build global database"
375     # This is needed because we support multiple kde versions installed together.
376     XDG_DATA_DIRS="/usr/share:${KDEDIRS}/share:/usr/local/share"
377     ${KDEDIR}/bin/kbuildsycoca4 --global --noincremental &> /dev/null
378     eend $?
379    
380     einfo "Killing dbus session for kbuildsycoca4"
381     debug-print "ADDRES ${DBUS_SESSION_BUS_ADDRESS}"
382     debug-print "PID: ${DBUS_SESSION_BUS_PID}"
383     kill ${DBUS_SESSION_BUS_PID}
384     eend $?
385     unset DBUS_SESSION_BUS_ADDRES DBUS_SESSION_BUS_PID
386 zlin 1.2
387     # For some reason this directory gets created with noone other than root
388     # being able to read it. Hence we chmod it.
389     chmod -R 0755 "${ROOT}"/usr/share/kde4
390 ingmar 1.1 fi
391     }
392    
393     # @FUNCTION: comment_all_add_subdirectory
394     # @USAGE: [list of directory names]
395     # @DESCRIPTION:
396     # recursively comment all add_subdirectory instructions in listed directories
397     # except the ones in cmake/.
398     comment_all_add_subdirectory() {
399     find "$@" -name CMakeLists.txt -print0 | grep -vFzZ "./cmake" | \
400     xargs -0 sed -i -e '/add_subdirectory/s/^/#DONOTCOMPILE /' || \
401     die "${LINENO}: Initial sed died"
402     }
403    
404     # @ECLASS-VARIABLE: QT4_BUILT_WITH_USE_CHECK
405     # @DESCRIPTION:
406     # A list of USE flags that x11-libs/qt:4 needs to be built with.
407     #
408     # This list is automatically appended to KDE4_BUILT_WITH_USE_CHECK,
409     # so don't call qt4_pkg_setup manually.
410    
411     # @ECLASS-VARIABLE: KDE4_BUILT_WITH_USE_CHECK
412     # @DESCRIPTION:
413     # The contents of $KDE4_BUILT_WITH_USE_CHECK gets fed to built_with_use
414     # (eutils.eclass), line per line.
415     #
416     # Example:
417     # @CODE
418     # pkg_setup() {
419     # KDE4_BUILT_WITH_USE_CHECK="--missing true sys-apps/dbus X"
420     # use alsa && KDE4_BUILT_WITH_USE_CHECK="${KDE4_BUILT_WITH_USE_CHECK}
421     # --missing true media-libs/alsa-lib midi"
422     # kde4-base_pkg_setup
423     # }
424     # @CODE
425    
426     # run built_with_use on each flag and print appropriate error messages if any
427     # flags are missing
428     _kde4-functions_built_with_use() {
429     local missing opt pkg flag flags
430    
431     if [[ ${1} = "--missing" ]]; then
432     missing="${1} ${2}" && shift 2
433     fi
434     if [[ ${1:0:1} = "-" ]]; then
435     opt=${1} && shift
436     fi
437    
438     pkg=${1} && shift
439    
440     for flag in "${@}"; do
441     flags="${flags} ${flag}"
442     if ! built_with_use ${missing} ${opt} ${pkg} ${flag}; then
443     flags="${flags}*"
444     else
445     [[ ${opt} = "-o" ]] && return 0
446     fi
447     done
448     if [[ "${flags# }" = "${@}" ]]; then
449     return 0
450     fi
451     if [[ ${opt} = "-o" ]]; then
452     eerror "This package requires '${pkg}' to be built with any of the following USE flags: '$*'."
453     else
454     eerror "This package requires '${pkg}' to be built with the following USE flags: '${flags# }'."
455     fi
456     return 1
457     }
458    
459     # @FUNCTION: kde4-functions_check_use
460     # @DESCRIPTION:
461     # Check if the Qt4 libraries are built with the USE flags listed in
462     # $QT4_BUILT_WITH_USE_CHECK.
463     #
464     # Check if a list of packages are built with certain USE flags, as listed in
465     # $KDE4_BUILT_WITH_USE_CHECK.
466     #
467     # If any of the required USE flags are missing, an eerror will be printed for
468     # each package with missing USE flags.
469     kde4-functions_check_use() {
470     # I like to keep flags sorted
471     QT4_BUILT_WITH_USE_CHECK=$(echo "${QT4_BUILT_WITH_USE_CHECK}" | \
472     tr '[:space:]' '\n' | sort | xargs)
473    
474     KDE4_BUILT_WITH_USE_CHECK="x11-libs/qt:4 ${QT4_BUILT_WITH_USE_CHECK}
475     ${KDE4_BUILT_WITH_USE_CHECK}"
476    
477     local line missing
478     while read line; do
479     [[ -z ${line} ]] && continue
480     if ! _kde4-functions_built_with_use ${line}; then
481     missing=true
482     fi
483     done <<< "${KDE4_BUILT_WITH_USE_CHECK}"
484     if [[ -n ${missing} ]]; then
485     echo
486     eerror "Flags marked with an * are missing."
487     die "Missing USE flags found"
488     fi
489     }

  ViewVC Help
Powered by ViewVC 1.1.20