/[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.1 Revision 1.9
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.1 2008/01/16 22:50:46 ingmar Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-base.eclass,v 1.9 2008/04/06 21:36:53 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=">=x11-libs/qt-4.3.3:4" 20kde4-base_set_qt_dependencies() {
21 local qt qtcore qtgui qt3support qtsvg qttest qtopengl qtdepend qtopengldepend
22
23 # use dependencies
24 case "${EAPI}" in
25 kdebuild-1)
26 qt="[accessibility][dbus][debug?][gif][jpeg][png][qt3support][ssl][zlib]"
27 qtcore="[debug?][qt3support][ssl]"
28 qtgui="[accessibility][dbus][debug?]"
29 qt3support="[accessibility][debug?]"
30 qtsvg="[debug?]"
31 qttest="[debug?]"
32 qtopengl="[debug?]"
33 case "${OPENGL_REQUIRED}" in
34 always)
35 qt="${qt}[opengl]"
36 ;;
37 optional)
38 qt="${qt}[opengl?]"
39 ;;
40 esac
41 ;;
42 esac
43
44 # split qt
45 qtdepend="
46 x11-libs/qt-core:4${qtcore}
47 x11-libs/qt-gui:4${qtgui}
48 x11-libs/qt-qt3support:4${qt3support}
49 x11-libs/qt-svg:4${qtsvg}
50 x11-libs/qt-test:4${qttest}"
51 qtopengldepend="x11-libs/qt-opengl:4${qtopengl}"
52
53 # allow monolithic qt for PV < 4.1
54 case "${PV}" in
55 scm|9999.4|4.1*) : ;;
56 *)
57 qtdepend="|| ( ( ${qtdepend} ) >=x11-libs/qt-4.3.3:4${qt} )"
58 qtopengldepend="|| ( ${qtopengldepend} >=x11-libs/qt-4.3.3:4 )"
59 ;;
60 esac
61
62 # opengl dependencies
63 case "${OPENGL_REQUIRED}" in
64 always)
65 qtdepend="${qtdepend}
66 ${qtopengldepend}"
67 ;;
68 optional)
69 IUSE="${IUSE} opengl"
70 qtdepend="${qtdepend}
71 opengl? ( ${qtopengldepend} )"
72 ;;
73 *)
74 OPENGL_REQUIRED="never"
75 ;;
76 esac
77
78 COMMONDEPEND="${COMMONDEPEND} ${qtdepend}"
79}
80kde4-base_set_qt_dependencies
81
21DEPEND="${DEPEND} ${COMMONDEPEND} 82DEPEND="${DEPEND} ${COMMONDEPEND}
22 >=dev-util/cmake-2.4.7-r1 83 >=dev-util/cmake-2.4.7-r1
23 dev-util/pkgconfig 84 dev-util/pkgconfig
24 x11-libs/libXt 85 x11-libs/libXt
25 x11-proto/xf86vidmodeproto" 86 x11-proto/xf86vidmodeproto"
26RDEPEND="${RDEPEND} ${COMMONDEPEND}" 87RDEPEND="${RDEPEND} ${COMMONDEPEND}"
27 88
28if has test ${IUSE//+}; then 89# @ECLASS-VARIABLE: OPENGL_REQUIRED
90# @DESCRIPTION:
91# Is qt-opengl required? Possible values are 'always', 'optional' and 'never'.
92# This variable must be set before inheriting any eclasses. Defaults to 'never'.
93OPENGL_REQUIRED="${OPENGL_REQUIRED:-never}"
94
95# @ECLASS-VARIABLE: CPPUNIT_REQUIRED
96# @DESCRIPTION:
97# Is cppunit required for tests? Possible values are 'always', 'optional' and 'never'.
98# This variable must be set before inheriting any eclasses. Defaults to 'never'.
99CPPUNIT_REQUIRED="${CPPUNIT_REQUIRED:-never}"
100
101case "${CPPUNIT_REQUIRED}" in
102 always)
103 DEPEND="${DEPEND} dev-util/cppunit"
104 ;;
105 optional)
106 IUSE="${IUSE} test"
29 DEPEND="${DEPEND} 107 DEPEND="${DEPEND}
30 test? ( dev-util/cppunit )" 108 test? ( dev-util/cppunit )"
31fi 109 ;;
110 *)
111 CPPUNIT_REQUIRED="never"
112 ;;
113esac
32 114
33# @ECLASS-VARIABLE: NEED_KDE 115# @ECLASS-VARIABLE: NEED_KDE
34# @DESCRIPTION: 116# @DESCRIPTION:
35# This variable sets the version of KDE4 which will be used by the eclass. 117# This variable sets the version of KDE4 which will be used by the eclass.
36# This variable must be set by the ebuild, for all categories except for "kde-base". 118# This variable must be set by the ebuild, for all categories except for "kde-base".
73 else 155 else
74 _kdedir="4.0" 156 _kdedir="4.0"
75 _pv=":kde-4" 157 _pv=":kde-4"
76 fi 158 fi
77 ;; 159 ;;
78 svn|9999*|:kde-svn) 160 scm|svn|9999*|:kde-svn)
79 _kdedir="svn" 161 _kdedir="svn"
80 _pv=":kde-svn" 162 _pv=":kde-svn"
81 export NEED_KDE="svn" 163 export NEED_KDE="svn"
82 ;; 164 ;;
83 *:kde-svn) 165 *:kde-svn)
86 _pv="-${NEED_KDE}" 168 _pv="-${NEED_KDE}"
87 export NEED_KDE="svn" 169 export NEED_KDE="svn"
88 ;; 170 ;;
89 # The ebuild handles dependencies, KDEDIR, SLOT. 171 # The ebuild handles dependencies, KDEDIR, SLOT.
90 none) 172 none)
91 # This shouldn't be used for kde-base ebuilds. 173 :
92 if [[ -n ${KDEBASE} ]]; then
93 die 'Ebuilds part of kde-base ebuilds should not use NEED_KDE="none".'
94 fi
95 ;; 174 ;;
96 # NEED_KDE=":${SLOT}" 175 # NEED_KDE=":${SLOT}"
97 :kde-4) 176 :kde-4)
98 _kdedir="4.0" 177 _kdedir="4.0"
99 _pv="${NEED_KDE}" 178 _pv="${NEED_KDE}"
207# errors and die if any required flags listed in $QT4_BUILT_WITH_USE_CHECK or 286# errors and die if any required flags listed in $QT4_BUILT_WITH_USE_CHECK or
208# $KDE4_BUILT_WITH_USE_CHECK are missing. 287# $KDE4_BUILT_WITH_USE_CHECK are missing.
209kde4-base_pkg_setup() { 288kde4-base_pkg_setup() {
210 debug-print-function $FUNCNAME "$@" 289 debug-print-function $FUNCNAME "$@"
211 290
291 case "${EAPI}" in
292 kdebuild-1)
293 [[ -n ${QT4_BUILT_WITH_USE_CHECK} || -n ${KDE4_BUILT_WITH_USE_CHECK} ]] && \
294 die "built_with_use illegal in this EAPI!"
295 ;;
296 *)
212 # KDE4 applications require qt4 compiled with USE="accessibility dbus jpeg png qt3support ssl zlib". 297 # KDE4 applications require qt4 compiled with USE="accessibility dbus gif jpeg png qt3support ssl zlib".
298 if has_version '<x11-libs/qt-4.4_alpha:4'; then
213 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} accessibility dbus jpeg png qt3support ssl zlib" 299 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} accessibility dbus gif jpeg png qt3support ssl zlib"
300 else
301 KDE4_BUILT_WITH_USE_CHECK="${KDE4_BUILT_WITH_USE_CHECK}
302 x11-libs/qt-core qt3support ssl
303 x11-libs/qt-gui accessibility dbus
304 x11-libs/qt-qt3support accessibility"
305 fi
214 306
215 if has debug ${IUSE//+} && use debug; then 307 if has debug ${IUSE//+} && use debug; then
308 if has_version '<x11-libs/qt-4.4.0_alpha:4'; then
216 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} debug" 309 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} debug"
310 else
311 KDE4_BUILT_WITH_USE_CHECK="${KDE4_BUILT_WITH_USE_CHECK}
312 x11-libs/qt-core:4 debug
313 x11-libs/qt-gui:4 debug
314 x11-libs/qt-qt3support:4 debug
315 x11-libs/qt-svg:4 debug
316 x11-libs/qt-test:4 debug"
317 if has opengl ${IUSE//+} && use opengl || [[ ${OPENGL_REQUIRED} == always ]]; then
318 KDE4_BUILT_WITH_USE_CHECK="${KDE4_BUILT_WITH_USE_CHECK}
319 x11-libs/qt-opengl:4 debug"
320 fi
321 fi
217 fi 322 fi
218 323
219 if has opengl ${IUSE//+} && use opengl; then 324 if has opengl ${IUSE//+} && use opengl || [[ ${OPENGL_REQUIRED} == always ]]; then
325 if has_version '<x11-libs/qt-4.4.0_alpha:4'; then
220 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} opengl" 326 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} opengl"
327 fi
221 fi 328 fi
222
223 kde4-functions_check_use 329 kde4-functions_check_use
330 ;;
331 esac
224} 332}
225 333
226# @FUNCTION: kde4-base_src_unpack 334# @FUNCTION: kde4-base_apply_patches
227# @DESCRIPTION: 335# @DESCRIPTION:
228# This function unpacks the source tarballs for KDE4 applications. 336# This function applies patches.
229#
230# If no argument is passed to this function, then standard src_unpack is
231# executed. Otherwise options are passed to base_src_unpack.
232# 337#
233# If the directory ${WORKDIR}/patches/ exists, we apply all patches in that 338# If the directory ${WORKDIR}/patches/ exists, we apply all patches in that
234# directory, provided they follow this format: 339# directory, provided they follow this format:
235# @CODE 340# @CODE
236# - Monolithic ebuilds, (from kde-base) 341# - Monolithic ebuilds, (from kde-base)
243# Apply ${PN}-${SLOT}-*{diff,patch} 348# Apply ${PN}-${SLOT}-*{diff,patch}
244# - $CATEGORY!=kde-base: 349# - $CATEGORY!=kde-base:
245# Apply ${PN}-${PV}-*{diff,patch} 350# Apply ${PN}-${PV}-*{diff,patch}
246# @CODE 351# @CODE
247# 352#
248# If ${PATCHES} is non-zero all patches in it gets applied. 353# If ${PATCHES} is non-zero all patches in it get applied. If there is more
354# than one patch please make ${PATCHES} an array for proper quoting.
355kde4-base_apply_patches() {
356 local _patchdir _packages _p
357 _patchdir="${WORKDIR}/patches/"
358 if [[ -d "${_patchdir}" ]]; then
359 if is-parent-package ${CATEGORY}/${PN} ; then
360 _packages="$(get-child-packages ${CATEGORY}/${PN})"
361 _packages="${_packages//${CATEGORY}\//} ${PN}"
362 else
363 _packages="${PN}"
364 fi
365 if [[ ${#PATCHES[@]} -gt 1 ]]; then
366 for _p in ${_packages}; do
367 PATCHES=( "${PATCHES[@]}" $(ls ${_patchdir}/${_p}-${PV}-*{diff,patch} 2>/dev/null) )
368 if [[ -n "${KDEBASE}" ]]; then
369 PATCHES=( "${PATCHES[@]}" $(ls ${_patchdir}/${_p}-${SLOT}-*{diff,patch} 2>/dev/null) )
370 fi
371 done
372 else
373 for _p in ${_packages}; do
374 PATCHES=(${PATCHES} $(ls ${_patchdir}/${_p}-${PV}-*{diff,patch} 2>/dev/null))
375 if [[ -n "${KDEBASE}" ]]; then
376 PATCHES=(${PATCHES} $(ls ${_patchdir}/${_p}-${SLOT}-*{diff,patch} 2>/dev/null))
377 fi
378 done
379 fi
380 fi
381 [[ -n ${PATCHES[@]} ]] && base_src_unpack autopatch
382}
383
384# @FUNCTION: kde4-base_src_unpack
385# @DESCRIPTION:
386# This function unpacks the source tarballs for KDE4 applications.
387#
388# If no argument is passed to this function, then standard src_unpack is
389# executed. Otherwise options are passed to base_src_unpack.
390#
391# In addition it calls kde4-base_apply_patches when no arguments are passed to
392# this function.
393#
394# It also handles translations if KDE_LINGUAS is defined. See KDE_LINGUAS and
395# enable_selected_linguas() in kde4-functions.eclass(5) for further details.
249kde4-base_src_unpack() { 396kde4-base_src_unpack() {
250 debug-print-function $FUNCNAME "$@" 397 debug-print-function $FUNCNAME "$@"
251 398
252 [[ -z "${KDE_S}" ]] && KDE_S="${S}" 399 [[ -z "${KDE_S}" ]] && KDE_S="${S}"
253 400
254 local _patchdir _packages _p
255 _patchdir="${WORKDIR}/patches/"
256 if [[ -z $* ]]; then 401 if [[ -z $* ]]; then
257 # Unpack first and deal with KDE patches after examing possible patch sets. 402 # Unpack first and deal with KDE patches after examing possible patch sets.
258 # To be picked up, patches need to conform to the guidelines stated before. 403 # To be picked up, patches need to conform to the guidelines stated before.
259 # Monolithic ebuilds will use the split ebuild patches. 404 # Monolithic ebuilds will use the split ebuild patches.
260 [[ -d "${KDE_S}" ]] || unpack ${A} 405 [[ -d "${KDE_S}" ]] || unpack ${A}
261 if [[ -d "${_patchdir}" ]]; then 406 kde4-base_apply_patches
262 if is-parent-package ${CATEGORY}/${PN} ; then
263 _packages="$(get-child-packages ${CATEGORY}/${PN})"
264 _packages="${_packages//${CATEGORY}\//} ${PN}"
265 else
266 _packages="${PN}"
267 fi
268 for _p in ${_packages}; do
269 PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${PV}-*{diff,patch} 2>/dev/null)"
270 if [[ -n "${KDEBASE}" ]]; then
271 PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${SLOT}-*{diff,patch} 2>/dev/null)"
272 fi
273 done
274 fi
275 [[ -n ${PATCHES} ]] && base_src_unpack autopatch
276 else 407 else
277 # Call base_src_unpack, which unpacks and patches 408 # Call base_src_unpack, which unpacks and patches
278 # step by step transparently as defined in the ebuild. 409 # step by step transparently as defined in the ebuild.
279 base_src_unpack $* 410 base_src_unpack $*
280 fi 411 fi
282 # Updated cmake dir 413 # Updated cmake dir
283 if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then 414 if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then
284 ebegin "Updating cmake/ directory..." 415 ebegin "Updating cmake/ directory..."
285 rm -rf "${KDE_S}/cmake" || die "Unable to remove old cmake/ directory" 416 rm -rf "${KDE_S}/cmake" || die "Unable to remove old cmake/ directory"
286 ln -s "${WORKDIR}/cmake" "${KDE_S}/cmake" || die "Unable to symlink the new cmake/ directory" 417 ln -s "${WORKDIR}/cmake" "${KDE_S}/cmake" || die "Unable to symlink the new cmake/ directory"
287 eend 0 418 eend 0
419 fi
420
421 # Only enable selected languages, used for KDE extragear apps.
422 if [[ -n ${KDE_LINGUAS} ]]; then
423 enable_selected_linguas
288 fi 424 fi
289} 425}
290 426
291# @FUNCTION: kde4-base_src_compile 427# @FUNCTION: kde4-base_src_compile
292# @DESCRIPTION: 428# @DESCRIPTION:
304kde4-base_src_configure() { 440kde4-base_src_configure() {
305 debug-print-function ${FUNCNAME} "$@" 441 debug-print-function ${FUNCNAME} "$@"
306 442
307 # Final flag handling 443 # Final flag handling
308 if has kdeenablefinal ${IUSE//+} && use kdeenablefinal; then 444 if has kdeenablefinal ${IUSE//+} && use kdeenablefinal; then
309 einfo "Activating enable-final flag" 445 echo "Activating enable-final flag"
310 mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_FINAL=ON" 446 mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_FINAL=ON"
311 fi 447 fi
312 448
313 # Enable generation of HTML handbook 449 # Enable generation of HTML handbook
314 if has htmlhandbook ${IUSE//+} && use htmlhandbook; then 450 if has htmlhandbook ${IUSE//+} && use htmlhandbook; then
315 einfo "Enabling building of HTML handbook" 451 echo "Enabling building of HTML handbook"
316 mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_HTMLHANDBOOK=ON" 452 mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_HTMLHANDBOOK=ON"
317 fi 453 fi
318 454
319 # Build tests in src_test only, where we override this value 455 # Build tests in src_test only, where we override this value
320 mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=OFF" 456 mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=OFF"

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.20