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

Diff of /eclass/kde4-functions.eclass

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

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

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

  ViewVC Help
Powered by ViewVC 1.1.20