/[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.3 Revision 1.10
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.3 2008/02/18 17:00:32 ingmar Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-base.eclass,v 1.10 2008/04/14 13:23:14 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)
204# 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
205# $KDE4_BUILT_WITH_USE_CHECK are missing. 287# $KDE4_BUILT_WITH_USE_CHECK are missing.
206kde4-base_pkg_setup() { 288kde4-base_pkg_setup() {
207 debug-print-function $FUNCNAME "$@" 289 debug-print-function $FUNCNAME "$@"
208 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 *)
209 # KDE4 applications require qt4 compiled with USE="accessibility dbus gif 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
210 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} accessibility dbus gif 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
211 306
212 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
213 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
214 fi 322 fi
215 323
216 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
217 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
218 fi 328 fi
219
220 kde4-functions_check_use 329 kde4-functions_check_use
330 ;;
331 esac
221} 332}
222 333
223# @FUNCTION: kde4-base_src_unpack 334# @FUNCTION: kde4-base_apply_patches
224# @DESCRIPTION: 335# @DESCRIPTION:
225# This function unpacks the source tarballs for KDE4 applications. 336# This function applies patches.
226#
227# If no argument is passed to this function, then standard src_unpack is
228# executed. Otherwise options are passed to base_src_unpack.
229# 337#
230# 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
231# directory, provided they follow this format: 339# directory, provided they follow this format:
232# @CODE 340# @CODE
233# - Monolithic ebuilds, (from kde-base) 341# - Monolithic ebuilds, (from kde-base)
240# Apply ${PN}-${SLOT}-*{diff,patch} 348# Apply ${PN}-${SLOT}-*{diff,patch}
241# - $CATEGORY!=kde-base: 349# - $CATEGORY!=kde-base:
242# Apply ${PN}-${PV}-*{diff,patch} 350# Apply ${PN}-${PV}-*{diff,patch}
243# @CODE 351# @CODE
244# 352#
245# 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 _f
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 [[ $(declare -p PATCHES) != 'declare -a '* ]]; then
366 PATCHES=(${PATCHES})
367 fi
368 for _p in ${_packages}; do
369 for _f in "${_patchdir}"/${_p}-${PV}-*{diff,patch}; do
370 [[ -e ${_f} ]] && PATCHES+=("${_f}")
371 done
372 if [[ -n "${KDEBASE}" ]]; then
373 for _f in "${_patchdir}"/${_p}-${SLOT}-*{diff,patch}; do
374 [[ -e ${_f} ]] && PATCHES+=("${_f}")
375 done
376 fi
377 done
378 fi
379 [[ -n ${PATCHES[@]} ]] && base_src_unpack autopatch
380}
381
382# @FUNCTION: kde4-base_src_unpack
383# @DESCRIPTION:
384# This function unpacks the source tarballs for KDE4 applications.
385#
386# If no argument is passed to this function, then standard src_unpack is
387# executed. Otherwise options are passed to base_src_unpack.
388#
389# In addition it calls kde4-base_apply_patches when no arguments are passed to
390# this function.
391#
392# It also handles translations if KDE_LINGUAS is defined. See KDE_LINGUAS and
393# enable_selected_linguas() in kde4-functions.eclass(5) for further details.
246kde4-base_src_unpack() { 394kde4-base_src_unpack() {
247 debug-print-function $FUNCNAME "$@" 395 debug-print-function $FUNCNAME "$@"
248 396
249 [[ -z "${KDE_S}" ]] && KDE_S="${S}" 397 [[ -z "${KDE_S}" ]] && KDE_S="${S}"
250 398
251 local _patchdir _packages _p
252 _patchdir="${WORKDIR}/patches/"
253 if [[ -z $* ]]; then 399 if [[ -z $* ]]; then
254 # Unpack first and deal with KDE patches after examing possible patch sets. 400 # Unpack first and deal with KDE patches after examing possible patch sets.
255 # To be picked up, patches need to conform to the guidelines stated before. 401 # To be picked up, patches need to conform to the guidelines stated before.
256 # Monolithic ebuilds will use the split ebuild patches. 402 # Monolithic ebuilds will use the split ebuild patches.
257 [[ -d "${KDE_S}" ]] || unpack ${A} 403 [[ -d "${KDE_S}" ]] || unpack ${A}
258 if [[ -d "${_patchdir}" ]]; then 404 kde4-base_apply_patches
259 if is-parent-package ${CATEGORY}/${PN} ; then
260 _packages="$(get-child-packages ${CATEGORY}/${PN})"
261 _packages="${_packages//${CATEGORY}\//} ${PN}"
262 else
263 _packages="${PN}"
264 fi
265 for _p in ${_packages}; do
266 PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${PV}-*{diff,patch} 2>/dev/null)"
267 if [[ -n "${KDEBASE}" ]]; then
268 PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${SLOT}-*{diff,patch} 2>/dev/null)"
269 fi
270 done
271 fi
272 [[ -n ${PATCHES} ]] && base_src_unpack autopatch
273 else 405 else
274 # Call base_src_unpack, which unpacks and patches 406 # Call base_src_unpack, which unpacks and patches
275 # step by step transparently as defined in the ebuild. 407 # step by step transparently as defined in the ebuild.
276 base_src_unpack $* 408 base_src_unpack $*
277 fi 409 fi
279 # Updated cmake dir 411 # Updated cmake dir
280 if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then 412 if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then
281 ebegin "Updating cmake/ directory..." 413 ebegin "Updating cmake/ directory..."
282 rm -rf "${KDE_S}/cmake" || die "Unable to remove old cmake/ directory" 414 rm -rf "${KDE_S}/cmake" || die "Unable to remove old cmake/ directory"
283 ln -s "${WORKDIR}/cmake" "${KDE_S}/cmake" || die "Unable to symlink the new cmake/ directory" 415 ln -s "${WORKDIR}/cmake" "${KDE_S}/cmake" || die "Unable to symlink the new cmake/ directory"
284 eend 0 416 eend 0
417 fi
418
419 # Only enable selected languages, used for KDE extragear apps.
420 if [[ -n ${KDE_LINGUAS} ]]; then
421 enable_selected_linguas
285 fi 422 fi
286} 423}
287 424
288# @FUNCTION: kde4-base_src_compile 425# @FUNCTION: kde4-base_src_compile
289# @DESCRIPTION: 426# @DESCRIPTION:
301kde4-base_src_configure() { 438kde4-base_src_configure() {
302 debug-print-function ${FUNCNAME} "$@" 439 debug-print-function ${FUNCNAME} "$@"
303 440
304 # Final flag handling 441 # Final flag handling
305 if has kdeenablefinal ${IUSE//+} && use kdeenablefinal; then 442 if has kdeenablefinal ${IUSE//+} && use kdeenablefinal; then
306 einfo "Activating enable-final flag" 443 echo "Activating enable-final flag"
307 mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_FINAL=ON" 444 mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_FINAL=ON"
308 fi 445 fi
309 446
310 # Enable generation of HTML handbook 447 # Enable generation of HTML handbook
311 if has htmlhandbook ${IUSE//+} && use htmlhandbook; then 448 if has htmlhandbook ${IUSE//+} && use htmlhandbook; then
312 einfo "Enabling building of HTML handbook" 449 echo "Enabling building of HTML handbook"
313 mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_HTMLHANDBOOK=ON" 450 mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_HTMLHANDBOOK=ON"
314 fi 451 fi
315 452
316 # Build tests in src_test only, where we override this value 453 # Build tests in src_test only, where we override this value
317 mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=OFF" 454 mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=OFF"

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.20