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

Contents of /eclass/kde4-functions.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Wed Jan 16 22:47:45 2008 UTC (6 years, 7 months ago) by ingmar
Branch: MAIN
Added kde4-functions.eclass - Common ebuild functions for monolithic and split KDE 4 packages.

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

  ViewVC Help
Powered by ViewVC 1.1.20