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

  ViewVC Help
Powered by ViewVC 1.1.20