/[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.11
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.11 2008/05/15 19:49:32 ingmar 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 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}
46 x11-libs/qt-script:4
47 x11-libs/qt-svg:4
48 x11-libs/qt-test:4"
49 qtopengldepend="x11-libs/qt-opengl:4"
50
51 # allow monolithic qt for PV < 4.1
52 case "${PV}" in
53 scm|9999.4|4.1*) : ;;
54 *)
55 qtdepend="|| ( ( ${qtdepend} ) >=x11-libs/qt-4.3.3:4${qt} )"
56 qtopengldepend="|| ( ${qtopengldepend} >=x11-libs/qt-4.3.3:4 )"
57 ;;
58 esac
59
60 # opengl dependencies
61 case "${OPENGL_REQUIRED}" in
62 always)
63 qtdepend="${qtdepend}
64 ${qtopengldepend}"
65 ;;
66 optional)
67 IUSE="${IUSE} opengl"
68 qtdepend="${qtdepend}
69 opengl? ( ${qtopengldepend} )"
70 ;;
71 *)
72 OPENGL_REQUIRED="never"
73 ;;
74 esac
75
76 COMMONDEPEND="${COMMONDEPEND} ${qtdepend}"
77}
78kde4-base_set_qt_dependencies
79
21DEPEND="${DEPEND} ${COMMONDEPEND} 80DEPEND="${DEPEND} ${COMMONDEPEND}
22 >=dev-util/cmake-2.4.7-r1 81 >=dev-util/cmake-2.4.7-r1
23 dev-util/pkgconfig 82 dev-util/pkgconfig
24 x11-libs/libXt 83 x11-libs/libXt
25 x11-proto/xf86vidmodeproto" 84 x11-proto/xf86vidmodeproto"
26RDEPEND="${RDEPEND} ${COMMONDEPEND}" 85RDEPEND="${RDEPEND} ${COMMONDEPEND}"
27 86
28if has test ${IUSE//+}; then 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}"
92
93# @ECLASS-VARIABLE: CPPUNIT_REQUIRED
94# @DESCRIPTION:
95# Is cppunit required for tests? Possible values are 'always', 'optional' and 'never'.
96# This variable must be set before inheriting any eclasses. Defaults to 'never'.
97CPPUNIT_REQUIRED="${CPPUNIT_REQUIRED:-never}"
98
99case "${CPPUNIT_REQUIRED}" in
100 always)
101 DEPEND="${DEPEND} dev-util/cppunit"
102 ;;
103 optional)
104 IUSE="${IUSE} test"
29 DEPEND="${DEPEND} 105 DEPEND="${DEPEND}
30 test? ( dev-util/cppunit )" 106 test? ( dev-util/cppunit )"
31fi 107 ;;
108 *)
109 CPPUNIT_REQUIRED="never"
110 ;;
111esac
32 112
33# @ECLASS-VARIABLE: NEED_KDE 113# @ECLASS-VARIABLE: NEED_KDE
34# @DESCRIPTION: 114# @DESCRIPTION:
35# This variable sets the version of KDE4 which will be used by the eclass. 115# 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". 116# This variable must be set by the ebuild, for all categories except for "kde-base".
73 else 153 else
74 _kdedir="4.0" 154 _kdedir="4.0"
75 _pv=":kde-4" 155 _pv=":kde-4"
76 fi 156 fi
77 ;; 157 ;;
78 svn|9999*|:kde-svn) 158 scm|svn|9999*|:kde-svn)
79 _kdedir="svn" 159 _kdedir="svn"
80 _pv=":kde-svn" 160 _pv=":kde-svn"
81 export NEED_KDE="svn" 161 export NEED_KDE="svn"
82 ;; 162 ;;
83 *:kde-svn) 163 *:kde-svn)
204# 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
205# $KDE4_BUILT_WITH_USE_CHECK are missing. 285# $KDE4_BUILT_WITH_USE_CHECK are missing.
206kde4-base_pkg_setup() { 286kde4-base_pkg_setup() {
207 debug-print-function $FUNCNAME "$@" 287 debug-print-function $FUNCNAME "$@"
208 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
209 # 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".
306 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" 307 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} accessibility dbus gif jpeg png qt3support ssl zlib"
211 308 else
212 if has debug ${IUSE//+} && use debug; then
213 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} debug" 309 KDE4_BUILT_WITH_USE_CHECK=("${KDE4_BUILT_WITH_USE_CHECK[@]}"
310 "x11-libs/qt-core qt3support ssl"
311 "x11-libs/qt-gui accessibility dbus"
312 "x11-libs/qt-qt3support accessibility")
214 fi 313 fi
215 314
216 if has opengl ${IUSE//+} && use opengl; 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
217 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} opengl" 317 QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} opengl"
318 fi
218 fi 319 fi
219
220 kde4-functions_check_use 320 kde4-functions_check_use
321 ;;
322 esac
221} 323}
222 324
223# @FUNCTION: kde4-base_src_unpack 325# @FUNCTION: kde4-base_apply_patches
224# @DESCRIPTION: 326# @DESCRIPTION:
225# This function unpacks the source tarballs for KDE4 applications. 327# 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# 328#
230# If the directory ${WORKDIR}/patches/ exists, we apply all patches in that 329# If the directory ${WORKDIR}/patches/ exists, we apply all patches in that
231# directory, provided they follow this format: 330# directory, provided they follow this format:
232# @CODE 331# @CODE
233# - Monolithic ebuilds, (from kde-base) 332# - Monolithic ebuilds, (from kde-base)
240# Apply ${PN}-${SLOT}-*{diff,patch} 339# Apply ${PN}-${SLOT}-*{diff,patch}
241# - $CATEGORY!=kde-base: 340# - $CATEGORY!=kde-base:
242# Apply ${PN}-${PV}-*{diff,patch} 341# Apply ${PN}-${PV}-*{diff,patch}
243# @CODE 342# @CODE
244# 343#
245# 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.
346kde4-base_apply_patches() {
347 local _patchdir _packages _p _f
348 _patchdir="${WORKDIR}/patches/"
349 if [[ -d "${_patchdir}" ]]; then
350 if is-parent-package ${CATEGORY}/${PN} ; then
351 _packages="$(get-child-packages ${CATEGORY}/${PN})"
352 _packages="${_packages//${CATEGORY}\//} ${PN}"
353 else
354 _packages="${PN}"
355 fi
356 if [[ $(declare -p PATCHES) != 'declare -a '* ]]; then
357 PATCHES=(${PATCHES})
358 fi
359 for _p in ${_packages}; do
360 for _f in "${_patchdir}"/${_p}-${PV}-*{diff,patch}; do
361 [[ -e ${_f} ]] && PATCHES+=("${_f}")
362 done
363 if [[ -n "${KDEBASE}" ]]; then
364 for _f in "${_patchdir}"/${_p}-${SLOT}-*{diff,patch}; do
365 [[ -e ${_f} ]] && PATCHES+=("${_f}")
366 done
367 fi
368 done
369 fi
370 [[ -n ${PATCHES[@]} ]] && base_src_unpack autopatch
371}
372
373# @FUNCTION: kde4-base_src_unpack
374# @DESCRIPTION:
375# This function unpacks the source tarballs for KDE4 applications.
376#
377# If no argument is passed to this function, then standard src_unpack is
378# executed. Otherwise options are passed to base_src_unpack.
379#
380# In addition it calls kde4-base_apply_patches when no arguments are passed to
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.
246kde4-base_src_unpack() { 385kde4-base_src_unpack() {
247 debug-print-function $FUNCNAME "$@" 386 debug-print-function $FUNCNAME "$@"
248 387
249 [[ -z "${KDE_S}" ]] && KDE_S="${S}" 388 [[ -z "${KDE_S}" ]] && KDE_S="${S}"
250 389
251 local _patchdir _packages _p
252 _patchdir="${WORKDIR}/patches/"
253 if [[ -z $* ]]; then 390 if [[ -z $* ]]; then
254 # Unpack first and deal with KDE patches after examing possible patch sets. 391 # 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. 392 # To be picked up, patches need to conform to the guidelines stated before.
256 # Monolithic ebuilds will use the split ebuild patches. 393 # Monolithic ebuilds will use the split ebuild patches.
257 [[ -d "${KDE_S}" ]] || unpack ${A} 394 [[ -d "${KDE_S}" ]] || unpack ${A}
258 if [[ -d "${_patchdir}" ]]; then 395 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 396 else
274 # Call base_src_unpack, which unpacks and patches 397 # Call base_src_unpack, which unpacks and patches
275 # step by step transparently as defined in the ebuild. 398 # step by step transparently as defined in the ebuild.
276 base_src_unpack $* 399 base_src_unpack $*
277 fi 400 fi
279 # Updated cmake dir 402 # Updated cmake dir
280 if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then 403 if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then
281 ebegin "Updating cmake/ directory..." 404 ebegin "Updating cmake/ directory..."
282 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"
283 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"
284 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
285 fi 413 fi
286} 414}
287 415
288# @FUNCTION: kde4-base_src_compile 416# @FUNCTION: kde4-base_src_compile
289# @DESCRIPTION: 417# @DESCRIPTION:
301kde4-base_src_configure() { 429kde4-base_src_configure() {
302 debug-print-function ${FUNCNAME} "$@" 430 debug-print-function ${FUNCNAME} "$@"
303 431
304 # Final flag handling 432 # Final flag handling
305 if has kdeenablefinal ${IUSE//+} && use kdeenablefinal; then 433 if has kdeenablefinal ${IUSE//+} && use kdeenablefinal; then
306 einfo "Activating enable-final flag" 434 echo "Activating enable-final flag"
307 mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_FINAL=ON" 435 mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_FINAL=ON"
308 fi 436 fi
309 437
310 # Enable generation of HTML handbook 438 # Enable generation of HTML handbook
311 if has htmlhandbook ${IUSE//+} && use htmlhandbook; then 439 if has htmlhandbook ${IUSE//+} && use htmlhandbook; then
312 einfo "Enabling building of HTML handbook" 440 echo "Enabling building of HTML handbook"
313 mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_HTMLHANDBOOK=ON" 441 mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_HTMLHANDBOOK=ON"
314 fi 442 fi
315 443
316 # Build tests in src_test only, where we override this value 444 # Build tests in src_test only, where we override this value
317 mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=OFF" 445 mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=OFF"

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

  ViewVC Help
Powered by ViewVC 1.1.20