| 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.7 2008/04/03 18:12:48 philantrop 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="|| ( ( |
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=" |
| 21 | x11-libs/qt-core:4 |
46 | x11-libs/qt-core:4${qtcore} |
| 22 | x11-libs/qt-gui:4 |
47 | x11-libs/qt-gui:4${qtgui} |
| 23 | x11-libs/qt-qt3support:4 |
48 | x11-libs/qt-qt3support:4${qt3support} |
| 24 | x11-libs/qt-svg:4 |
49 | x11-libs/qt-svg:4${qtsvg} |
| 25 | x11-libs/qt-test:4 ) |
50 | x11-libs/qt-test:4${qttest}" |
| 26 | >=x11-libs/qt-4.3.3:4 )" |
51 | qtopengldepend="x11-libs/qt-opengl:4${qtopengl}" |
| 27 | |
52 | |
| 28 | # @ECLASS-VARIABLE: OPENGL_REQUIRED |
53 | # allow monolithic qt for PV < 4.1 |
| 29 | # @DESCRIPTION: |
54 | case "${PV}" in |
| 30 | # Is qt-opengl required? Possible values are 'always', 'optional' and 'never'. |
55 | scm|9999.4|4.1*) : ;; |
| 31 | # This variable must be set before inheriting any eclasses. Defaults to 'never'. |
56 | *) |
| 32 | OPENGL_REQUIRED="${OPENGL_REQUIRED:-never}" |
57 | qtdepend="|| ( ( ${qtdepend} ) >=x11-libs/qt-4.3.3:4${qt} )" |
|
|
58 | qtopengldepend="|| ( ${qtopengldepend} >=x11-libs/qt-4.3.3:4 )" |
|
|
59 | ;; |
|
|
60 | esac |
| 33 | |
61 | |
| 34 | OPENGLDEPEND="|| ( x11-libs/qt-opengl:4 |
62 | # opengl dependencies |
| 35 | >=x11-libs/qt-4.3.3:4 )" |
|
|
| 36 | case "${OPENGL_REQUIRED}" in |
63 | case "${OPENGL_REQUIRED}" in |
| 37 | always) |
64 | always) |
| 38 | COMMONDEPEND="${COMMONDEPEND} |
65 | qtdepend="${qtdepend} |
| 39 | ${OPENGLDEPEND}" |
66 | ${qtopengldepend}" |
| 40 | ;; |
67 | ;; |
| 41 | optional) |
68 | optional) |
| 42 | IUSE="${IUSE} opengl" |
69 | IUSE="${IUSE} opengl" |
| 43 | COMMONDEPEND="${COMMONDEPEND} |
70 | qtdepend="${qtdepend} |
| 44 | opengl? ( ${OPENGLDEPEND} )" |
71 | opengl? ( ${qtopengldepend} )" |
| 45 | ;; |
72 | ;; |
| 46 | *) |
73 | *) |
| 47 | OPENGL_REQUIRED="never" |
74 | OPENGL_REQUIRED="never" |
| 48 | ;; |
75 | ;; |
| 49 | esac |
76 | esac |
|
|
77 | |
|
|
78 | COMMONDEPEND="${COMMONDEPEND} ${qtdepend}" |
|
|
79 | } |
|
|
80 | kde4-base_set_qt_dependencies |
| 50 | |
81 | |
| 51 | DEPEND="${DEPEND} ${COMMONDEPEND} |
82 | DEPEND="${DEPEND} ${COMMONDEPEND} |
| 52 | >=dev-util/cmake-2.4.7-r1 |
83 | >=dev-util/cmake-2.4.7-r1 |
| 53 | dev-util/pkgconfig |
84 | dev-util/pkgconfig |
| 54 | x11-libs/libXt |
85 | x11-libs/libXt |
| 55 | x11-proto/xf86vidmodeproto" |
86 | x11-proto/xf86vidmodeproto" |
| 56 | RDEPEND="${RDEPEND} ${COMMONDEPEND}" |
87 | RDEPEND="${RDEPEND} ${COMMONDEPEND}" |
|
|
88 | |
|
|
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}" |
| 57 | |
94 | |
| 58 | # @ECLASS-VARIABLE: CPPUNIT_REQUIRED |
95 | # @ECLASS-VARIABLE: CPPUNIT_REQUIRED |
| 59 | # @DESCRIPTION: |
96 | # @DESCRIPTION: |
| 60 | # Is cppunit required for tests? Possible values are 'always', 'optional' and 'never'. |
97 | # 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'. |
98 | # This variable must be set before inheriting any eclasses. Defaults to 'never'. |
| … | |
… | |
| 118 | else |
155 | else |
| 119 | _kdedir="4.0" |
156 | _kdedir="4.0" |
| 120 | _pv=":kde-4" |
157 | _pv=":kde-4" |
| 121 | fi |
158 | fi |
| 122 | ;; |
159 | ;; |
| 123 | svn|9999*|:kde-svn) |
160 | scm|svn|9999*|:kde-svn) |
| 124 | _kdedir="svn" |
161 | _kdedir="svn" |
| 125 | _pv=":kde-svn" |
162 | _pv=":kde-svn" |
| 126 | export NEED_KDE="svn" |
163 | export NEED_KDE="svn" |
| 127 | ;; |
164 | ;; |
| 128 | *:kde-svn) |
165 | *:kde-svn) |
| … | |
… | |
| 249 | # 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 |
| 250 | # $KDE4_BUILT_WITH_USE_CHECK are missing. |
287 | # $KDE4_BUILT_WITH_USE_CHECK are missing. |
| 251 | kde4-base_pkg_setup() { |
288 | kde4-base_pkg_setup() { |
| 252 | debug-print-function $FUNCNAME "$@" |
289 | debug-print-function $FUNCNAME "$@" |
| 253 | |
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 | *) |
| 254 | # 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". |
| 255 | if has_version '<x11-libs/qt-4.4_alpha:4'; then |
298 | 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" |
299 | 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 |
300 | else |
| 268 | KDE4_BUILT_WITH_USE_CHECK="${KDE4_BUILT_WITH_USE_CHECK} |
301 | KDE4_BUILT_WITH_USE_CHECK="${KDE4_BUILT_WITH_USE_CHECK} |
| 269 | x11-libs/qt-core:4 debug |
|
|
| 270 | x11-libs/qt-gui:4 debug |
|
|
| 271 | x11-libs/qt-qt3support:4 debug |
302 | x11-libs/qt-core qt3support ssl |
| 272 | x11-libs/qt-svg:4 debug |
303 | x11-libs/qt-gui accessibility dbus |
| 273 | x11-libs/qt-test:4 debug" |
304 | x11-libs/qt-qt3support accessibility" |
| 274 | if has opengl ${IUSE//+} && use opengl || [[ ${OPENGL_REQUIRED} == always ]]; then |
305 | fi |
|
|
306 | |
|
|
307 | if has debug ${IUSE//+} && use debug; then |
|
|
308 | if has_version '<x11-libs/qt-4.4.0_alpha:4'; then |
|
|
309 | QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} debug" |
|
|
310 | else |
| 275 | KDE4_BUILT_WITH_USE_CHECK="${KDE4_BUILT_WITH_USE_CHECK} |
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} |
| 276 | x11-libs/qt-opengl:4 debug" |
319 | x11-libs/qt-opengl:4 debug" |
|
|
320 | fi |
| 277 | fi |
321 | fi |
| 278 | fi |
322 | fi |
| 279 | fi |
|
|
| 280 | |
323 | |
| 281 | if has opengl ${IUSE//+} && use opengl || [[ ${OPENGL_REQUIRED} == always ]]; then |
324 | if has opengl ${IUSE//+} && use opengl || [[ ${OPENGL_REQUIRED} == always ]]; then |
| 282 | if has_version '<x11-libs/qt-4.4.0_alpha:4'; then |
325 | if has_version '<x11-libs/qt-4.4.0_alpha:4'; then |
| 283 | QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} opengl" |
326 | QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} opengl" |
| 284 | fi |
327 | fi |
| 285 | fi |
328 | fi |
| 286 | |
|
|
| 287 | kde4-functions_check_use |
329 | kde4-functions_check_use |
|
|
330 | ;; |
|
|
331 | esac |
| 288 | } |
332 | } |
| 289 | |
333 | |
| 290 | # @FUNCTION: kde4-base_apply_patches |
334 | # @FUNCTION: kde4-base_apply_patches |
| 291 | # @DESCRIPTION: |
335 | # @DESCRIPTION: |
| 292 | # This function applies patches. |
336 | # This function applies patches. |
| … | |
… | |
| 356 | # Updated cmake dir |
400 | # Updated cmake dir |
| 357 | if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then |
401 | if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then |
| 358 | ebegin "Updating cmake/ directory..." |
402 | ebegin "Updating cmake/ directory..." |
| 359 | rm -rf "${KDE_S}/cmake" || die "Unable to remove old cmake/ directory" |
403 | 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" |
404 | ln -s "${WORKDIR}/cmake" "${KDE_S}/cmake" || die "Unable to symlink the new cmake/ directory" |
| 361 | eend 0 |
405 | eend 0 |
| 362 | fi |
406 | fi |
| 363 | } |
407 | } |
| 364 | |
408 | |
| 365 | # @FUNCTION: kde4-base_src_compile |
409 | # @FUNCTION: kde4-base_src_compile |
| 366 | # @DESCRIPTION: |
410 | # @DESCRIPTION: |