| 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.5 2008/03/14 15:51:50 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 | |
| 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 | COMMONDEPEND="|| ( ( |
|
|
21 | x11-libs/qt-core:4 |
|
|
22 | x11-libs/qt-gui:4 |
|
|
23 | x11-libs/qt-qt3support:4 |
|
|
24 | x11-libs/qt-svg:4 |
|
|
25 | x11-libs/qt-test:4 ) |
|
|
26 | >=x11-libs/qt-4.3.3:4 )" |
|
|
27 | |
|
|
28 | # @ECLASS-VARIABLE: OPENGL_REQUIRED |
|
|
29 | # @DESCRIPTION: |
|
|
30 | # Is qt-opengl required? Possible values are 'always', 'optional' and 'never'. |
|
|
31 | # This variable must be set before inheriting any eclasses. Defaults to 'never'. |
|
|
32 | OPENGL_REQUIRED="${OPENGL_REQUIRED:-never}" |
|
|
33 | |
|
|
34 | OPENGLDEPEND="|| ( x11-libs/qt-opengl:4 |
|
|
35 | >=x11-libs/qt-4.3.3:4 )" |
|
|
36 | case "${OPENGL_REQUIRED}" in |
|
|
37 | always) |
|
|
38 | COMMONDEPEND="${COMMONDEPEND} |
|
|
39 | ${OPENGLDEPEND}" |
|
|
40 | ;; |
|
|
41 | optional) |
|
|
42 | IUSE="${IUSE} opengl" |
|
|
43 | COMMONDEPEND="${COMMONDEPEND} |
|
|
44 | opengl? ( ${OPENGLDEPEND} )" |
|
|
45 | ;; |
|
|
46 | *) |
|
|
47 | OPENGL_REQUIRED="never" |
|
|
48 | ;; |
|
|
49 | esac |
|
|
50 | |
| 21 | DEPEND="${DEPEND} ${COMMONDEPEND} |
51 | DEPEND="${DEPEND} ${COMMONDEPEND} |
| 22 | >=dev-util/cmake-2.4.7-r1 |
52 | >=dev-util/cmake-2.4.7-r1 |
| 23 | dev-util/pkgconfig |
53 | dev-util/pkgconfig |
| 24 | x11-libs/libXt |
54 | x11-libs/libXt |
| 25 | x11-proto/xf86vidmodeproto" |
55 | x11-proto/xf86vidmodeproto" |
| 26 | RDEPEND="${RDEPEND} ${COMMONDEPEND}" |
56 | RDEPEND="${RDEPEND} ${COMMONDEPEND}" |
| 27 | |
57 | |
| 28 | if has test ${IUSE//+}; then |
58 | # @ECLASS-VARIABLE: CPPUNIT_REQUIRED |
|
|
59 | # @DESCRIPTION: |
|
|
60 | # 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'. |
|
|
62 | CPPUNIT_REQUIRED="${CPPUNIT_REQUIRED:-never}" |
|
|
63 | |
|
|
64 | case "${CPPUNIT_REQUIRED}" in |
|
|
65 | always) |
|
|
66 | DEPEND="${DEPEND} dev-util/cppunit" |
|
|
67 | ;; |
|
|
68 | optional) |
|
|
69 | IUSE="${IUSE} test" |
| 29 | DEPEND="${DEPEND} |
70 | DEPEND="${DEPEND} |
| 30 | test? ( dev-util/cppunit )" |
71 | test? ( dev-util/cppunit )" |
| 31 | fi |
72 | ;; |
|
|
73 | *) |
|
|
74 | CPPUNIT_REQUIRED="never" |
|
|
75 | ;; |
|
|
76 | esac |
| 32 | |
77 | |
| 33 | # @ECLASS-VARIABLE: NEED_KDE |
78 | # @ECLASS-VARIABLE: NEED_KDE |
| 34 | # @DESCRIPTION: |
79 | # @DESCRIPTION: |
| 35 | # This variable sets the version of KDE4 which will be used by the eclass. |
80 | # 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". |
81 | # This variable must be set by the ebuild, for all categories except for "kde-base". |
| … | |
… | |
| 205 | # $KDE4_BUILT_WITH_USE_CHECK are missing. |
250 | # $KDE4_BUILT_WITH_USE_CHECK are missing. |
| 206 | kde4-base_pkg_setup() { |
251 | kde4-base_pkg_setup() { |
| 207 | debug-print-function $FUNCNAME "$@" |
252 | debug-print-function $FUNCNAME "$@" |
| 208 | |
253 | |
| 209 | # KDE4 applications require qt4 compiled with USE="accessibility dbus gif jpeg png qt3support ssl zlib". |
254 | # 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 |
| 210 | QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} accessibility dbus gif jpeg png qt3support ssl zlib" |
256 | 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 |
| 211 | |
263 | |
| 212 | if has debug ${IUSE//+} && use debug; then |
264 | if has debug ${IUSE//+} && use debug; then |
|
|
265 | if has_version '<x11-libs/qt-4.4.0_alpha:4'; then |
| 213 | QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} debug" |
266 | QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} debug" |
|
|
267 | else |
|
|
268 | 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 |
|
|
272 | x11-libs/qt-svg:4 debug |
|
|
273 | x11-libs/qt-test:4 debug" |
|
|
274 | if [[ ${OPENGL_REQUIRED} == always ]] || has opengl ${IUSE//+} && use opengl; then |
|
|
275 | KDE4_BUILT_WITH_USE_CHECK="${KDE4_BUILT_WITH_USE_CHECK} |
|
|
276 | x11-libs/qt-opengl:4 debug" |
|
|
277 | fi |
| 214 | fi |
278 | fi |
|
|
279 | fi |
| 215 | |
280 | |
| 216 | if has opengl ${IUSE//+} && use opengl; then |
281 | if [[ ${OPENGL_REQUIRED} == always ]] || has opengl ${IUSE//+} && use opengl; then |
|
|
282 | if has_version '<x11-libs/qt-4.4.0_alpha:4'; then |
| 217 | QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} opengl" |
283 | QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} opengl" |
|
|
284 | fi |
| 218 | fi |
285 | fi |
| 219 | |
286 | |
| 220 | kde4-functions_check_use |
287 | kde4-functions_check_use |
| 221 | } |
288 | } |
| 222 | |
289 | |
| 223 | # @FUNCTION: kde4-base_src_unpack |
290 | # @FUNCTION: kde4-base_apply_patches |
| 224 | # @DESCRIPTION: |
291 | # @DESCRIPTION: |
| 225 | # This function unpacks the source tarballs for KDE4 applications. |
292 | # 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 | # |
293 | # |
| 230 | # If the directory ${WORKDIR}/patches/ exists, we apply all patches in that |
294 | # If the directory ${WORKDIR}/patches/ exists, we apply all patches in that |
| 231 | # directory, provided they follow this format: |
295 | # directory, provided they follow this format: |
| 232 | # @CODE |
296 | # @CODE |
| 233 | # - Monolithic ebuilds, (from kde-base) |
297 | # - Monolithic ebuilds, (from kde-base) |
| … | |
… | |
| 241 | # - $CATEGORY!=kde-base: |
305 | # - $CATEGORY!=kde-base: |
| 242 | # Apply ${PN}-${PV}-*{diff,patch} |
306 | # Apply ${PN}-${PV}-*{diff,patch} |
| 243 | # @CODE |
307 | # @CODE |
| 244 | # |
308 | # |
| 245 | # If ${PATCHES} is non-zero all patches in it gets applied. |
309 | # If ${PATCHES} is non-zero all patches in it gets applied. |
|
|
310 | kde4-base_apply_patches() { |
|
|
311 | local _patchdir _packages _p |
|
|
312 | _patchdir="${WORKDIR}/patches/" |
|
|
313 | if [[ -d "${_patchdir}" ]]; then |
|
|
314 | if is-parent-package ${CATEGORY}/${PN} ; then |
|
|
315 | _packages="$(get-child-packages ${CATEGORY}/${PN})" |
|
|
316 | _packages="${_packages//${CATEGORY}\//} ${PN}" |
|
|
317 | else |
|
|
318 | _packages="${PN}" |
|
|
319 | fi |
|
|
320 | for _p in ${_packages}; do |
|
|
321 | PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${PV}-*{diff,patch} 2>/dev/null)" |
|
|
322 | if [[ -n "${KDEBASE}" ]]; then |
|
|
323 | PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${SLOT}-*{diff,patch} 2>/dev/null)" |
|
|
324 | fi |
|
|
325 | done |
|
|
326 | fi |
|
|
327 | [[ -n ${PATCHES} ]] && base_src_unpack autopatch |
|
|
328 | } |
|
|
329 | |
|
|
330 | # @FUNCTION: kde4-base_src_unpack |
|
|
331 | # @DESCRIPTION: |
|
|
332 | # This function unpacks the source tarballs for KDE4 applications. |
|
|
333 | # |
|
|
334 | # If no argument is passed to this function, then standard src_unpack is |
|
|
335 | # executed. Otherwise options are passed to base_src_unpack. |
|
|
336 | # |
|
|
337 | # In addition it calls kde4-base_apply_patches when no arguments are passed to |
|
|
338 | # this function. |
| 246 | kde4-base_src_unpack() { |
339 | kde4-base_src_unpack() { |
| 247 | debug-print-function $FUNCNAME "$@" |
340 | debug-print-function $FUNCNAME "$@" |
| 248 | |
341 | |
| 249 | [[ -z "${KDE_S}" ]] && KDE_S="${S}" |
342 | [[ -z "${KDE_S}" ]] && KDE_S="${S}" |
| 250 | |
343 | |
| 251 | local _patchdir _packages _p |
|
|
| 252 | _patchdir="${WORKDIR}/patches/" |
|
|
| 253 | if [[ -z $* ]]; then |
344 | if [[ -z $* ]]; then |
| 254 | # Unpack first and deal with KDE patches after examing possible patch sets. |
345 | # 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. |
346 | # To be picked up, patches need to conform to the guidelines stated before. |
| 256 | # Monolithic ebuilds will use the split ebuild patches. |
347 | # Monolithic ebuilds will use the split ebuild patches. |
| 257 | [[ -d "${KDE_S}" ]] || unpack ${A} |
348 | [[ -d "${KDE_S}" ]] || unpack ${A} |
| 258 | if [[ -d "${_patchdir}" ]]; then |
349 | 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 |
350 | else |
| 274 | # Call base_src_unpack, which unpacks and patches |
351 | # Call base_src_unpack, which unpacks and patches |
| 275 | # step by step transparently as defined in the ebuild. |
352 | # step by step transparently as defined in the ebuild. |
| 276 | base_src_unpack $* |
353 | base_src_unpack $* |
| 277 | fi |
354 | fi |
| … | |
… | |
| 301 | kde4-base_src_configure() { |
378 | kde4-base_src_configure() { |
| 302 | debug-print-function ${FUNCNAME} "$@" |
379 | debug-print-function ${FUNCNAME} "$@" |
| 303 | |
380 | |
| 304 | # Final flag handling |
381 | # Final flag handling |
| 305 | if has kdeenablefinal ${IUSE//+} && use kdeenablefinal; then |
382 | if has kdeenablefinal ${IUSE//+} && use kdeenablefinal; then |
| 306 | einfo "Activating enable-final flag" |
383 | echo "Activating enable-final flag" |
| 307 | mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_FINAL=ON" |
384 | mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_FINAL=ON" |
| 308 | fi |
385 | fi |
| 309 | |
386 | |
| 310 | # Enable generation of HTML handbook |
387 | # Enable generation of HTML handbook |
| 311 | if has htmlhandbook ${IUSE//+} && use htmlhandbook; then |
388 | if has htmlhandbook ${IUSE//+} && use htmlhandbook; then |
| 312 | einfo "Enabling building of HTML handbook" |
389 | echo "Enabling building of HTML handbook" |
| 313 | mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_HTMLHANDBOOK=ON" |
390 | mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_HTMLHANDBOOK=ON" |
| 314 | fi |
391 | fi |
| 315 | |
392 | |
| 316 | # Build tests in src_test only, where we override this value |
393 | # Build tests in src_test only, where we override this value |
| 317 | mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=OFF" |
394 | mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=OFF" |