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

Diff of /eclass/kde4-base.eclass

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

Revision 1.44 Revision 1.53
1# Copyright 2007-2009 Gentoo Foundation 1# Copyright 1999-2009 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-base.eclass,v 1.44 2009/08/20 09:18:01 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-base.eclass,v 1.53 2009/11/25 19:51:11 tampakrap Exp $
4 4
5# @ECLASS: kde4-base.eclass 5# @ECLASS: kde4-base.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# kde@gentoo.org 7# kde@gentoo.org
8# @BLURB: This eclass provides functions for kde 4.X ebuilds 8# @BLURB: This eclass provides functions for kde 4.X ebuilds
11# and KDE4 applications. 11# and KDE4 applications.
12# 12#
13# NOTE: KDE 4 ebuilds by default define EAPI="2", this can be redefined but 13# NOTE: KDE 4 ebuilds by default define EAPI="2", this can be redefined but
14# eclass will fail with version older than 2. 14# eclass will fail with version older than 2.
15 15
16# @ECLASS-VARIABLE: WANT_CMAKE 16# @ECLASS-VARIABLE: CMAKE_REQUIRED
17# @DESCRIPTION: 17# @DESCRIPTION:
18# Specify if cmake-utils eclass is required. Defaults to true. Please note that 18# Specify if cmake buildsystem is being used. Possible values are 'always' and 'never'.
19# if the variable is set otherwise src_configure/compile/install calls in ebuild 19# Please note that if it's set to 'never' you need to explicitly override following phases:
20# must be overrided (can't use the eclass ones).
21WANT_CMAKE="${WANT_CMAKE:-true}"
22if [[ ${WANT_CMAKE} = true ]]; then
23 exports="src_configure src_compile src_test src_install" 20# src_configure, src_compile, src_test and src_install.
24 cmake_eclass="cmake-utils" 21# Defaults to 'always'.
22CMAKE_REQUIRED="${CMAKE_REQUIRED:-${CMAKE_REQUIRED:-always}}"
23if [[ ${CMAKE_REQUIRED} = false || ${CMAKE_REQUIRED} = never ]]; then
24 buildsystem_eclass=""
25 export_fns=""
25else 26else
26 exports="" 27 buildsystem_eclass="cmake-utils"
27 cmake_eclass="" 28 export_fns="src_configure src_compile src_test src_install"
28fi 29fi
29 30
30inherit base ${cmake_eclass} eutils kde4-functions 31inherit kde4-functions
31 32
32get_build_type 33get_build_type
33if [[ ${BUILD_TYPE} = live ]]; then 34if [[ ${BUILD_TYPE} = live ]]; then
34 inherit subversion 35 subversion_eclass="subversion"
35fi 36fi
36 37
38inherit base ${buildsystem_eclass} eutils ${subversion_eclass}
37 39
38EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare ${exports} pkg_postinst pkg_postrm 40EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare ${export_fns} pkg_postinst pkg_postrm
41
42unset buildsystem_eclass
43unset export_fns
44unset subversion_eclass
39 45
40case ${KDEBASE} in 46case ${KDEBASE} in
41 kde-base) 47 kde-base)
42 HOMEPAGE="http://www.kde.org/" 48 HOMEPAGE="http://www.kde.org/"
43 LICENSE="GPL-2" 49 LICENSE="GPL-2"
86fi 92fi
87 93
88# @ECLASS-VARIABLE: KDE_MINIMAL 94# @ECLASS-VARIABLE: KDE_MINIMAL
89# @DESCRIPTION: 95# @DESCRIPTION:
90# This variable is used when KDE_REQUIRED is set, to specify required KDE minimal 96# This variable is used when KDE_REQUIRED is set, to specify required KDE minimal
91# version for apps to work. Currently defaults to 4.2 97# version for apps to work. Currently defaults to 4.3
92# One may override this variable to raise version requirements. 98# One may override this variable to raise version requirements.
93# For possible values look at KDE_SLOTS and KDE_LIVE_SLOTS variables. 99# For possible values look at KDE_SLOTS and KDE_LIVE_SLOTS variables.
94# Note that it is fixed to ${SLOT} for kde-base packages. 100# Note that it is fixed to ${SLOT} for kde-base packages.
95KDE_MINIMAL="${KDE_MINIMAL:-4.2}" 101KDE_MINIMAL="${KDE_MINIMAL:-4.3}"
96
97# Fallback behaviour (for now)
98# TODO Remove when tree is clean
99if [[ -n ${NEED_KDE} ]]; then
100 case ${NEED_KDE} in
101 none)
102 KDE_REQUIRED="never"
103 ;;
104 *)
105 KDE_REQUIRED="always"
106 KDE_MINIMAL="${NEED_KDE}"
107 ;;
108 esac
109fi
110
111# @ECLASS-VARIABLE: QT_DEPEND
112# @DESCRIPTION:
113# Determine version of qt we enforce as minimal for the package. 4.4.0 4.5.1..
114# Currently defaults to 4.5.1
115QT_DEPEND="${QT_DEPEND:-4.5.1}"
116
117# OpenGL dependencies
118qtopengldepend="
119 >=x11-libs/qt-opengl-${QT_DEPEND}:4
120"
121case ${OPENGL_REQUIRED} in
122 always)
123 COMMONDEPEND+=" ${qtopengldepend}"
124 ;;
125 optional)
126 IUSE+=" opengl"
127 COMMONDEPEND+=" opengl? ( ${qtopengldepend} )"
128 ;;
129 *) ;;
130esac
131unset qtopengldepend
132
133# WebKit dependencies
134case ${KDE_REQUIRED} in
135 always)
136 qtwebkitusedeps="[kde]"
137 ;;
138 optional)
139 qtwebkitusedeps="[kde?]"
140 ;;
141 *) ;;
142esac
143qtwebkitdepend="
144 >=x11-libs/qt-webkit-${QT_DEPEND}:4${qtwebkitusedeps}
145"
146unset qtwebkitusedeps
147case ${WEBKIT_REQUIRED} in
148 always)
149 COMMONDEPEND+=" ${qtwebkitdepend}"
150 ;;
151 optional)
152 IUSE+=" webkit"
153 COMMONDEPEND+=" webkit? ( ${qtwebkitdepend} )"
154 ;;
155 *) ;;
156esac
157unset qtwebkitdepend
158
159# CppUnit dependencies
160cppuintdepend="
161 dev-util/cppunit
162"
163case ${CPPUNIT_REQUIRED} in
164 always)
165 DEPEND+=" ${cppuintdepend}"
166 ;;
167 optional)
168 IUSE+=" test"
169 DEPEND+=" test? ( ${cppuintdepend} )"
170 ;;
171 *) ;;
172esac
173unset cppuintdepend
174 102
175# Setup packages inheriting this eclass 103# Setup packages inheriting this eclass
176case ${KDEBASE} in 104case ${KDEBASE} in
177 kde-base) 105 kde-base)
178 if [[ $BUILD_TYPE = live ]]; then 106 if [[ $BUILD_TYPE = live ]]; then
185 IUSE+=" kdeprefix" 113 IUSE+=" kdeprefix"
186 fi 114 fi
187 # Determine SLOT from PVs 115 # Determine SLOT from PVs
188 case ${PV} in 116 case ${PV} in
189 *.9999*) SLOT="${PV/.9999*/}" ;; # stable live 117 *.9999*) SLOT="${PV/.9999*/}" ;; # stable live
190 4.4* | 4.3.9* | 4.3.8* | 4.3.7* | 4.3.6*) SLOT="4.4" ;; 118 4.4* | 4.3.[6-9]*) SLOT="4.4" ;;
191 4.3* | 4.2.9* | 4.2.8* | 4.2.7* | 4.2.6*) SLOT="4.3" ;; 119 4.3*) SLOT="4.3" ;;
192 4.2* | 4.1.9* | 4.1.8* | 4.1.7* | 4.1.6*) SLOT="4.2" ;; 120 4.2*) SLOT="4.2" ;;
193 9999*) SLOT="live" ;; # regular live 121 9999*) SLOT="live" ;; # regular live
194 *) die "Unsupported ${PV}" ;; 122 *) die "Unsupported ${PV}" ;;
195 esac 123 esac
124 # This code is to prevent portage from searching GENTOO_MIRRORS for
125 # packages that will never be mirrored. (As they only will ever be in
126 # the overlay).
127 case ${PV} in
128 *9999* | 4.?.[6-9]?)
129 RESTRICT+=" mirror"
130 ;;
131 esac
132 KDE_MINIMAL="${SLOT}"
196 _kdedir="${SLOT}" 133 _kdedir="${SLOT}"
197 _pv="-${PV}:${SLOT}"
198 _pvn="-${PV}"
199 134
200 # Block installation of other SLOTS unless kdeprefix 135 # Block installation of other SLOTS unless kdeprefix
201 RDEPEND+=" $(block_other_slots)" 136 RDEPEND+=" $(block_other_slots)"
202 ;; 137 ;;
203 koffice) 138 koffice)
204 SLOT="2" 139 SLOT="2"
205 _pv="-${KDE_MINIMAL}"
206 _pvn="${_pv}"
207 ;; 140 ;;
208 *)
209 _pv="-${KDE_MINIMAL}"
210 _pvn="${_pv}"
211 ;;
212
213esac 141esac
142
143# @ECLASS-VARIABLE: QT_MINIMAL
144# @DESCRIPTION:
145# Determine version of qt we enforce as minimal for the package. 4.4.0 4.5.1..
146# Currently defaults to 4.5.1 for KDE 4.3 and earlier
147# or 4.6.0_beta for KDE 4.4 and later
148if slot_is_at_least 4.4 "${KDE_MINIMAL}"; then
149 QT_MINIMAL="${QT_MINIMAL:-4.6.0_beta}"
150fi
151
152QT_MINIMAL="${QT_MINIMAL:-4.5.1}"
153
154# OpenGL dependencies
155qtopengldepend="
156 >=x11-libs/qt-opengl-${QT_MINIMAL}:4
157"
158case ${OPENGL_REQUIRED} in
159 always)
160 COMMONDEPEND+=" ${qtopengldepend}"
161 ;;
162 optional)
163 IUSE+=" opengl"
164 COMMONDEPEND+=" opengl? ( ${qtopengldepend} )"
165 ;;
166 *) ;;
167esac
168unset qtopengldepend
169
170# WebKit dependencies
171case ${KDE_REQUIRED} in
172 always)
173 qtwebkitusedeps="[kde]"
174 ;;
175 optional)
176 qtwebkitusedeps="[kde?]"
177 ;;
178 *) ;;
179esac
180qtwebkitdepend="
181 >=x11-libs/qt-webkit-${QT_MINIMAL}:4${qtwebkitusedeps}
182"
183unset qtwebkitusedeps
184case ${WEBKIT_REQUIRED} in
185 always)
186 COMMONDEPEND+=" ${qtwebkitdepend}"
187 ;;
188 optional)
189 IUSE+=" webkit"
190 COMMONDEPEND+=" webkit? ( ${qtwebkitdepend} )"
191 ;;
192 *) ;;
193esac
194unset qtwebkitdepend
195
196# CppUnit dependencies
197cppuintdepend="
198 dev-util/cppunit
199"
200case ${CPPUNIT_REQUIRED} in
201 always)
202 DEPEND+=" ${cppuintdepend}"
203 ;;
204 optional)
205 IUSE+=" test"
206 DEPEND+=" test? ( ${cppuintdepend} )"
207 ;;
208 *) ;;
209esac
210unset cppuintdepend
214 211
215# KDE dependencies 212# KDE dependencies
216kdecommondepend=" 213kdecommondepend="
217 dev-lang/perl 214 dev-lang/perl
218 >=x11-libs/qt-core-${QT_DEPEND}:4[qt3support,ssl] 215 >=x11-libs/qt-core-${QT_MINIMAL}:4[qt3support,ssl]
219 >=x11-libs/qt-gui-${QT_DEPEND}:4[accessibility,dbus] 216 >=x11-libs/qt-gui-${QT_MINIMAL}:4[accessibility,dbus]
220 >=x11-libs/qt-qt3support-${QT_DEPEND}:4[accessibility,kde] 217 >=x11-libs/qt-qt3support-${QT_MINIMAL}:4[accessibility,kde]
221 >=x11-libs/qt-script-${QT_DEPEND}:4 218 >=x11-libs/qt-script-${QT_MINIMAL}:4
222 >=x11-libs/qt-sql-${QT_DEPEND}:4[qt3support] 219 >=x11-libs/qt-sql-${QT_MINIMAL}:4[qt3support]
223 >=x11-libs/qt-svg-${QT_DEPEND}:4 220 >=x11-libs/qt-svg-${QT_MINIMAL}:4
224 >=x11-libs/qt-test-${QT_DEPEND}:4 221 >=x11-libs/qt-test-${QT_MINIMAL}:4
225 !aqua? ( 222 !aqua? (
226 x11-libs/libXext 223 x11-libs/libXext
227 x11-libs/libXt 224 x11-libs/libXt
228 x11-libs/libXxf86vm 225 x11-libs/libXxf86vm
229 ) 226 )
230" 227"
231if [[ ${PN} != kdelibs ]]; then 228if [[ ${PN} != kdelibs ]]; then
232 if [[ ${KDEBASE} = kde-base ]]; then 229 if [[ ${KDEBASE} = kde-base ]]; then
233 kdecommondepend+=" 230 kdecommondepend+=" $(add_kdebase_dep kdelibs)"
234 kdeprefix? ( >=kde-base/kdelibs${_pv}[kdeprefix] ) 231 # libknotificationitem only when SLOT is 4.3
235 !kdeprefix? ( >=kde-base/kdelibs${_pvn}[-kdeprefix] ) 232 [[ ${PN} != libknotificationitem ]] && [[ ${SLOT} = 4.3 ]] && \
236 " 233 kdecommondepend+=" $(add_kdebase_dep libknotificationitem)"
237 else 234 else
238 kdecommondepend+=" 235 kdecommondepend+="
239 >=kde-base/kdelibs${_pv} 236 >=kde-base/kdelibs-${KDE_MINIMAL}
240 " 237 "
241 fi 238 fi
242fi 239fi
243unset _pv _pvn
244kdedepend=" 240kdedepend="
245 dev-util/pkgconfig 241 dev-util/pkgconfig
246" 242"
247case ${KDE_REQUIRED} in 243case ${KDE_REQUIRED} in
248 always) 244 always)
355 esac 351 esac
356 else 352 else
357 _kmname=${PN} 353 _kmname=${PN}
358 fi 354 fi
359 _kmname_pv="${_kmname}-${PV}" 355 _kmname_pv="${_kmname}-${PV}"
360 if [[ $NEED_KDE != live ]]; then
361 case ${KDEBASE} in 356 case ${KDEBASE} in
362 kde-base) 357 kde-base)
363 case ${PV} in 358 case ${PV} in
364 4.3.85 | 4.3.90 | 4.3.95 | 4.3.96) 359 4.3.85 | 4.3.9[0568])
365 # block for normally packed unstable releases
366 SRC_URI="mirror://kde/unstable/${PV}/src/${_kmname_pv}.tar.bz2" ;;
367 4.3.9* | 4.3.8* | 4.3.7* | 4.3.6*)
368 SRC_URI="http://dev.gentooexperimental.org/~alexxy/kde/${PV}/${_kmname_pv}.tar.lzma" ;;
369 4.2.85 | 4.2.90 | 4.2.95 | 4.2.96 | 4.2.98)
370 # block for normally packed unstable releases 360 # block for normally packed unstable releases
371 SRC_URI="mirror://kde/unstable/${PV}/src/${_kmname_pv}.tar.bz2" ;; 361 SRC_URI="mirror://kde/unstable/${PV}/src/${_kmname_pv}.tar.bz2" ;;
372 4.2.9* | 4.2.8* | 4.2.7* | 4.2.6*) 362 4.3.[6-9]*)
373 SRC_URI="http://dev.gentooexperimental.org/~alexxy/kde/${PV}/${_kmname_pv}.tar.lzma" ;; 363 SRC_URI="http://dev.gentooexperimental.org/~alexxy/kde/${PV}/${_kmname_pv}.tar.lzma" ;;
374 4.1.9* | 4.1.8* | 4.1.7* | 4.1.6* | 4.0.9* | 4.0.8*)
375 SRC_URI="mirror://kde/unstable/${PV}/src/${_kmname_pv}.tar.bz2" ;;
376 *) SRC_URI="mirror://kde/stable/${PV}/src/${_kmname_pv}.tar.bz2" ;; 364 *) SRC_URI="mirror://kde/stable/${PV}/src/${_kmname_pv}.tar.bz2" ;;
377 esac 365 esac
378 ;; 366 ;;
379 koffice) 367 koffice)
380 case ${PV} in 368 case ${PV} in
381 1.9*)
382 SRC_URI="mirror://kde/unstable/${_kmname_pv}/src/${_kmname_pv}.tar.bz2" 369 2.0.[6-9]*) SRC_URI="mirror://kde/unstable/${_kmname_pv}/src/${_kmname_pv}.tar.bz2" ;;
383 ;;
384 *) SRC_URI="mirror://kde/stable/${_kmname_pv}/src/${_kmname_pv}.tar.bz2" ;; 370 *) SRC_URI="mirror://kde/stable/${_kmname_pv}/${_kmname_pv}.tar.bz2" ;;
385 esac 371 esac
386 ;;
387 esac 372 esac
388 fi
389 unset _kmname _kmname_pv 373 unset _kmname _kmname_pv
390 fi 374 fi
391 ;; 375 ;;
392esac 376esac
393 377
404# Do the basic kdeprefix KDEDIR settings and determine with which kde should 388# Do the basic kdeprefix KDEDIR settings and determine with which kde should
405# optional applications link 389# optional applications link
406kde4-base_pkg_setup() { 390kde4-base_pkg_setup() {
407 debug-print-function ${FUNCNAME} "$@" 391 debug-print-function ${FUNCNAME} "$@"
408 392
393 # Prefix compat:
394 use prefix || EROOT=${ROOT}
395 # Append missing trailing slash character
396 [[ ${EROOT} = */ ]] || EROOT+="/"
397
409 # QA ebuilds 398 # QA ebuilds
410 case ${NEED_KDE} in
411 none) ewarn "QA Notice: using deprecated NEED_KDE variable, use KDE_REQUIRED=\"never\" or KDE_REQUIRED=\"optional\" instead. You may want to override KDE_MINIMAL as well (default is KDE_MINIMAL=\"${KDE_MINIMAL}\")." ;;
412 *) [[ -n ${NEED_KDE} ]] && ewarn "QA Notice: using deprecated NEED_KDE variable, use KDE_MINIMAL instead (default is KDE_MINIMAL=\"${KDE_MINIMAL}\")." ;;
413 esac
414 [[ -z ${KDE_MINIMAL_VALID} ]] && ewarn "QA Notice: ignoring invalid KDE_MINIMAL (defaulting to ${KDE_MINIMAL})." 399 [[ -z ${KDE_MINIMAL_VALID} ]] && ewarn "QA Notice: ignoring invalid KDE_MINIMAL (defaulting to ${KDE_MINIMAL})."
415 400
416 # Don't set KDEHOME during compilation, it will cause access violations 401 # Don't set KDEHOME during compilation, it will cause access violations
417 unset KDEHOME 402 unset KDEHOME
418 403
452 # Point pkg-config path to KDE *.pc files 437 # Point pkg-config path to KDE *.pc files
453 export PKG_CONFIG_PATH="${KDEDIR}/$(get_libdir)/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}" 438 export PKG_CONFIG_PATH="${KDEDIR}/$(get_libdir)/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}"
454 # Point to correct QT plugins path 439 # Point to correct QT plugins path
455 QT_PLUGIN_PATH="${KDEDIR}/$(get_libdir)/kde4/plugins/" 440 QT_PLUGIN_PATH="${KDEDIR}/$(get_libdir)/kde4/plugins/"
456 441
442 # Fix XDG collision with sandbox
443 export XDG_CONFIG_HOME="${T}"
457 # Not needed anymore 444 # Not needed anymore
458 unset _kdedir 445 unset _kdedir
459} 446}
460 447
461# @FUNCTION: kde4-base_src_unpack 448# @FUNCTION: kde4-base_src_unpack
536 QTEST_COLORED=1 523 QTEST_COLORED=1
537 524
538 # Shadow existing /usr installations 525 # Shadow existing /usr installations
539 unset KDEDIRS 526 unset KDEDIRS
540 527
528 # Handle kdeprefix-ed KDE
541 if [[ ${KDEDIR} != "${EROOT}usr" ]]; then 529 if [[ ${KDEDIR} != "${EROOT}usr" ]]; then
542 # Override some environment variables - only when kdeprefix is different, 530 # Override some environment variables - only when kdeprefix is different,
543 # to not break ccache/distcc 531 # to not break ccache/distcc
544 PATH="${KDEDIR}/bin:${PATH}" 532 PATH="${KDEDIR}/bin:${PATH}"
545 LDPATH="${KDEDIR}/$(get_libdir):${LDPATH}" 533 LDPATH="${KDEDIR}/$(get_libdir):${LDPATH}"
546 534
547 # Append full RPATH 535 # Append full RPATH
548 cmakeargs+=" -DCMAKE_SKIP_RPATH=OFF" 536 cmakeargs+=" -DCMAKE_SKIP_RPATH=OFF"
549 fi
550 537
551 if has kdeprefix ${IUSE//+} && use kdeprefix; then
552 # Set cmake prefixes to allow buildsystem to localize valid KDE installation 538 # Set cmake prefixes to allow buildsystem to locate valid KDE installation
553 # when more are present 539 # when more are present
554 cmakeargs+=" -DCMAKE_SYSTEM_PREFIX_PATH=${KDEDIR}" 540 cmakeargs+=" -DCMAKE_SYSTEM_PREFIX_PATH=${KDEDIR}"
555 else 541 fi
542
543 # Handle kdeprefix in application itself
544 if ! has kdeprefix ${IUSE//+} || ! use kdeprefix; then
556 # If prefix is /usr, sysconf needs to be /etc, not /usr/etc 545 # If prefix is /usr, sysconf needs to be /etc, not /usr/etc
557 cmakeargs+=" -DSYSCONF_INSTALL_DIR=${EROOT}etc" 546 cmakeargs+=" -DSYSCONF_INSTALL_DIR=${EROOT}etc"
558 fi 547 fi
559 548
560 mycmakeargs="${cmakeargs} ${mycmakeargs}" 549 mycmakeargs="${cmakeargs} ${mycmakeargs}"
621 fi 610 fi
622 611
623 if [[ -n ${KDEBASE} ]] && [[ -d "${D}${EROOT}usr/share/doc/${PF}" ]]; then 612 if [[ -n ${KDEBASE} ]] && [[ -d "${D}${EROOT}usr/share/doc/${PF}" ]]; then
624 # work around bug #97196 613 # work around bug #97196
625 dodir /usr/share/doc/KDE4 && \ 614 dodir /usr/share/doc/KDE4 && \
626 mv -f "${D}${EROOT}usr/share/doc/${PF}" "${D}${EROOT}usr/share/doc/KDE4/" || \ 615 cp -r "${D}${EROOT}usr/share/doc/${PF}" "${D}${EROOT}usr/share/doc/KDE4/" || \
627 die "Failed to move docs to KDE4/." 616 die "Failed to move docs to KDE4/."
617 rm -rf "${D}${EROOT}usr/share/doc/${PF}"
628 fi 618 fi
629} 619}
630 620
631# @FUNCTION: kde4-base_pkg_postinst 621# @FUNCTION: kde4-base_pkg_postinst
632# @DESCRIPTION: 622# @DESCRIPTION:

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.53

  ViewVC Help
Powered by ViewVC 1.1.20