| 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.8 2008/04/04 22:15:24 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 | |
| 16 | inherit base eutils multilib cmake-utils kde4-functions |
16 | inherit base eutils multilib cmake-utils kde4-functions |
| 17 | |
17 | |
| 18 | EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_postinst pkg_postrm |
18 | EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_postinst pkg_postrm |
| 19 | |
19 | |
| 20 | COMMONDEPEND=">=x11-libs/qt-4.3.3:4" |
20 | kde4-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 | } |
|
|
80 | kde4-base_set_qt_dependencies |
|
|
81 | |
| 21 | DEPEND="${DEPEND} ${COMMONDEPEND} |
82 | DEPEND="${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" |
| 26 | RDEPEND="${RDEPEND} ${COMMONDEPEND}" |
87 | RDEPEND="${RDEPEND} ${COMMONDEPEND}" |
| 27 | |
88 | |
| 28 | if 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'. |
|
|
93 | OPENGL_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'. |
|
|
99 | CPPUNIT_REQUIRED="${CPPUNIT_REQUIRED:-never}" |
|
|
100 | |
|
|
101 | case "${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 )" |
| 31 | fi |
109 | ;; |
|
|
110 | *) |
|
|
111 | CPPUNIT_REQUIRED="never" |
|
|
112 | ;; |
|
|
113 | esac |
| 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. |
| 206 | kde4-base_pkg_setup() { |
288 | kde4-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 |
| 246 | kde4-base_src_unpack() { |
354 | # than one patch please make ${PATCHES} an array for proper quoting. |
| 247 | debug-print-function $FUNCNAME "$@" |
355 | kde4-base_apply_patches() { |
| 248 | |
|
|
| 249 | [[ -z "${KDE_S}" ]] && KDE_S="${S}" |
|
|
| 250 | |
|
|
| 251 | local _patchdir _packages _p |
356 | local _patchdir _packages _p |
| 252 | _patchdir="${WORKDIR}/patches/" |
357 | _patchdir="${WORKDIR}/patches/" |
| 253 | if [[ -z $* ]]; then |
|
|
| 254 | # 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. |
|
|
| 256 | # Monolithic ebuilds will use the split ebuild patches. |
|
|
| 257 | [[ -d "${KDE_S}" ]] || unpack ${A} |
|
|
| 258 | if [[ -d "${_patchdir}" ]]; then |
358 | if [[ -d "${_patchdir}" ]]; then |
| 259 | if is-parent-package ${CATEGORY}/${PN} ; then |
359 | if is-parent-package ${CATEGORY}/${PN} ; then |
| 260 | _packages="$(get-child-packages ${CATEGORY}/${PN})" |
360 | _packages="$(get-child-packages ${CATEGORY}/${PN})" |
| 261 | _packages="${_packages//${CATEGORY}\//} ${PN}" |
361 | _packages="${_packages//${CATEGORY}\//} ${PN}" |
| 262 | else |
362 | else |
| 263 | _packages="${PN}" |
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) ) |
| 264 | fi |
370 | fi |
|
|
371 | done |
|
|
372 | else |
| 265 | for _p in ${_packages}; do |
373 | for _p in ${_packages}; do |
| 266 | PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${PV}-*{diff,patch} 2>/dev/null)" |
374 | PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${PV}-*{diff,patch} 2>/dev/null)" |
| 267 | if [[ -n "${KDEBASE}" ]]; then |
375 | if [[ -n "${KDEBASE}" ]]; then |
| 268 | PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${SLOT}-*{diff,patch} 2>/dev/null)" |
376 | PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${SLOT}-*{diff,patch} 2>/dev/null)" |
| 269 | fi |
377 | fi |
| 270 | done |
378 | done |
| 271 | fi |
379 | fi |
|
|
380 | fi |
| 272 | [[ -n ${PATCHES} ]] && base_src_unpack autopatch |
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. |
|
|
396 | kde4-base_src_unpack() { |
|
|
397 | debug-print-function $FUNCNAME "$@" |
|
|
398 | |
|
|
399 | [[ -z "${KDE_S}" ]] && KDE_S="${S}" |
|
|
400 | |
|
|
401 | if [[ -z $* ]]; then |
|
|
402 | # Unpack first and deal with KDE patches after examing possible patch sets. |
|
|
403 | # To be picked up, patches need to conform to the guidelines stated before. |
|
|
404 | # Monolithic ebuilds will use the split ebuild patches. |
|
|
405 | [[ -d "${KDE_S}" ]] || unpack ${A} |
|
|
406 | kde4-base_apply_patches |
| 273 | else |
407 | else |
| 274 | # Call base_src_unpack, which unpacks and patches |
408 | # Call base_src_unpack, which unpacks and patches |
| 275 | # step by step transparently as defined in the ebuild. |
409 | # step by step transparently as defined in the ebuild. |
| 276 | base_src_unpack $* |
410 | base_src_unpack $* |
| 277 | fi |
411 | fi |
| … | |
… | |
| 279 | # Updated cmake dir |
413 | # Updated cmake dir |
| 280 | if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then |
414 | if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then |
| 281 | ebegin "Updating cmake/ directory..." |
415 | ebegin "Updating cmake/ directory..." |
| 282 | 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" |
| 283 | 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" |
| 284 | 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 |
| 285 | fi |
424 | fi |
| 286 | } |
425 | } |
| 287 | |
426 | |
| 288 | # @FUNCTION: kde4-base_src_compile |
427 | # @FUNCTION: kde4-base_src_compile |
| 289 | # @DESCRIPTION: |
428 | # @DESCRIPTION: |
| … | |
… | |
| 301 | kde4-base_src_configure() { |
440 | kde4-base_src_configure() { |
| 302 | debug-print-function ${FUNCNAME} "$@" |
441 | debug-print-function ${FUNCNAME} "$@" |
| 303 | |
442 | |
| 304 | # Final flag handling |
443 | # Final flag handling |
| 305 | if has kdeenablefinal ${IUSE//+} && use kdeenablefinal; then |
444 | if has kdeenablefinal ${IUSE//+} && use kdeenablefinal; then |
| 306 | einfo "Activating enable-final flag" |
445 | echo "Activating enable-final flag" |
| 307 | mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_FINAL=ON" |
446 | mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_FINAL=ON" |
| 308 | fi |
447 | fi |
| 309 | |
448 | |
| 310 | # Enable generation of HTML handbook |
449 | # Enable generation of HTML handbook |
| 311 | if has htmlhandbook ${IUSE//+} && use htmlhandbook; then |
450 | if has htmlhandbook ${IUSE//+} && use htmlhandbook; then |
| 312 | einfo "Enabling building of HTML handbook" |
451 | echo "Enabling building of HTML handbook" |
| 313 | mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_HTMLHANDBOOK=ON" |
452 | mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_HTMLHANDBOOK=ON" |
| 314 | fi |
453 | fi |
| 315 | |
454 | |
| 316 | # Build tests in src_test only, where we override this value |
455 | # Build tests in src_test only, where we override this value |
| 317 | mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=OFF" |
456 | mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=OFF" |