/[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.8 Revision 1.11
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.8 2008/10/02 06:49:02 jmbsvicetto Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.11 2009/01/12 19:40:34 scarabeus 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 KDE 4 packages
9# @DESCRIPTION: 9# @DESCRIPTION:
10# This eclass contains all functions shared by the different eclasses, 10# This eclass contains all functions shared by the different eclasses,
11# for KDE 4 monolithic and split ebuilds. 11# for KDE 4 ebuilds.
12# 12
13# NOTE: This eclass uses the SLOT dependencies from EAPI="1" or compatible, 13# @ECLASS-VARIABLE: EAPI
14# hence you must define EAPI="1" in the ebuild, before inheriting any eclasses. 14# @DESCRIPTION:
15# By default kde eclass wants eapi 2 which might be redefinable.
16case ${EAPI} in
17 2) : ;;
18 *) die "No way! EAPI older than 2 is not supported." ;;
19esac
15 20
16# @ECLASS-VARIABLE: KDEBASE 21# @ECLASS-VARIABLE: KDEBASE
17# @DESCRIPTION: 22# @DESCRIPTION:
18# This gets set to a non-zero value when a package is considered a kde or 23# This gets set to a non-zero value when a package is considered a kde or
19# koffice ebuild. 24# koffice ebuild.
20 25
21if [[ "${CATEGORY}" == "kde-base" ]]; then 26if [[ $CATEGORY = kde-base ]]; then
22 debug-print "${ECLASS}: KDEBASE ebuild recognized" 27 debug-print "${ECLASS}: KDEBASE ebuild recognized"
23 KDEBASE="kde-base" 28 KDEBASE=kde-base
24fi 29fi
25 30
26# is this a koffice ebuild? 31# is this a koffice ebuild?
27if [[ "${KMNAME}" == "koffice" || "${PN}" == "koffice" ]]; then 32if [[ $KMNAME = koffice || $PN = koffice ]]; then
28 debug-print "${ECLASS}: KOFFICE ebuild recognized" 33 debug-print "${ECLASS}: KOFFICE ebuild recognized"
29 KDEBASE="koffice" 34 KDEBASE=koffice
30fi 35fi
31 36
32# @ECLASS-VARIABLE: KDE_SLOTS 37# @ECLASS-VARIABLE: KDE_SLOTS
33# @DESCRIPTION: 38# @DESCRIPTION:
34# The slots used by all KDE versions after 4.0 - this doesn't include kde-3.5 and the 39# The slots used by all KDE versions later than 4.0. The live-ebuilds use
35# live-ebuilds that use the following var. 40# KDE_LIVE_SLOTS instead.
36KDE_SLOTS=( "kde-4" "4.1" ) 41KDE_SLOTS=( kde-4 4.1 4.2 )
37 42
38# @ECLASS-VARIABLE: KDE_LIVE_SLOTS 43# @ECLASS-VARIABLE: KDE_LIVE_SLOTS
39# @DESCRIPTION: 44# @DESCRIPTION:
40# The slots used by all KDE live versions. 45# The slots used by all KDE live versions.
41KDE_LIVE_SLOTS=( "kde-svn" ) 46KDE_LIVE_SLOTS=( live )
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()
50KDE_DERIVATION_MAP='
51app-office/koffice app-office/karbon
52app-office/koffice app-office/kchart
53app-office/koffice app-office/kexi
54app-office/koffice app-office/kformula
55app-office/koffice app-office/kivio
56app-office/koffice app-office/koffice-data
57app-office/koffice app-office/koffice-libs
58app-office/koffice app-office/koshell
59app-office/koffice app-office/kplato
60app-office/koffice app-office/kpresenter
61app-office/koffice app-office/krita
62app-office/koffice app-office/kspread
63app-office/koffice app-office/kugar
64app-office/koffice app-office/kword
65kde-base/kdeaccessibility kde-base/kdeaccessibility-colorschemes
66kde-base/kdeaccessibility kde-base/kdeaccessibility-iconthemes
67kde-base/kdeaccessibility kde-base/kmag
68kde-base/kdeaccessibility kde-base/kmousetool
69kde-base/kdeaccessibility kde-base/kmouth
70kde-base/kdeaccessibility kde-base/kttsd
71kde-base/kdeadmin kde-base/kcron
72kde-base/kdeadmin kde-base/kdat
73kde-base/kdeadmin kde-base/knetworkconf
74kde-base/kdeadmin kde-base/kpackage
75kde-base/kdeadmin kde-base/ksystemlog
76kde-base/kdeadmin kde-base/ksysv
77kde-base/kdeadmin kde-base/kuser
78kde-base/kdeadmin kde-base/lilo-config
79kde-base/kdeadmin kde-base/secpolicy
80kde-base/kdeartwork kde-base/kdeartwork-colorschemes
81kde-base/kdeartwork kde-base/kdeartwork-emoticons
82kde-base/kdeartwork kde-base/kdeartwork-icewm-themes
83kde-base/kdeartwork kde-base/kdeartwork-iconthemes
84kde-base/kdeartwork kde-base/kdeartwork-kscreensaver
85kde-base/kdeartwork kde-base/kdeartwork-kworldclock
86kde-base/kdeartwork kde-base/kdeartwork-sounds
87kde-base/kdeartwork kde-base/kdeartwork-styles
88kde-base/kdeartwork kde-base/kdeartwork-wallpapers
89kde-base/kdebase kde-base/dolphin
90kde-base/kdebase kde-base/drkonqi
91kde-base/kdebase kde-base/kappfinder
92kde-base/kdebase kde-base/kcheckpass
93kde-base/kdebase kde-base/kcminit
94kde-base/kdebase kde-base/kcmshell
95kde-base/kdebase kde-base/kcontrol
96kde-base/kdebase kde-base/kde-menu
97kde-base/kdebase kde-base/kde-menu-icons
98kde-base/kdebase kde-base/kde-wallpapers
99kde-base/kdebase kde-base/kdebase-cursors
100kde-base/kdebase kde-base/kdebase-data
101kde-base/kdebase kde-base/kdebase-kioslaves
102kde-base/kdebase kde-base/kdebase-startkde
103kde-base/kdebase kde-base/kdebugdialog
104kde-base/kdebase kde-base/kdepasswd
105kde-base/kdebase kde-base/kdesu
106kde-base/kdebase kde-base/kdialog
107kde-base/kdebase kde-base/kdm
108kde-base/kdebase kde-base/keditbookmarks
109kde-base/kdebase kde-base/kfile
110kde-base/kdebase kde-base/kfind
111kde-base/kdebase kde-base/khelpcenter
112kde-base/kdebase kde-base/khotkeys
113kde-base/kdebase kde-base/kiconfinder
114kde-base/kdebase kde-base/kinfocenter
115kde-base/kdebase kde-base/kioclient
116kde-base/kdebase kde-base/klipper
117kde-base/kdebase kde-base/kmenuedit
118kde-base/kdebase kde-base/kmimetypefinder
119kde-base/kdebase kde-base/knetattach
120kde-base/kdebase kde-base/knewstuff
121kde-base/kdebase kde-base/knotify
122kde-base/kdebase kde-base/konqueror
123kde-base/kdebase kde-base/konsole
124kde-base/kdebase kde-base/kpasswdserver
125kde-base/kdebase kde-base/kquitapp
126kde-base/kdebase kde-base/kreadconfig
127kde-base/kdebase kde-base/krunner
128kde-base/kdebase kde-base/kscreensaver
129kde-base/kdebase kde-base/ksmserver
130kde-base/kdebase kde-base/ksplash
131kde-base/kdebase kde-base/kstart
132kde-base/kdebase kde-base/kstartupconfig
133kde-base/kdebase kde-base/kstyles
134kde-base/kdebase kde-base/ksysguard
135kde-base/kdebase kde-base/ksystraycmd
136kde-base/kdebase kde-base/ktimezoned
137kde-base/kdebase kde-base/ktip
138kde-base/kdebase kde-base/ktraderclient
139kde-base/kdebase kde-base/kuiserver
140kde-base/kdebase kde-base/kurifilter-plugins
141kde-base/kdebase kde-base/kwin
142kde-base/kdebase kde-base/kwrite
143kde-base/kdebase kde-base/libkonq
144kde-base/kdebase kde-base/libkworkspace
145kde-base/kdebase kde-base/libplasma
146kde-base/kdebase kde-base/libtaskmanager
147kde-base/kdebase kde-base/nepomuk
148kde-base/kdebase kde-base/nsplugins
149kde-base/kdebase kde-base/phonon
150kde-base/kdebase kde-base/phonon-xine
151kde-base/kdebase kde-base/plasma
152kde-base/kdebase kde-base/plasma-apps
153kde-base/kdebase kde-base/plasma-workspace
154kde-base/kdebase kde-base/renamedlg-plugins
155kde-base/kdebase kde-base/solid
156kde-base/kdebase kde-base/solid-hardware
157kde-base/kdebase kde-base/soliduiserver
158kde-base/kdebase kde-base/systemsettings
159kde-base/kdebindings kde-base/kalyptus
160kde-base/kdebindings kde-base/kdejava
161kde-base/kdebindings kde-base/kimono
162kde-base/kdebindings kde-base/kjsembed
163kde-base/kdebindings kde-base/korundum
164kde-base/kdebindings kde-base/krossjava
165kde-base/kdebindings kde-base/krosspython
166kde-base/kdebindings kde-base/krossruby
167kde-base/kdebindings kde-base/pykde4
168kde-base/kdebindings kde-base/qtjava
169kde-base/kdebindings kde-base/qtruby
170kde-base/kdebindings kde-base/qtsharp
171kde-base/kdebindings kde-base/qyoto
172kde-base/kdebindings kde-base/smoke
173kde-base/kdebindings kde-base/xparts
174kde-base/kdeedu kde-base/blinken
175kde-base/kdeedu kde-base/kalgebra
176kde-base/kdeedu kde-base/kalzium
177kde-base/kdeedu kde-base/kanagram
178kde-base/kdeedu kde-base/kbruch
179kde-base/kdeedu kde-base/kgeography
180kde-base/kdeedu kde-base/khangman
181kde-base/kdeedu kde-base/kig
182kde-base/kdeedu kde-base/kiten
183kde-base/kdeedu kde-base/klettres
184kde-base/kdeedu kde-base/kmplot
185kde-base/kdeedu kde-base/kpercentage
186kde-base/kdeedu kde-base/kstars
187kde-base/kdeedu kde-base/ktouch
188kde-base/kdeedu kde-base/kturtle
189kde-base/kdeedu kde-base/kwordquiz
190kde-base/kdeedu kde-base/libkdeedu
191kde-base/kdeedu kde-base/marble
192kde-base/kdeedu kde-base/parley
193kde-base/kdeedu kde-base/step
194kde-base/kdegames kde-base/bovo
195kde-base/kdegames kde-base/katomic
196kde-base/kdegames kde-base/kbattleship
197kde-base/kdegames kde-base/kblackbox
198kde-base/kdegames kde-base/kblocks
199kde-base/kdegames kde-base/kbounce
200kde-base/kdegames kde-base/kbreakout
201kde-base/kdegames kde-base/kdiamond
202kde-base/kdegames kde-base/kfourinline
203kde-base/kdegames kde-base/kgoldrunner
204kde-base/kdegames kde-base/kiriki
205kde-base/kdegames kde-base/kjumpingcube
206kde-base/kdegames kde-base/klines
207kde-base/kdegames kde-base/kmahjongg
208kde-base/kdegames kde-base/kmines
209kde-base/kdegames kde-base/knetwalk
210kde-base/kdegames kde-base/kolf
211kde-base/kdegames kde-base/kollision
212kde-base/kdegames kde-base/konquest
213kde-base/kdegames kde-base/kpat
214kde-base/kdegames kde-base/kreversi
215kde-base/kdegames kde-base/ksame
216kde-base/kdegames kde-base/kshisen
217kde-base/kdegames kde-base/ksirk
218kde-base/kdegames kde-base/kspaceduel
219kde-base/kdegames kde-base/ksquares
220kde-base/kdegames kde-base/ksudoku
221kde-base/kdegames kde-base/ktuberling
222kde-base/kdegames kde-base/kubrick
223kde-base/kdegames kde-base/libkdegames
224kde-base/kdegames kde-base/libkmahjongg
225kde-base/kdegames kde-base/lskat
226kde-base/kdegraphics kde-base/gwenview
227kde-base/kdegraphics kde-base/kamera
228kde-base/kdegraphics kde-base/kcolorchooser
229kde-base/kdegraphics kde-base/kdegraphics-strigi-analyzer
230kde-base/kdegraphics kde-base/kgamma
231kde-base/kdegraphics kde-base/kghostview
232kde-base/kdegraphics kde-base/kolourpaint
233kde-base/kdegraphics kde-base/kruler
234kde-base/kdegraphics kde-base/ksaneplugin
235kde-base/kdegraphics kde-base/ksnapshot
236kde-base/kdegraphics kde-base/libkdcraw
237kde-base/kdegraphics kde-base/libkexiv2
238kde-base/kdegraphics kde-base/libkipi
239kde-base/kdegraphics kde-base/libksane
240kde-base/kdegraphics kde-base/libkscan
241kde-base/kdegraphics kde-base/okular
242kde-base/kdegraphics kde-base/svgpart
243kde-base/kdemultimedia kde-base/dragonplayer
244kde-base/kdemultimedia kde-base/juk
245kde-base/kdemultimedia kde-base/kdemultimedia-kioslaves
246kde-base/kdemultimedia kde-base/kdemultimedia-strigi-analyzer
247kde-base/kdemultimedia kde-base/kmix
248kde-base/kdemultimedia kde-base/kscd
249kde-base/kdemultimedia kde-base/libkcddb
250kde-base/kdemultimedia kde-base/libkcompactdisc
251kde-base/kdenetwork kde-base/kdenetwork-filesharing
252kde-base/kdenetwork kde-base/kdnssd
253kde-base/kdenetwork kde-base/kget
254kde-base/kdenetwork kde-base/knewsticker
255kde-base/kdenetwork kde-base/kopete
256kde-base/kdenetwork kde-base/kppp
257kde-base/kdenetwork kde-base/krdc
258kde-base/kdenetwork kde-base/krfb
259kde-base/kdepim kde-base/akonadi
260kde-base/kdepim kde-base/akregator
261kde-base/kdepim kde-base/certmanager
262kde-base/kdepim kde-base/kabc2mutt
263kde-base/kdepim kde-base/kabcclient
264kde-base/kdepim kde-base/kaddressbook
265kde-base/kdepim kde-base/kalarm
266kde-base/kdepim kde-base/kdemaildir
267kde-base/kdepim kde-base/kdepim-icons
268kde-base/kdepim kde-base/kdepim-kioslaves
269kde-base/kdepim kde-base/kdepim-kresources
270kde-base/kdepim kde-base/kdepim-strigi-analyzer
271kde-base/kdepim kde-base/kdepim-wizards
272kde-base/kdepim kde-base/kfeed
273kde-base/kdepim kde-base/kitchensync
274kde-base/kdepim kde-base/kjots
275kde-base/kdepim kde-base/kleopatra
276kde-base/kdepim kde-base/kmail
277kde-base/kdepim kde-base/kmailcvt
278kde-base/kdepim kde-base/kmobiletools
279kde-base/kdepim kde-base/knode
280kde-base/kdepim kde-base/knotes
281kde-base/kdepim kde-base/kode
282kde-base/kdepim kde-base/konsolekalendar
283kde-base/kdepim kde-base/kontact
284kde-base/kdepim kde-base/kontact-specialdates
285kde-base/kdepim kde-base/kontactinterfaces
286kde-base/kdepim kde-base/korganizer
287kde-base/kdepim kde-base/korn
288kde-base/kdepim kde-base/kpilot
289kde-base/kdepim kde-base/ktimetracker
290kde-base/kdepim kde-base/ktnef
291kde-base/kdepim kde-base/libkdepim
292kde-base/kdepim kde-base/libkholidays
293kde-base/kdepim kde-base/libkleo
294kde-base/kdepim kde-base/libkpgp
295kde-base/kdepim kde-base/libksieve
296kde-base/kdepim kde-base/mailtransport
297kde-base/kdepim kde-base/mimelib
298kde-base/kdepim kde-base/networkstatus
299kde-base/kdesdk kde-base/cervisia
300kde-base/kdesdk kde-base/kapptemplate
301kde-base/kdesdk kde-base/kate
302kde-base/kdesdk kde-base/kbabel
303kde-base/kdesdk kde-base/kbugbuster
304kde-base/kdesdk kde-base/kcachegrind
305kde-base/kdesdk kde-base/kdeaccounts-plugin
306kde-base/kdesdk kde-base/kdesdk-kioslaves
307kde-base/kdesdk kde-base/kdesdk-misc
308kde-base/kdesdk kde-base/kdesdk-scripts
309kde-base/kdesdk kde-base/kdesdk-strigi-analyzer
310kde-base/kdesdk kde-base/kmtrace
311kde-base/kdesdk kde-base/kompare
312kde-base/kdesdk kde-base/kspy
313kde-base/kdesdk kde-base/kstartperf
314kde-base/kdesdk kde-base/kuiviewer
315kde-base/kdesdk kde-base/lokalize
316kde-base/kdesdk kde-base/poxml
317kde-base/kdesdk kde-base/strigi-analyzer
318kde-base/kdesdk kde-base/umbrello
319kde-base/kdetoys kde-base/amor
320kde-base/kdetoys kde-base/kteatime
321kde-base/kdetoys kde-base/ktux
322kde-base/kdetoys kde-base/kweather
323kde-base/kdetoys kde-base/kworldclock
324kde-base/kdeutils kde-base/ark
325kde-base/kdeutils kde-base/kcalc
326kde-base/kdeutils kde-base/kcharselect
327kde-base/kdeutils kde-base/kdessh
328kde-base/kdeutils kde-base/kdf
329kde-base/kdeutils kde-base/kfloppy
330kde-base/kdeutils kde-base/kgpg
331kde-base/kdeutils kde-base/kmilo
332kde-base/kdeutils kde-base/kregexpeditor
333kde-base/kdeutils kde-base/ktimer
334kde-base/kdeutils kde-base/kwallet
335kde-base/kdeutils kde-base/okteta
336kde-base/kdeutils kde-base/superkaramba
337kde-base/kdeutils kde-base/sweeper
338kde-base/kdewebdev kde-base/kfilereplace
339kde-base/kdewebdev kde-base/kimagemapeditor
340kde-base/kdewebdev kde-base/klinkstatus
341kde-base/kdewebdev kde-base/kxsldbg
342kde-base/kdewebdev kde-base/quanta
343'
344
345# @FUNCTION: get-parent-package
346# @USAGE: <split ebuild>
347# @DESCRIPTION:
348# Echoes the name of the monolithic package that a given split ebuild was derived from.
349get-parent-package() {
350 local parent child
351 while read parent child; do
352 if [[ "${child}" == "$1" ]]; then
353 echo ${parent}
354 return 0
355 fi
356 done <<< "$KDE_DERIVATION_MAP"
357 die "Package $target not found in KDE_DERIVATION_MAP, please report bug"
358}
359
360# @FUNCTION: get-child-packages
361# @USAGE: <monolithic ebuild>
362# @DESCRIPTION:
363# Echoes the names of all (split) ebuilds derived from a given monolithic ebuild.
364get-child-packages() {
365 local parent child
366 while read parent child; do
367 [[ "${parent}" == "$1" ]] && echo -n "${child} "
368 done <<< "$KDE_DERIVATION_MAP"
369}
370
371# @FUNCTION: is-parent-package
372# @USAGE: <$CATEGORY/$PN>
373# @DESCRIPTION:
374# Returns zero exit-status if the given package is a parent (monolithic) ebuild.
375# Returns non-zero exit-status if it's not.
376is-parent-package() {
377 local parent child
378 while read parent child; do
379 [[ "${parent}" == "$1" ]] && return 0
380 done <<< "$KDE_DERIVATION_MAP"
381 return 1
382}
383 47
384# @FUNCTION: buildsycoca 48# @FUNCTION: buildsycoca
385# @DESCRIPTION: 49# @DESCRIPTION:
386# Function to rebuild the KDE System Configuration Cache. 50# Function to rebuild the KDE System Configuration Cache.
387# All KDE ebuilds should run this in pkg_postinst and pkg_postrm. 51# All KDE ebuilds should run this in pkg_postinst and pkg_postrm.
388# 52#
389# Note that kde4-base.eclass already does this. 53# Note that kde4-base.eclass already does this.
390buildsycoca() { 54buildsycoca() {
391 debug-print-function ${FUNCNAME} "$@" 55 debug-print-function ${FUNCNAME} "$@"
392 56
393 if [[ -x ${KDEDIR}/bin/kbuildsycoca4 && -z "${ROOT%%/}" ]]; then 57 if [[ -z ${ROOT%%/} && -x ${KDEDIR}/bin/kbuildsycoca4 ]]; then
394 # Make sure tha cache file exists, or kbuildsycoca4 will fail 58 # Make sure tha cache file exists, or kbuildsycoca4 will fail
395 touch "${KDEDIR}/share/kde4/services/ksycoca4" 59 touch "${KDEDIR}/share/kde4/services/ksycoca4"
396 60
397 # We have to unset DISPLAY and DBUS_SESSION_BUS_ADDRESS, the ones 61 # We have to unset DISPLAY and DBUS_SESSION_BUS_ADDRESS, the ones
398 # in the user's environment (through su [without '-']) may cause 62 # in the user's environment (through su [without '-']) may cause
408} 72}
409 73
410# @FUNCTION: comment_all_add_subdirectory 74# @FUNCTION: comment_all_add_subdirectory
411# @USAGE: [list of directory names] 75# @USAGE: [list of directory names]
412# @DESCRIPTION: 76# @DESCRIPTION:
413# recursively comment all add_subdirectory instructions in listed directories 77# Recursively comment all add_subdirectory instructions in listed directories,
414# except the ones in cmake/. 78# except those in cmake/.
415comment_all_add_subdirectory() { 79comment_all_add_subdirectory() {
416 find "$@" -name CMakeLists.txt -print0 | grep -vFzZ "./cmake" | \ 80 find "$@" -name CMakeLists.txt -print0 | grep -vFzZ "./cmake" | \
417 xargs -0 sed -i -e '/add_subdirectory/s/^/#DONOTCOMPILE /' -e '/ADD_SUBDIRECTORY/s/^/#DONOTCOMPILE /' || \ 81 xargs -0 sed -i -e '/add_subdirectory/s/^/#DONOTCOMPILE /' -e '/ADD_SUBDIRECTORY/s/^/#DONOTCOMPILE /' || \
418 die "${LINENO}: Initial sed died" 82 die "${LINENO}: Initial sed died"
419} 83}
420 84
421# @ECLASS-VARIABLE: KDE_LINGUAS 85# @ECLASS-VARIABLE: KDE_LINGUAS
422# @DESCRIPTION: 86# @DESCRIPTION:
423# This is a whitespace-separated list of translations that this ebuild supports. 87# This is a whitespace-separated list of translations this ebuild supports.
424# These translations automatically get added to IUSE. Therefore ebuilds must set 88# These translations are automatically added to IUSE. Therefore ebuilds must set
425# this variable before inheriting any eclasses. To only enable selected 89# this variable before inheriting any eclasses. To enable only selected
426# translations ebuilds must call enable_selected_linguas(). kde4-base.eclass does 90# translations, ebuilds must call enable_selected_linguas(). kde4-base.eclass does
427# this for you. 91# this for you.
428# 92#
429# Example: KDE_LINGUAS="en_GB de nl" 93# Example: KDE_LINGUAS="en_GB de nl"
430for _lingua in ${KDE_LINGUAS}; do 94for _lingua in ${KDE_LINGUAS}; do
431 IUSE="${IUSE} linguas_${_lingua}" 95 IUSE="${IUSE} linguas_${_lingua}"
432done 96done
433 97
434# @FUNCTION: enable_selected_linguas 98# @FUNCTION: enable_selected_linguas
435# @DESCRIPTION: 99# @DESCRIPTION:
436# Enable translations based on LINGUAS settings and what translations are 100# Enable translations based on LINGUAS settings and translations supported by
437# supported (see KDE_LINGUAS). By default translations are found in "${S}"/po 101# the package (see KDE_LINGUAS). By default, translations are found in "${S}"/po
438# but this default can be overridden by defining KDE_LINGUAS_DIR. 102# but this default can be overridden by defining KDE_LINGUAS_DIR.
439enable_selected_linguas() { 103enable_selected_linguas() {
440 local lingua 104 local lingua sr_mess wp
105 # inform user about kde-l10n for full translation.
106 if ! has_version kde-base/kde-l10n; then
107 echo
108 elog "For fully translated application you should also emerge"
109 elog "kde-base/kde-l10n package which ships translated kde core"
110 elog "strings."
111 echo
112 fi
113
114 # ebuild overridable linguas directory definition
115 KDE_LINGUAS_DIR=${KDE_LINGUAS_DIR:=${S}/po}
116 cd "$KDE_LINGUAS_DIR" || die "wrong linguas dir specified"
117
118 # fix all various crazy sr@Latn variations
119 # this part is only ease for ebuilds, so there wont be any die when this
120 # fail at any point
121 sr_mess="sr@latn sr@latin sr@Latin"
122 for wp in ${sr_mess}; do
123 [[ -e "$wp.po" ]] && mv "$wp.po" "sr@Latn.po"
124 if [[ -d "$wp" ]]; then
125 # move dir and fix cmakelists
126 mv "$wp" "sr@Latn"
127 sed -i \
128 -e "s:$wp:sr@Latin:g" \
129 CMakeLists.txt
130 fi
131 done
441 132
442 for lingua in ${KDE_LINGUAS}; do 133 for lingua in ${KDE_LINGUAS}; do
443 if [ -e "${S}"/po/"${lingua}".po ]; then 134 if [[ -e "$lingua.po" ]]; then
444 mv "${S}"/po/"${lingua}".po "${S}"/po/"${lingua}".po.old 135 mv "$lingua.po" "$lingua.po.old"
445 fi 136 fi
446 done 137 done
447 comment_all_add_subdirectory "${KDE_LINGUAS_DIR:-${S}/po}" 138 comment_all_add_subdirectory "${KDE_LINGUAS_DIR}"
448 for lingua in ${LINGUAS}; do 139 for lingua in ${LINGUAS}; do
140 ebegin "Enabling LANGUAGE: ${lingua}"
449 if [ -d "${S}"/po/"${lingua}" ]; then 141 if [[ -d "$lingua" ]]; then
450 sed -e "/add_subdirectory([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \ 142 sed -e "/add_subdirectory([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
451 -e "/ADD_SUBDIRECTORY([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \ 143 -e "/ADD_SUBDIRECTORY([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
452 -i "${KDE_LINGUAS_DIR:-${S}/po}"/CMakeLists.txt || die "Sed to uncomment linguas_${lingua} failed." 144 -i CMakeLists.txt || die "Sed to uncomment linguas_${lingua} failed."
453 fi 145 fi
454 if [ -e "${S}"/po/"${lingua}".po.old ]; then 146 if [[ -e "$lingua.po.old" ]]; then
455 mv "${S}"/po/"${lingua}".po.old "${S}"/po/"${lingua}".po 147 mv "$lingua.po.old" "$lingua.po"
456 fi 148 fi
149 eend $?
457 done 150 done
458} 151}
459 152
460# @ECLASS-VARIABLE: QT4_BUILT_WITH_USE_CHECK 153# @FUNCTION: koffice_fix_libraries
461# @DESCRIPTION: 154# @DESCRIPTION:
462# A list of USE flags that x11-libs/qt:4 needs to be built with. 155# replace the weird koffice lib search with hardcoded one, so it
463# 156# actually builds and works.
464# This list is automatically appended to KDE4_BUILT_WITH_USE_CHECK, 157koffice_fix_libraries() {
465# so don't call qt4_pkg_setup manually. 158 local LIB_ARRAY R_QT_kostore R_BAS_kostore R_BAS_koodf R_KROSS_kokross R_QT_komain
466 159 local R_CMS_pigmentcms R_BAS_pigmentcms R_BAS_koresources R_BAS_flake R_BAS_koguiutils
467# @ECLASS-VARIABLE: KDE4_BUILT_WITH_USE_CHECK 160 local R_BAS_kopageapp R_BAS_kotext R_BAS_kowmf libname R
468# @DESCRIPTION: 161 case ${PN} in
469# The contents of $KDE4_BUILT_WITH_USE_CHECK gets fed to built_with_use 162 koffice-data|koffice-libs)
470# (eutils.eclass), line per line. 163 ;;
471# 164 *)
472# Example: 165 ### basic array
473# @CODE 166 LIB_ARRAY="kostore koodf kokross komain pigmentcms koresources flake koguiutils kopageapp kotext kowmf"
474# pkg_setup() { 167 ### dep array
475# KDE4_BUILT_WITH_USE_CHECK="--missing true sys-apps/dbus X" 168 R_QT_kostore="\"/usr/$(get_libdir)/qt4/libQtCore.so\"
476# use alsa && KDE4_BUILT_WITH_USE_CHECK="${KDE4_BUILT_WITH_USE_CHECK} 169 \"/usr/$(get_libdir)/qt4/libQtXml.so\"
477# --missing true media-libs/alsa-lib midi" 170 \"${KDEDIR}/$(get_libdir)/libkdecore.so\""
478# kde4-base_pkg_setup 171 R_BAS_kostore="libkostore ${R_QT_kostore}"
479# } 172 R_BAS_koodf="libkoodf ${R_BAS_kostore}"
480# @CODE 173 R_KROSS_kokross="
481 174 \"${KDEDIR}/$(get_libdir)/libkrossui.so\"
482# run built_with_use on each flag and print appropriate error messages if any 175 \"${KDEDIR}/$(get_libdir)/libkrosscore.so\""
483# flags are missing 176 R_BAS_kokross="libkokross ${R_BAS_koodf} ${R_KROSS_kokross}"
484_kde4-functions_built_with_use() { 177 R_QT_komain="\"/usr/$(get_libdir)/qt4/libQtGui.so\""
485 local missing opt pkg flag flags 178 R_BAS_komain="libkomain ${R_BAS_koodf} ${R_QT_komain}"
486 179 R_CMS_pigmentcms="\"/usr/$(get_libdir)/liblcms.so\""
487 if [[ ${1} = "--missing" ]]; then 180 R_BAS_pigmentcms="libpigmentcms ${R_BAS_komain} ${R_CMS_pigmentcms}"
488 missing="${1} ${2}" && shift 2 181 R_BAS_koresources="libkoresources ${R_BAS_pigmentcms}"
489 fi 182 R_BAS_flake="libflake ${R_BAS_pigmentcms}"
490 if [[ ${1:0:1} = "-" ]]; then 183 R_BAS_koguiutils="libkoguiutils libkoresources libflake ${R_BAS_pigmentcms}"
491 opt=${1} && shift 184 R_BAS_kopageapp="libkopageapp ${R_BAS_koguitls}"
492 fi 185 R_BAS_kotext="libkotext libkoresources libflake ${R_BAS_pigmentcms}"
493 186 ### additional unmentioned stuff
494 pkg=${1} && shift 187 R_BAS_kowmf="libkowmf"
495 188 for libname in ${LIB_ARRAY}; do
496 for flag in "${@}"; do 189 ebegin "Fixing library ${libname} with hardcoded path"
497 flags="${flags} ${flag}" 190 for libpath in $(eval "echo \$R_BAS_${libname}"); do
498 if ! built_with_use ${missing} ${opt} ${pkg} ${flag}; then 191 if [[ "${libpath}" != "\"/usr/"* ]]; then
499 flags="${flags}*" 192 R="${R} \"${KDEDIR}/$(get_libdir)/${libpath}.so\""
500 else 193 else
501 [[ ${opt} = "-o" ]] && return 0 194 R="${R} ${libpath}"
502 fi 195 fi
196 done
197 find "${S}" -name CMakeLists.txt -print| xargs -i \
198 sed -i \
199 -e "s: ${libname} : ${R} :g" \
200 -e "s: ${libname}): ${R}):g" \
201 -e "s:(${libname} :(${R} :g" \
202 -e "s:(${libname}):(${R}):g" \
203 -e "s: ${libname}$: ${R}:g" \
204 {} || die "Fixing library names failed."
205 eend $?
503 done 206 done
504 if [[ "${flags# }" = "${@}" ]]; then 207 ;;
505 return 0 208 esac
506 fi 209}
507 if [[ ${opt} = "-o" ]]; then 210# @FUNCTION: get_build_type
508 eerror "This package requires '${pkg}' to be built with any of the following USE flags: '$*'." 211# @DESCRIPTION:
212# Determine whether we are using live ebuild or tbzs.
213get_build_type() {
214 if [[ $SLOT = live || $PV = 9999* ]]; then
215 BUILD_TYPE="live"
509 else 216 else
510 eerror "This package requires '${pkg}' to be built with the following USE flags: '${flags# }'." 217 BUILD_TYPE="release"
511 fi 218 fi
512 return 1 219 export BUILD_TYPE
513} 220}
514 221
515# @FUNCTION: kde4-functions_check_use 222# @FUNCTION: get_latest_kdedir
516# @DESCRIPTION: 223# @DESCRIPTION:
517# Check if the Qt4 libraries are built with the USE flags listed in 224# We set up KDEDIR according to the latest KDE version installed; installing our
518# $QT4_BUILT_WITH_USE_CHECK. 225# package for all available installs is just insane.
519# 226# We can check for kdelibs because it is the most basic package; no KDE package
520# Check if a list of packages are built with certain USE flags, as listed in 227# working without it. This might be changed in future.
521# $KDE4_BUILT_WITH_USE_CHECK. 228get_latest_kdedir() {
522# 229 if [[ $NEED_KDE = latest && $KDEBASE != kde-base ]]; then
523# If any of the required USE flags are missing, an eerror will be printed for 230 case ${KDE_WANTED} in
524# each package with missing USE flags. 231 # note this will need to be updated as stable moves and so on
525kde4-functions_check_use() { 232 live)
526 # I like to keep flags sorted 233 _versions="9999 4.1.69 4.1.0"
527 QT4_BUILT_WITH_USE_CHECK=$(echo "${QT4_BUILT_WITH_USE_CHECK}" | \ 234 ;;
528 tr '[:space:]' '\n' | sort | uniq | xargs) 235 snapshot)
529 236 _versions="4.1.69 4.1.0 9999"
530 local line missing 237 ;;
531 if [[ -n ${KDE4_BUILT_WITH_USE_CHECK[@]} && $(declare -p KDE4_BUILT_WITH_USE_CHECK) = 'declare -a '* ]]; then 238 testing)
532 KDE4_BUILT_WITH_USE_CHECK=("x11-libs/qt:4 ${QT4_BUILT_WITH_USE_CHECK}" 239 _versions="4.1.0 4.1.69 9999"
533 "${KDE4_BUILT_WITH_USE_CHECK[@]}") 240 ;;
534 241 stable)
535 for line in "${KDE4_BUILT_WITH_USE_CHECK[@]}"; do 242 _versions="4.1.0 4.1.69 9999"
536 [[ -z ${line} ]] && continue 243 ;;
537 if ! _kde4-functions_built_with_use ${line}; then 244 *) die "KDE_WANTED=${KDE_WANTED} not supported here." ;;
538 missing=true 245 esac
246 # check if exists and fallback as we go
247 for X in ${_versions}; do
248 if has_version ">=kde-base/kdelibs-${X}"; then
249 # figure out which X we are in and set it into _kdedir
250 case ${X} in
251 # also keep track here same for kde_wanted
252 9999)
253 _kdedir="live"
254 break
255 ;;
256 4.1.69)
257 _kdedir="4.2"
258 break
259 ;;
260 4.1.0)
261 _kdedir="4.1"
262 break
263 ;;
264 esac
539 fi 265 fi
540 done 266 done
541 else 267 fi
542 KDE4_BUILT_WITH_USE_CHECK="x11-libs/qt:4 ${QT4_BUILT_WITH_USE_CHECK} 268}
543 ${KDE4_BUILT_WITH_USE_CHECK}"
544 269
545 while read line; do 270# @FUNCTION: migrate_store_dir
546 [[ -z ${line} ]] && continue 271# @DESCRIPTION:
547 if ! _kde4-functions_built_with_use ${line}; then 272# Migrate the remnants of ${ESVN_STORE_DIR}/KDE/ to ${ESVN_STORE_DIR}/.
548 missing=true 273# Perform experimental split of kdebase to kdebase-apps.
274migrate_store_dir() {
275 local cleandir
276 cleandir="${ESVN_STORE_DIR}/KDE"
277 if [[ -d "${cleandir}" ]]; then
278 ewarn "'${cleandir}' has been found. Moving contents to new location."
279 addwrite "${ESVN_STORE_DIR}"
280 # Split kdebase
281 local module
282 if pushd "${cleandir}"/kdebase/kdebase > /dev/null; then
283 for module in `find . -maxdepth 1 -type d -name [a-z0-9]\*`; do
284 module="${module#./}"
285 mkdir -p "${ESVN_STORE_DIR}/kdebase-${module}" && mv -f "${module}" "${ESVN_STORE_DIR}/kdebase-${module}" || \
286 die "Failed to move to '${ESVN_STORE_DIR}/kdebase-${module}'."
287 done
288 popd > /dev/null
289 rm -fr "${cleandir}/kdebase" || \
290 die "Failed to remove ${cleandir}/kdebase. You need to remove it manually."
549 fi 291 fi
550 done <<< "${KDE4_BUILT_WITH_USE_CHECK}" 292 # Move the rest
293 local pkg
294 for pkg in "${cleandir}"/*; do
295 mv -f "${pkg}" "${ESVN_STORE_DIR}"/ || eerror "failed to move ${pkg}"
296 done
297 rmdir "${cleandir}" || die "Could not move obsolete KDE store dir. Please move '${cleandir}' contents to appropriate location (possibly ${ESVN_STORE_DIR}) and manually remove '${cleandir}' in order to continue."
551 fi 298 fi
552 if [[ -n ${missing} ]]; then
553 echo
554 eerror "Flags marked with an * are missing."
555 die "Missing USE flags found"
556 fi
557} 299}
300
301# Functions handling KMLOADLIBS and KMSAVELIBS
302
303# @FUNCTION: save_library_dependencies
304# @DESCRIPTION:
305# Add exporting CMake dependencies for current package
306save_library_dependencies() {
307 local depsfile="${T}/${PN}:${SLOT}"
308
309 ebegin "Saving library dependendencies in ${depsfile##*/}"
310 echo "EXPORT_LIBRARY_DEPENDENCIES(\"${depsfile}\")" >> "${S}/CMakeLists.txt" || \
311 die "Failed to save the library dependencies."
312 eend $?
313}
314
315# @FUNCTION: install_library_dependencies
316# @DESCRIPTION:
317# Install generated CMake library dependencies to /var/lib/kde
318install_library_dependencies() {
319 local depsfile="$T/$PN:$SLOT"
320 ebegin "Installing library dependendencies as ${depsfile##*/}"
321 insinto /var/lib/kde
322 doins "${depsfile}" || die "Failed to install library dependencies."
323 eend $?
324}
325
326# @FUNCTION: load_library_dependencies
327# @DESCRIPTION:
328# Inject specified library dependencies in current package
329load_library_dependencies() {
330 local pn i depsfile
331 ebegin "Injecting library dependendencies from '${KMLOADLIBS}'"
332
333 i=0
334 for pn in ${KMLOADLIBS} ; do
335 ((i++))
336 depsfile="/var/lib/kde/${pn}:${SLOT}"
337 [[ -r "${depsfile}" ]] || die "Depsfile '${depsfile}' not accessible. You probably need to reinstall ${pn}."
338 sed -i -e "${i}iINCLUDE(\"${depsfile}\")" "${S}/CMakeLists.txt" || \
339 die "Failed to include library dependencies for ${pn}"
340 done
341 eend $?
342}

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20