/[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.6 Revision 1.12
1# Copyright 2007-2008 Gentoo Foundation 1# Copyright 2007-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-base.eclass,v 1.6 2008/03/26 20:39:05 zlin Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-base.eclass,v 1.12 2008/05/17 14:09:03 zlin 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.0 ebuilds 8# @BLURB: This eclass provides functions for kde 4.0 ebuilds
15 15
16inherit base eutils multilib cmake-utils kde4-functions 16inherit base eutils multilib cmake-utils kde4-functions
17 17
18EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_postinst pkg_postrm 18EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_postinst pkg_postrm
19 19
20COMMONDEPEND="|| ( ( 20kde4-base_set_qt_dependencies() {
21 local qt qtcore qtgui qt3support qtdepend qtopengldepend
22
23 # use dependencies
24 case "${EAPI}" in
25 kdebuild-1)
26 qt="[accessibility][dbus][gif][jpeg][png][qt3support][ssl][zlib]"
27 qtcore="[qt3support][ssl]"
28 qtgui="[accessibility][dbus]"
29 qt3support="[accessibility]"
30 case "${OPENGL_REQUIRED}" in
31 always)
32 qt="${qt}[opengl]"
33 ;;
34 optional)
35 qt="${qt}[opengl?]"
36 ;;
37 esac
38 ;;
39 esac
40
41 # split qt
42 qtdepend="
43 x11-libs/qt-core:4${qtcore}
44 x11-libs/qt-gui:4${qtgui}
45 x11-libs/qt-qt3support:4${qt3support}
21 x11-libs/qt-core:4 46 x11-libs/qt-script:4
22 x11-libs/qt-gui:4
23 x11-libs/qt-qt3support:4
24 x11-libs/qt-svg:4 47 x11-libs/qt-svg:4
25 x11-libs/qt-test:4 ) 48 x11-libs/qt-test:4"
26 >=x11-libs/qt-4.3.3:4 )" 49 qtopengldepend="x11-libs/qt-opengl:4"
27 50
28# @ECLASS-VARIABLE: OPENGL_REQUIRED 51 # allow monolithic qt for PV < 4.1
29# @DESCRIPTION: 52 case "${PV}" in
30# Is qt-opengl required? Possible values are 'always', 'optional' and 'never'. 53 scm|9999.4|4.1*) : ;;
31# This variable must be set before inheriting any eclasses. Defaults to 'never'. 54 *)
32OPENGL_REQUIRED="${OPENGL_REQUIRED:-never}" 55 qtdepend="|| ( ( ${qtdepend} ) >=x11-libs/qt-4.3.3:4${qt} )"
56 qtopengldepend="|| ( ${qtopengldepend} >=x11-libs/qt-4.3.3:4 )"
57 ;;
58 esac
33 59
34OPENGLDEPEND="|| ( x11-libs/qt-opengl:4 60 # opengl dependencies
35 >=x11-libs/qt-4.3.3:4 )"
36case "${OPENGL_REQUIRED}" in 61 case "${OPENGL_REQUIRED}" in
37 always) 62 always)
38 COMMONDEPEND="${COMMONDEPEND} 63 qtdepend="${qtdepend}
39 ${OPENGLDEPEND}" 64 ${qtopengldepend}"
40 ;; 65 ;;
41 optional) 66 optional)
42 IUSE="${IUSE} opengl" 67 IUSE="${IUSE} opengl"
43 COMMONDEPEND="${COMMONDEPEND} 68 qtdepend="${qtdepend}
44 opengl? ( ${OPENGLDEPEND} )" 69 opengl? ( ${qtopengldepend} )"
45 ;; 70 ;;
46 *) 71 *)
47 OPENGL_REQUIRED="never" 72 OPENGL_REQUIRED="never"
48 ;; 73 ;;
49esac 74 esac
75
76 COMMONDEPEND="${COMMONDEPEND} ${qtdepend}"
77}
78kde4-base_set_qt_dependencies
50 79
51DEPEND="${DEPEND} ${COMMONDEPEND} 80DEPEND="${DEPEND} ${COMMONDEPEND}
52 >=dev-util/cmake-2.4.7-r1 81 >=dev-util/cmake-2.4.7-r1
53 dev-util/pkgconfig 82 dev-util/pkgconfig
54 x11-libs/libXt 83 x11-libs/libXt
55 x11-proto/xf86vidmodeproto" 84 x11-proto/xf86vidmodeproto"
56RDEPEND="${RDEPEND} ${COMMONDEPEND}" 85RDEPEND="${RDEPEND} ${COMMONDEPEND}"
86
87# @ECLASS-VARIABLE: OPENGL_REQUIRED
88# @DESCRIPTION:
89# Is qt-opengl required? Possible values are 'always', 'optional' and 'never'.
90# This variable must be set before inheriting any eclasses. Defaults to 'never'.
91OPENGL_REQUIRED="${OPENGL_REQUIRED:-never}"
57 92
58# @ECLASS-VARIABLE: CPPUNIT_REQUIRED 93# @ECLASS-VARIABLE: CPPUNIT_REQUIRED
59# @DESCRIPTION: 94# @DESCRIPTION:
60# Is cppunit required for tests? Possible values are 'always', 'optional' and 'never'. 95# Is cppunit required for tests? Possible values are 'always', 'optional' and 'never'.
61# This variable must be set before inheriting any eclasses. Defaults to 'never'. 96# This variable must be set before inheriting any eclasses. Defaults to 'never'.
118 else 153 else
119 _kdedir="4.0" 154 _kdedir="4.0"
120 _pv=":kde-4" 155 _pv=":kde-4"
121 fi 156 fi
122 ;; 157 ;;
123 svn|9999*|:kde-svn) 158 scm|svn|9999*|:kde-svn)
124 _kdedir="svn" 159 _kdedir="svn"
125 _pv=":kde-svn" 160 _pv=":kde-svn"
126 export NEED_KDE="svn" 161 export NEED_KDE="svn"
127 ;; 162 ;;
128 *:kde-svn) 163 *:kde-svn)
249# errors and die if any required flags listed in $QT4_BUILT_WITH_USE_CHECK or 284# errors and die if any required flags listed in $QT4_BUILT_WITH_USE_CHECK or
250# $KDE4_BUILT_WITH_USE_CHECK are missing. 285# $KDE4_BUILT_WITH_USE_CHECK are missing.
251kde4-base_pkg_setup() { 286kde4-base_pkg_setup() {
252 debug-print-function $FUNCNAME "$@" 287 debug-print-function $FUNCNAME "$@"
253 288
289 case "${EAPI}" in
290 kdebuild-1)
291 [[ -n ${QT4_BUILT_WITH_USE_CHECK} || -n ${KDE4_BUILT_WITH_USE_CHECK[@]} ]] && \
292 die "built_with_use illegal in this EAPI!"
293 ;;
294 *)
295 # Make KDE4_BUILT_WITH_USE_CHECK an array if it isn't already
296 local line kde4_built_with_use_check=()
297 if [[ -n ${KDE4_BUILT_WITH_USE_CHECK[@]} && $(declare -p KDE4_BUILT_WITH_USE_CHECK) != 'declare -a '* ]]; then
298 while read line; do
299 [[ -z ${line} ]] && continue
300 kde4_built_with_use_check+=("${line}")
301 done <<< "${KDE4_BUILT_WITH_USE_CHECK}"
302 KDE4_BUILT_WITH_USE_CHECK=("${kde4_built_with_use_check[@]}")
303 fi
304
254 # KDE4 applications require qt4 compiled with USE="accessibility dbus gif jpeg png qt3support ssl zlib". 305 # KDE4 applications require qt4 compiled with USE="accessibility dbus gif jpeg png qt3support ssl zlib".
255 if has_version '<x11-libs/qt-4.4_alpha:4'; then 306 if has_version '<x11-libs/qt-4.4_alpha:4'; then
256 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} accessibility dbus gif jpeg png qt3support ssl zlib" 307 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} accessibility dbus gif jpeg png qt3support ssl zlib"
257 else
258 KDE4_BUILT_WITH_USE_CHECK="${KDE4_BUILT_WITH_USE_CHECK}
259 x11-libs/qt-core qt3support ssl
260 x11-libs/qt-gui accessibility dbus
261 x11-libs/qt-qt3support accessibility"
262 fi
263
264 if has debug ${IUSE//+} && use debug; then
265 if has_version '<x11-libs/qt-4.4.0_alpha:4'; then
266 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} debug"
267 else 308 else
268 KDE4_BUILT_WITH_USE_CHECK="${KDE4_BUILT_WITH_USE_CHECK} 309 KDE4_BUILT_WITH_USE_CHECK=("${KDE4_BUILT_WITH_USE_CHECK[@]}"
269 x11-libs/qt-core:4 debug 310 "x11-libs/qt-core qt3support ssl"
270 x11-libs/qt-gui:4 debug 311 "x11-libs/qt-gui accessibility dbus"
271 x11-libs/qt-qt3support:4 debug 312 "x11-libs/qt-qt3support accessibility")
272 x11-libs/qt-svg:4 debug 313 fi
273 x11-libs/qt-test:4 debug" 314
274 if has opengl ${IUSE//+} && use opengl || [[ ${OPENGL_REQUIRED} == always ]]; then 315 if has opengl ${IUSE//+} && use opengl || [[ ${OPENGL_REQUIRED} == always ]]; then
316 if has_version '<x11-libs/qt-4.4.0_alpha:4'; then
275 KDE4_BUILT_WITH_USE_CHECK="${KDE4_BUILT_WITH_USE_CHECK} 317 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} opengl"
276 x11-libs/qt-opengl:4 debug"
277 fi 318 fi
278 fi 319 fi
279 fi
280
281 if has opengl ${IUSE//+} && use opengl || [[ ${OPENGL_REQUIRED} == always ]]; then
282 if has_version '<x11-libs/qt-4.4.0_alpha:4'; then
283 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} opengl"
284 fi
285 fi
286
287 kde4-functions_check_use 320 kde4-functions_check_use
321 ;;
322 esac
288} 323}
289 324
290# @FUNCTION: kde4-base_apply_patches 325# @FUNCTION: kde4-base_apply_patches
291# @DESCRIPTION: 326# @DESCRIPTION:
292# This function applies patches. 327# This function applies patches.
304# Apply ${PN}-${SLOT}-*{diff,patch} 339# Apply ${PN}-${SLOT}-*{diff,patch}
305# - $CATEGORY!=kde-base: 340# - $CATEGORY!=kde-base:
306# Apply ${PN}-${PV}-*{diff,patch} 341# Apply ${PN}-${PV}-*{diff,patch}
307# @CODE 342# @CODE
308# 343#
309# If ${PATCHES} is non-zero all patches in it gets applied. 344# If ${PATCHES} is non-zero all patches in it get applied. If there is more
345# than one patch please make ${PATCHES} an array for proper quoting.
310kde4-base_apply_patches() { 346kde4-base_apply_patches() {
311 local _patchdir _packages _p 347 local _patchdir _packages _p _f
312 _patchdir="${WORKDIR}/patches/" 348 _patchdir="${WORKDIR}/patches/"
313 if [[ -d "${_patchdir}" ]]; then 349 if [[ -d "${_patchdir}" ]]; then
314 if is-parent-package ${CATEGORY}/${PN} ; then 350 if is-parent-package ${CATEGORY}/${PN} ; then
315 _packages="$(get-child-packages ${CATEGORY}/${PN})" 351 _packages="$(get-child-packages ${CATEGORY}/${PN})"
316 _packages="${_packages//${CATEGORY}\//} ${PN}" 352 _packages="${_packages//${CATEGORY}\//} ${PN}"
317 else 353 else
318 _packages="${PN}" 354 _packages="${PN}"
319 fi 355 fi
356 if [[ $(declare -p PATCHES) != 'declare -a '* ]]; then
357 PATCHES=(${PATCHES})
358 fi
320 for _p in ${_packages}; do 359 for _p in ${_packages}; do
321 PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${PV}-*{diff,patch} 2>/dev/null)" 360 for _f in "${_patchdir}"/${_p}-${PV}-*{diff,patch}; do
361 [[ -e ${_f} ]] && PATCHES+=("${_f}")
362 done
322 if [[ -n "${KDEBASE}" ]]; then 363 if [[ -n "${KDEBASE}" ]]; then
323 PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${SLOT}-*{diff,patch} 2>/dev/null)" 364 for _f in "${_patchdir}"/${_p}-${SLOT}-*{diff,patch}; do
365 [[ -e ${_f} ]] && PATCHES+=("${_f}")
366 done
324 fi 367 fi
325 done 368 done
326 fi 369 fi
327 [[ -n ${PATCHES} ]] && base_src_unpack autopatch 370 [[ -n ${PATCHES[@]} ]] && base_src_unpack autopatch
328} 371}
329 372
330# @FUNCTION: kde4-base_src_unpack 373# @FUNCTION: kde4-base_src_unpack
331# @DESCRIPTION: 374# @DESCRIPTION:
332# This function unpacks the source tarballs for KDE4 applications. 375# This function unpacks the source tarballs for KDE4 applications.
334# If no argument is passed to this function, then standard src_unpack is 377# If no argument is passed to this function, then standard src_unpack is
335# executed. Otherwise options are passed to base_src_unpack. 378# executed. Otherwise options are passed to base_src_unpack.
336# 379#
337# In addition it calls kde4-base_apply_patches when no arguments are passed to 380# In addition it calls kde4-base_apply_patches when no arguments are passed to
338# this function. 381# this function.
382#
383# It also handles translations if KDE_LINGUAS is defined. See KDE_LINGUAS and
384# enable_selected_linguas() in kde4-functions.eclass(5) for further details.
339kde4-base_src_unpack() { 385kde4-base_src_unpack() {
340 debug-print-function $FUNCNAME "$@" 386 debug-print-function $FUNCNAME "$@"
341 387
342 [[ -z "${KDE_S}" ]] && KDE_S="${S}" 388 [[ -z "${KDE_S}" ]] && KDE_S="${S}"
343 389
356 # Updated cmake dir 402 # Updated cmake dir
357 if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then 403 if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then
358 ebegin "Updating cmake/ directory..." 404 ebegin "Updating cmake/ directory..."
359 rm -rf "${KDE_S}/cmake" || die "Unable to remove old cmake/ directory" 405 rm -rf "${KDE_S}/cmake" || die "Unable to remove old cmake/ directory"
360 ln -s "${WORKDIR}/cmake" "${KDE_S}/cmake" || die "Unable to symlink the new cmake/ directory" 406 ln -s "${WORKDIR}/cmake" "${KDE_S}/cmake" || die "Unable to symlink the new cmake/ directory"
361 eend 0 407 eend 0
408 fi
409
410 # Only enable selected languages, used for KDE extragear apps.
411 if [[ -n ${KDE_LINGUAS} ]]; then
412 enable_selected_linguas
362 fi 413 fi
363} 414}
364 415
365# @FUNCTION: kde4-base_src_compile 416# @FUNCTION: kde4-base_src_compile
366# @DESCRIPTION: 417# @DESCRIPTION:

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

  ViewVC Help
Powered by ViewVC 1.1.20