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

Contents of /eclass/kde4-functions.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (show annotations) (download)
Tue Oct 7 01:41:36 2008 UTC (6 years, 2 months ago) by jmbsvicetto
Branch: MAIN
Changes since 1.8: +2 -1 lines
Added kommander to the KDM.

1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.8 2008/10/02 06:49:02 jmbsvicetto Exp $
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_SLOTS
33 # @DESCRIPTION:
34 # The slots used by all KDE versions after 4.0 - this doesn't include kde-3.5 and the
35 # live-ebuilds that use the following var.
36 KDE_SLOTS=( "kde-4" "4.1" )
37
38 # @ECLASS-VARIABLE: KDE_LIVE_SLOTS
39 # @DESCRIPTION:
40 # The slots used by all KDE live versions.
41 KDE_LIVE_SLOTS=( "kde-svn" )
42
43 # @ECLASS-VARIABLE: KDE_DERIVATION_MAP
44 # @DESCRIPTION:
45 # Map of the monolithic->split ebuild derivation.
46 # Used to build dependencies describing the relationships between them:
47 # Monolithic ebuilds block their split counterparts in the same slot, and vice versa.
48 #
49 # Also see get-parent-package(), get-child-packages(), is-parent-package()
50 KDE_DERIVATION_MAP='
51 app-office/koffice app-office/karbon
52 app-office/koffice app-office/kchart
53 app-office/koffice app-office/kexi
54 app-office/koffice app-office/kformula
55 app-office/koffice app-office/kivio
56 app-office/koffice app-office/koffice-data
57 app-office/koffice app-office/koffice-libs
58 app-office/koffice app-office/koshell
59 app-office/koffice app-office/kplato
60 app-office/koffice app-office/kpresenter
61 app-office/koffice app-office/krita
62 app-office/koffice app-office/kspread
63 app-office/koffice app-office/kugar
64 app-office/koffice app-office/kword
65 kde-base/kdeaccessibility kde-base/kdeaccessibility-colorschemes
66 kde-base/kdeaccessibility kde-base/kdeaccessibility-iconthemes
67 kde-base/kdeaccessibility kde-base/kmag
68 kde-base/kdeaccessibility kde-base/kmousetool
69 kde-base/kdeaccessibility kde-base/kmouth
70 kde-base/kdeaccessibility kde-base/kttsd
71 kde-base/kdeadmin kde-base/kcron
72 kde-base/kdeadmin kde-base/kdat
73 kde-base/kdeadmin kde-base/knetworkconf
74 kde-base/kdeadmin kde-base/kpackage
75 kde-base/kdeadmin kde-base/ksystemlog
76 kde-base/kdeadmin kde-base/ksysv
77 kde-base/kdeadmin kde-base/kuser
78 kde-base/kdeadmin kde-base/lilo-config
79 kde-base/kdeadmin kde-base/secpolicy
80 kde-base/kdeartwork kde-base/kdeartwork-colorschemes
81 kde-base/kdeartwork kde-base/kdeartwork-emoticons
82 kde-base/kdeartwork kde-base/kdeartwork-icewm-themes
83 kde-base/kdeartwork kde-base/kdeartwork-iconthemes
84 kde-base/kdeartwork kde-base/kdeartwork-kscreensaver
85 kde-base/kdeartwork kde-base/kdeartwork-kworldclock
86 kde-base/kdeartwork kde-base/kdeartwork-sounds
87 kde-base/kdeartwork kde-base/kdeartwork-styles
88 kde-base/kdeartwork kde-base/kdeartwork-wallpapers
89 kde-base/kdebase kde-base/dolphin
90 kde-base/kdebase kde-base/drkonqi
91 kde-base/kdebase kde-base/kappfinder
92 kde-base/kdebase kde-base/kcheckpass
93 kde-base/kdebase kde-base/kcminit
94 kde-base/kdebase kde-base/kcmshell
95 kde-base/kdebase kde-base/kcontrol
96 kde-base/kdebase kde-base/kde-menu
97 kde-base/kdebase kde-base/kde-menu-icons
98 kde-base/kdebase kde-base/kde-wallpapers
99 kde-base/kdebase kde-base/kdebase-cursors
100 kde-base/kdebase kde-base/kdebase-data
101 kde-base/kdebase kde-base/kdebase-kioslaves
102 kde-base/kdebase kde-base/kdebase-startkde
103 kde-base/kdebase kde-base/kdebugdialog
104 kde-base/kdebase kde-base/kdepasswd
105 kde-base/kdebase kde-base/kdesu
106 kde-base/kdebase kde-base/kdialog
107 kde-base/kdebase kde-base/kdm
108 kde-base/kdebase kde-base/keditbookmarks
109 kde-base/kdebase kde-base/kfile
110 kde-base/kdebase kde-base/kfind
111 kde-base/kdebase kde-base/khelpcenter
112 kde-base/kdebase kde-base/khotkeys
113 kde-base/kdebase kde-base/kiconfinder
114 kde-base/kdebase kde-base/kinfocenter
115 kde-base/kdebase kde-base/kioclient
116 kde-base/kdebase kde-base/klipper
117 kde-base/kdebase kde-base/kmenuedit
118 kde-base/kdebase kde-base/kmimetypefinder
119 kde-base/kdebase kde-base/knetattach
120 kde-base/kdebase kde-base/knewstuff
121 kde-base/kdebase kde-base/knotify
122 kde-base/kdebase kde-base/konqueror
123 kde-base/kdebase kde-base/konsole
124 kde-base/kdebase kde-base/kpasswdserver
125 kde-base/kdebase kde-base/kquitapp
126 kde-base/kdebase kde-base/kreadconfig
127 kde-base/kdebase kde-base/krunner
128 kde-base/kdebase kde-base/kscreensaver
129 kde-base/kdebase kde-base/ksmserver
130 kde-base/kdebase kde-base/ksplash
131 kde-base/kdebase kde-base/kstart
132 kde-base/kdebase kde-base/kstartupconfig
133 kde-base/kdebase kde-base/kstyles
134 kde-base/kdebase kde-base/ksysguard
135 kde-base/kdebase kde-base/ksystraycmd
136 kde-base/kdebase kde-base/ktimezoned
137 kde-base/kdebase kde-base/ktip
138 kde-base/kdebase kde-base/ktraderclient
139 kde-base/kdebase kde-base/kuiserver
140 kde-base/kdebase kde-base/kurifilter-plugins
141 kde-base/kdebase kde-base/kwin
142 kde-base/kdebase kde-base/kwrite
143 kde-base/kdebase kde-base/libkonq
144 kde-base/kdebase kde-base/libkworkspace
145 kde-base/kdebase kde-base/libplasma
146 kde-base/kdebase kde-base/libtaskmanager
147 kde-base/kdebase kde-base/nepomuk
148 kde-base/kdebase kde-base/nsplugins
149 kde-base/kdebase kde-base/phonon
150 kde-base/kdebase kde-base/phonon-xine
151 kde-base/kdebase kde-base/plasma
152 kde-base/kdebase kde-base/plasma-apps
153 kde-base/kdebase kde-base/plasma-workspace
154 kde-base/kdebase kde-base/renamedlg-plugins
155 kde-base/kdebase kde-base/solid
156 kde-base/kdebase kde-base/solid-hardware
157 kde-base/kdebase kde-base/soliduiserver
158 kde-base/kdebase kde-base/systemsettings
159 kde-base/kdebindings kde-base/kalyptus
160 kde-base/kdebindings kde-base/kdejava
161 kde-base/kdebindings kde-base/kimono
162 kde-base/kdebindings kde-base/kjsembed
163 kde-base/kdebindings kde-base/korundum
164 kde-base/kdebindings kde-base/krossjava
165 kde-base/kdebindings kde-base/krosspython
166 kde-base/kdebindings kde-base/krossruby
167 kde-base/kdebindings kde-base/pykde4
168 kde-base/kdebindings kde-base/qtjava
169 kde-base/kdebindings kde-base/qtruby
170 kde-base/kdebindings kde-base/qtsharp
171 kde-base/kdebindings kde-base/qyoto
172 kde-base/kdebindings kde-base/smoke
173 kde-base/kdebindings kde-base/xparts
174 kde-base/kdeedu kde-base/blinken
175 kde-base/kdeedu kde-base/kalgebra
176 kde-base/kdeedu kde-base/kalzium
177 kde-base/kdeedu kde-base/kanagram
178 kde-base/kdeedu kde-base/kbruch
179 kde-base/kdeedu kde-base/kgeography
180 kde-base/kdeedu kde-base/khangman
181 kde-base/kdeedu kde-base/kig
182 kde-base/kdeedu kde-base/kiten
183 kde-base/kdeedu kde-base/klettres
184 kde-base/kdeedu kde-base/kmplot
185 kde-base/kdeedu kde-base/kpercentage
186 kde-base/kdeedu kde-base/kstars
187 kde-base/kdeedu kde-base/ktouch
188 kde-base/kdeedu kde-base/kturtle
189 kde-base/kdeedu kde-base/kwordquiz
190 kde-base/kdeedu kde-base/libkdeedu
191 kde-base/kdeedu kde-base/marble
192 kde-base/kdeedu kde-base/parley
193 kde-base/kdeedu kde-base/step
194 kde-base/kdegames kde-base/bovo
195 kde-base/kdegames kde-base/katomic
196 kde-base/kdegames kde-base/kbattleship
197 kde-base/kdegames kde-base/kblackbox
198 kde-base/kdegames kde-base/kblocks
199 kde-base/kdegames kde-base/kbounce
200 kde-base/kdegames kde-base/kbreakout
201 kde-base/kdegames kde-base/kdiamond
202 kde-base/kdegames kde-base/kfourinline
203 kde-base/kdegames kde-base/kgoldrunner
204 kde-base/kdegames kde-base/kiriki
205 kde-base/kdegames kde-base/kjumpingcube
206 kde-base/kdegames kde-base/klines
207 kde-base/kdegames kde-base/kmahjongg
208 kde-base/kdegames kde-base/kmines
209 kde-base/kdegames kde-base/knetwalk
210 kde-base/kdegames kde-base/kolf
211 kde-base/kdegames kde-base/kollision
212 kde-base/kdegames kde-base/konquest
213 kde-base/kdegames kde-base/kpat
214 kde-base/kdegames kde-base/kreversi
215 kde-base/kdegames kde-base/ksame
216 kde-base/kdegames kde-base/kshisen
217 kde-base/kdegames kde-base/ksirk
218 kde-base/kdegames kde-base/kspaceduel
219 kde-base/kdegames kde-base/ksquares
220 kde-base/kdegames kde-base/ksudoku
221 kde-base/kdegames kde-base/ktuberling
222 kde-base/kdegames kde-base/kubrick
223 kde-base/kdegames kde-base/libkdegames
224 kde-base/kdegames kde-base/libkmahjongg
225 kde-base/kdegames kde-base/lskat
226 kde-base/kdegraphics kde-base/gwenview
227 kde-base/kdegraphics kde-base/kamera
228 kde-base/kdegraphics kde-base/kcolorchooser
229 kde-base/kdegraphics kde-base/kdegraphics-strigi-analyzer
230 kde-base/kdegraphics kde-base/kgamma
231 kde-base/kdegraphics kde-base/kghostview
232 kde-base/kdegraphics kde-base/kolourpaint
233 kde-base/kdegraphics kde-base/kruler
234 kde-base/kdegraphics kde-base/ksaneplugin
235 kde-base/kdegraphics kde-base/ksnapshot
236 kde-base/kdegraphics kde-base/libkdcraw
237 kde-base/kdegraphics kde-base/libkexiv2
238 kde-base/kdegraphics kde-base/libkipi
239 kde-base/kdegraphics kde-base/libksane
240 kde-base/kdegraphics kde-base/libkscan
241 kde-base/kdegraphics kde-base/okular
242 kde-base/kdegraphics kde-base/svgpart
243 kde-base/kdemultimedia kde-base/dragonplayer
244 kde-base/kdemultimedia kde-base/juk
245 kde-base/kdemultimedia kde-base/kdemultimedia-kioslaves
246 kde-base/kdemultimedia kde-base/kdemultimedia-strigi-analyzer
247 kde-base/kdemultimedia kde-base/kmix
248 kde-base/kdemultimedia kde-base/kscd
249 kde-base/kdemultimedia kde-base/libkcddb
250 kde-base/kdemultimedia kde-base/libkcompactdisc
251 kde-base/kdenetwork kde-base/kdenetwork-filesharing
252 kde-base/kdenetwork kde-base/kdnssd
253 kde-base/kdenetwork kde-base/kget
254 kde-base/kdenetwork kde-base/knewsticker
255 kde-base/kdenetwork kde-base/kopete
256 kde-base/kdenetwork kde-base/kppp
257 kde-base/kdenetwork kde-base/krdc
258 kde-base/kdenetwork kde-base/krfb
259 kde-base/kdepim kde-base/akonadi
260 kde-base/kdepim kde-base/akregator
261 kde-base/kdepim kde-base/certmanager
262 kde-base/kdepim kde-base/kabc2mutt
263 kde-base/kdepim kde-base/kabcclient
264 kde-base/kdepim kde-base/kaddressbook
265 kde-base/kdepim kde-base/kalarm
266 kde-base/kdepim kde-base/kdemaildir
267 kde-base/kdepim kde-base/kdepim-icons
268 kde-base/kdepim kde-base/kdepim-kioslaves
269 kde-base/kdepim kde-base/kdepim-kresources
270 kde-base/kdepim kde-base/kdepim-strigi-analyzer
271 kde-base/kdepim kde-base/kdepim-wizards
272 kde-base/kdepim kde-base/kfeed
273 kde-base/kdepim kde-base/kitchensync
274 kde-base/kdepim kde-base/kjots
275 kde-base/kdepim kde-base/kleopatra
276 kde-base/kdepim kde-base/kmail
277 kde-base/kdepim kde-base/kmailcvt
278 kde-base/kdepim kde-base/kmobiletools
279 kde-base/kdepim kde-base/knode
280 kde-base/kdepim kde-base/knotes
281 kde-base/kdepim kde-base/kode
282 kde-base/kdepim kde-base/konsolekalendar
283 kde-base/kdepim kde-base/kontact
284 kde-base/kdepim kde-base/kontact-specialdates
285 kde-base/kdepim kde-base/kontactinterfaces
286 kde-base/kdepim kde-base/korganizer
287 kde-base/kdepim kde-base/korn
288 kde-base/kdepim kde-base/kpilot
289 kde-base/kdepim kde-base/ktimetracker
290 kde-base/kdepim kde-base/ktnef
291 kde-base/kdepim kde-base/libkdepim
292 kde-base/kdepim kde-base/libkholidays
293 kde-base/kdepim kde-base/libkleo
294 kde-base/kdepim kde-base/libkpgp
295 kde-base/kdepim kde-base/libksieve
296 kde-base/kdepim kde-base/mailtransport
297 kde-base/kdepim kde-base/mimelib
298 kde-base/kdepim kde-base/networkstatus
299 kde-base/kdesdk kde-base/cervisia
300 kde-base/kdesdk kde-base/kapptemplate
301 kde-base/kdesdk kde-base/kate
302 kde-base/kdesdk kde-base/kbabel
303 kde-base/kdesdk kde-base/kbugbuster
304 kde-base/kdesdk kde-base/kcachegrind
305 kde-base/kdesdk kde-base/kdeaccounts-plugin
306 kde-base/kdesdk kde-base/kdesdk-kioslaves
307 kde-base/kdesdk kde-base/kdesdk-misc
308 kde-base/kdesdk kde-base/kdesdk-scripts
309 kde-base/kdesdk kde-base/kdesdk-strigi-analyzer
310 kde-base/kdesdk kde-base/kmtrace
311 kde-base/kdesdk kde-base/kompare
312 kde-base/kdesdk kde-base/kspy
313 kde-base/kdesdk kde-base/kstartperf
314 kde-base/kdesdk kde-base/kuiviewer
315 kde-base/kdesdk kde-base/lokalize
316 kde-base/kdesdk kde-base/poxml
317 kde-base/kdesdk kde-base/strigi-analyzer
318 kde-base/kdesdk kde-base/umbrello
319 kde-base/kdetoys kde-base/amor
320 kde-base/kdetoys kde-base/kteatime
321 kde-base/kdetoys kde-base/ktux
322 kde-base/kdetoys kde-base/kweather
323 kde-base/kdetoys kde-base/kworldclock
324 kde-base/kdeutils kde-base/ark
325 kde-base/kdeutils kde-base/kcalc
326 kde-base/kdeutils kde-base/kcharselect
327 kde-base/kdeutils kde-base/kdessh
328 kde-base/kdeutils kde-base/kdf
329 kde-base/kdeutils kde-base/kfloppy
330 kde-base/kdeutils kde-base/kgpg
331 kde-base/kdeutils kde-base/kmilo
332 kde-base/kdeutils kde-base/kregexpeditor
333 kde-base/kdeutils kde-base/ktimer
334 kde-base/kdeutils kde-base/kwallet
335 kde-base/kdeutils kde-base/okteta
336 kde-base/kdeutils kde-base/superkaramba
337 kde-base/kdeutils kde-base/sweeper
338 kde-base/kdewebdev kde-base/kfilereplace
339 kde-base/kdewebdev kde-base/kimagemapeditor
340 kde-base/kdewebdev kde-base/klinkstatus
341 kde-base/kdewebdev kde-base/kommander
342 kde-base/kdewebdev kde-base/kxsldbg
343 kde-base/kdewebdev kde-base/quanta
344 '
345
346 # @FUNCTION: get-parent-package
347 # @USAGE: <split ebuild>
348 # @DESCRIPTION:
349 # Echoes the name of the monolithic package that a given split ebuild was derived from.
350 get-parent-package() {
351 local parent child
352 while read parent child; do
353 if [[ "${child}" == "$1" ]]; then
354 echo ${parent}
355 return 0
356 fi
357 done <<< "$KDE_DERIVATION_MAP"
358 die "Package $target not found in KDE_DERIVATION_MAP, please report bug"
359 }
360
361 # @FUNCTION: get-child-packages
362 # @USAGE: <monolithic ebuild>
363 # @DESCRIPTION:
364 # Echoes the names of all (split) ebuilds derived from a given monolithic ebuild.
365 get-child-packages() {
366 local parent child
367 while read parent child; do
368 [[ "${parent}" == "$1" ]] && echo -n "${child} "
369 done <<< "$KDE_DERIVATION_MAP"
370 }
371
372 # @FUNCTION: is-parent-package
373 # @USAGE: <$CATEGORY/$PN>
374 # @DESCRIPTION:
375 # Returns zero exit-status if the given package is a parent (monolithic) ebuild.
376 # Returns non-zero exit-status if it's not.
377 is-parent-package() {
378 local parent child
379 while read parent child; do
380 [[ "${parent}" == "$1" ]] && return 0
381 done <<< "$KDE_DERIVATION_MAP"
382 return 1
383 }
384
385 # @FUNCTION: buildsycoca
386 # @DESCRIPTION:
387 # Function to rebuild the KDE System Configuration Cache.
388 # All KDE ebuilds should run this in pkg_postinst and pkg_postrm.
389 #
390 # Note that kde4-base.eclass already does this.
391 buildsycoca() {
392 debug-print-function ${FUNCNAME} "$@"
393
394 if [[ -x ${KDEDIR}/bin/kbuildsycoca4 && -z "${ROOT%%/}" ]]; then
395 # Make sure tha cache file exists, or kbuildsycoca4 will fail
396 touch "${KDEDIR}/share/kde4/services/ksycoca4"
397
398 # We have to unset DISPLAY and DBUS_SESSION_BUS_ADDRESS, the ones
399 # in the user's environment (through su [without '-']) may cause
400 # kbuildsycoca4 to hang.
401
402 ebegin "Running kbuildsycoca4 to build global database"
403 # This is needed because we support multiple kde versions installed together.
404 XDG_DATA_DIRS="/usr/share:${KDEDIRS//:/\/share:}/share:/usr/local/share" \
405 DISPLAY="" DBUS_SESSION_BUS_ADDRESS="" \
406 ${KDEDIR}/bin/kbuildsycoca4 --global --noincremental &> /dev/null
407 eend $?
408 fi
409 }
410
411 # @FUNCTION: comment_all_add_subdirectory
412 # @USAGE: [list of directory names]
413 # @DESCRIPTION:
414 # recursively comment all add_subdirectory instructions in listed directories
415 # except the ones in cmake/.
416 comment_all_add_subdirectory() {
417 find "$@" -name CMakeLists.txt -print0 | grep -vFzZ "./cmake" | \
418 xargs -0 sed -i -e '/add_subdirectory/s/^/#DONOTCOMPILE /' -e '/ADD_SUBDIRECTORY/s/^/#DONOTCOMPILE /' || \
419 die "${LINENO}: Initial sed died"
420 }
421
422 # @ECLASS-VARIABLE: KDE_LINGUAS
423 # @DESCRIPTION:
424 # This is a whitespace-separated list of translations that this ebuild supports.
425 # These translations automatically get added to IUSE. Therefore ebuilds must set
426 # this variable before inheriting any eclasses. To only enable selected
427 # translations ebuilds must call enable_selected_linguas(). kde4-base.eclass does
428 # this for you.
429 #
430 # Example: KDE_LINGUAS="en_GB de nl"
431 for _lingua in ${KDE_LINGUAS}; do
432 IUSE="${IUSE} linguas_${_lingua}"
433 done
434
435 # @FUNCTION: enable_selected_linguas
436 # @DESCRIPTION:
437 # Enable translations based on LINGUAS settings and what translations are
438 # supported (see KDE_LINGUAS). By default translations are found in "${S}"/po
439 # but this default can be overridden by defining KDE_LINGUAS_DIR.
440 enable_selected_linguas() {
441 local lingua
442
443 for lingua in ${KDE_LINGUAS}; do
444 if [ -e "${S}"/po/"${lingua}".po ]; then
445 mv "${S}"/po/"${lingua}".po "${S}"/po/"${lingua}".po.old
446 fi
447 done
448 comment_all_add_subdirectory "${KDE_LINGUAS_DIR:-${S}/po}"
449 for lingua in ${LINGUAS}; do
450 if [ -d "${S}"/po/"${lingua}" ]; then
451 sed -e "/add_subdirectory([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
452 -e "/ADD_SUBDIRECTORY([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
453 -i "${KDE_LINGUAS_DIR:-${S}/po}"/CMakeLists.txt || die "Sed to uncomment linguas_${lingua} failed."
454 fi
455 if [ -e "${S}"/po/"${lingua}".po.old ]; then
456 mv "${S}"/po/"${lingua}".po.old "${S}"/po/"${lingua}".po
457 fi
458 done
459 }
460
461 # @ECLASS-VARIABLE: QT4_BUILT_WITH_USE_CHECK
462 # @DESCRIPTION:
463 # A list of USE flags that x11-libs/qt:4 needs to be built with.
464 #
465 # This list is automatically appended to KDE4_BUILT_WITH_USE_CHECK,
466 # so don't call qt4_pkg_setup manually.
467
468 # @ECLASS-VARIABLE: KDE4_BUILT_WITH_USE_CHECK
469 # @DESCRIPTION:
470 # The contents of $KDE4_BUILT_WITH_USE_CHECK gets fed to built_with_use
471 # (eutils.eclass), line per line.
472 #
473 # Example:
474 # @CODE
475 # pkg_setup() {
476 # KDE4_BUILT_WITH_USE_CHECK="--missing true sys-apps/dbus X"
477 # use alsa && KDE4_BUILT_WITH_USE_CHECK="${KDE4_BUILT_WITH_USE_CHECK}
478 # --missing true media-libs/alsa-lib midi"
479 # kde4-base_pkg_setup
480 # }
481 # @CODE
482
483 # run built_with_use on each flag and print appropriate error messages if any
484 # flags are missing
485 _kde4-functions_built_with_use() {
486 local missing opt pkg flag flags
487
488 if [[ ${1} = "--missing" ]]; then
489 missing="${1} ${2}" && shift 2
490 fi
491 if [[ ${1:0:1} = "-" ]]; then
492 opt=${1} && shift
493 fi
494
495 pkg=${1} && shift
496
497 for flag in "${@}"; do
498 flags="${flags} ${flag}"
499 if ! built_with_use ${missing} ${opt} ${pkg} ${flag}; then
500 flags="${flags}*"
501 else
502 [[ ${opt} = "-o" ]] && return 0
503 fi
504 done
505 if [[ "${flags# }" = "${@}" ]]; then
506 return 0
507 fi
508 if [[ ${opt} = "-o" ]]; then
509 eerror "This package requires '${pkg}' to be built with any of the following USE flags: '$*'."
510 else
511 eerror "This package requires '${pkg}' to be built with the following USE flags: '${flags# }'."
512 fi
513 return 1
514 }
515
516 # @FUNCTION: kde4-functions_check_use
517 # @DESCRIPTION:
518 # Check if the Qt4 libraries are built with the USE flags listed in
519 # $QT4_BUILT_WITH_USE_CHECK.
520 #
521 # Check if a list of packages are built with certain USE flags, as listed in
522 # $KDE4_BUILT_WITH_USE_CHECK.
523 #
524 # If any of the required USE flags are missing, an eerror will be printed for
525 # each package with missing USE flags.
526 kde4-functions_check_use() {
527 # I like to keep flags sorted
528 QT4_BUILT_WITH_USE_CHECK=$(echo "${QT4_BUILT_WITH_USE_CHECK}" | \
529 tr '[:space:]' '\n' | sort | uniq | xargs)
530
531 local line missing
532 if [[ -n ${KDE4_BUILT_WITH_USE_CHECK[@]} && $(declare -p KDE4_BUILT_WITH_USE_CHECK) = 'declare -a '* ]]; then
533 KDE4_BUILT_WITH_USE_CHECK=("x11-libs/qt:4 ${QT4_BUILT_WITH_USE_CHECK}"
534 "${KDE4_BUILT_WITH_USE_CHECK[@]}")
535
536 for line in "${KDE4_BUILT_WITH_USE_CHECK[@]}"; do
537 [[ -z ${line} ]] && continue
538 if ! _kde4-functions_built_with_use ${line}; then
539 missing=true
540 fi
541 done
542 else
543 KDE4_BUILT_WITH_USE_CHECK="x11-libs/qt:4 ${QT4_BUILT_WITH_USE_CHECK}
544 ${KDE4_BUILT_WITH_USE_CHECK}"
545
546 while read line; do
547 [[ -z ${line} ]] && continue
548 if ! _kde4-functions_built_with_use ${line}; then
549 missing=true
550 fi
551 done <<< "${KDE4_BUILT_WITH_USE_CHECK}"
552 fi
553 if [[ -n ${missing} ]]; then
554 echo
555 eerror "Flags marked with an * are missing."
556 die "Missing USE flags found"
557 fi
558 }

  ViewVC Help
Powered by ViewVC 1.1.20