/[gentoo-x86]/eclass/kde4-meta.eclass
Gentoo

Diff of /eclass/kde4-meta.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.5 Revision 1.7
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-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-meta.eclass,v 1.5 2008/03/13 17:57:51 ingmar Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-meta.eclass,v 1.7 2008/10/02 06:49:02 jmbsvicetto Exp $
4# 4#
5# @ECLASS: kde4-meta.eclass 5# @ECLASS: kde4-meta.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# kde@gentoo.org 7# kde@gentoo.org
8# @BLURB: Eclass for writing "split" KDE packages. 8# @BLURB: Eclass for writing "split" KDE packages.
15# NOTE: This eclass uses the SLOT dependencies from EAPI="1" or compatible, 15# NOTE: This eclass uses the SLOT dependencies from EAPI="1" or compatible,
16# hence you must define EAPI="1" in the ebuild, before inheriting any eclasses. 16# hence you must define EAPI="1" in the ebuild, before inheriting any eclasses.
17 17
18inherit multilib kde4-functions kde4-base 18inherit multilib kde4-functions kde4-base
19 19
20case "${EAPI}" in
21 2)
22 EXPORT_FUNCTIONS pkg_setup src_unpack src_configure src_compile src_test src_install pkg_postinst pkg_postrm
23 ;;
24 *)
20EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_postinst pkg_postrm 25 EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_postinst pkg_postrm
26 ;;
27esac
21 28
22if [[ -z ${KMNAME} ]]; then 29if [[ -z ${KMNAME} ]]; then
23 die "kde4-meta.eclass inherited but KMNAME not defined - broken ebuild" 30 die "kde4-meta.eclass inherited but KMNAME not defined - broken ebuild"
24fi 31fi
25 32
26case ${KDEBASE} in 33case ${KDEBASE} in
27 kde-base) HOMEPAGE="http://www.kde.org/" 34 kde-base) HOMEPAGE="http://www.kde.org/"
28 LICENSE="GPL-2" ;; 35 LICENSE="GPL-2" ;;
29 koffice) HOMEPAGE="http://www.koffice.org/" 36 koffice) HOMEPAGE="http://www.koffice.org/"
30 LICENSE="GPL-2" ;; 37 LICENSE="GPL-2" ;;
31 *) die "KDEBASE=${KDEBASE} is unsupported." ;;
32esac 38esac
33 39
34debug-print "${BASH_SOURCE} ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - before blockers" 40debug-print "${BASH_SOURCE} ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - before blockers"
35debug-print "${BASH_SOURCE} ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - before blockers" 41debug-print "${BASH_SOURCE} ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - before blockers"
36 42
37# Add a blocker on the package we're derived from 43# Add a blocker on the package we're derived from
44if [[ -n ${KDEBASE} ]]; then
38DEPEND="${DEPEND} !$(get-parent-package ${CATEGORY}/${PN}):${SLOT}" 45 DEPEND="${DEPEND} !$(get-parent-package ${CATEGORY}/${PN}):${SLOT}"
39RDEPEND="${RDEPEND} !$(get-parent-package ${CATEGORY}/${PN}):${SLOT}" 46 RDEPEND="${RDEPEND} !$(get-parent-package ${CATEGORY}/${PN}):${SLOT}"
47fi
40 48
41debug-print "line ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - after blockers" 49debug-print "line ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - after blockers"
42debug-print "line ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - after blockers" 50debug-print "line ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - after blockers"
43 51
44# Add dependencies that all packages in a certain module share. 52# Add dependencies that all packages in a certain module share.
46 kdebase|kdebase-workspace|kdebase-runtime) 54 kdebase|kdebase-workspace|kdebase-runtime)
47 DEPEND="${DEPEND} >=kde-base/qimageblitz-0.0.4" 55 DEPEND="${DEPEND} >=kde-base/qimageblitz-0.0.4"
48 RDEPEND="${RDEPEND} >=kde-base/qimageblitz-0.0.4" 56 RDEPEND="${RDEPEND} >=kde-base/qimageblitz-0.0.4"
49 ;; 57 ;;
50 kdepim) 58 kdepim)
59 DEPEND="${DEPEND} dev-libs/boost app-office/akonadi-server"
60 RDEPEND="${RDEPEND} dev-libs/boost"
51 if [[ ${PN} != kode ]]; then 61 if [[ ${PN} != kode ]]; then
52 DEPEND="${DEPEND} >=kde-base/kode-${PV}:${SLOT}" 62 DEPEND="${DEPEND} >=kde-base/kode-${PV}:${SLOT}"
53 RDEPEND="${RDEPEND} >=kde-base/kode-${PV}:${SLOT}" 63 RDEPEND="${RDEPEND} >=kde-base/kode-${PV}:${SLOT}"
54 fi 64 fi
55 case ${PN} in 65 case ${PN} in
56 akregator|kaddressbook|kmail|kmobiletools|knode|knotes|korganizer|ktimetracker) 66 akregator|kaddressbook|kjots|kmail|kmobiletools|knode|knotes|korganizer|ktimetracker)
57 IUSE="+kontact" 67 IUSE="+kontact"
58 DEPEND="${DEPEND} kontact? ( >=kde-base/kontact-${PV}:${SLOT} )" 68 DEPEND="${DEPEND} kontact? ( >=kde-base/kontactinterfaces-${PV}:${SLOT} )"
59 RDEPEND="${RDEPEND} kontact? ( >=kde-base/kontact-${PV}:${SLOT} )" 69 RDEPEND="${RDEPEND} kontact? ( >=kde-base/kontactinterfaces-${PV}:${SLOT} )"
60 ;; 70 ;;
61 esac 71 esac
62 ;; 72 ;;
63 kdegames) 73 kdegames)
64 if [[ ${PN} != "libkdegames" ]]; then 74 if [[ ${PN} != "libkdegames" ]]; then
139# This function unpacks the source for split ebuilds. See also 149# This function unpacks the source for split ebuilds. See also
140# kde4-meta-src_extract. 150# kde4-meta-src_extract.
141kde4-meta_src_unpack() { 151kde4-meta_src_unpack() {
142 debug-print-function ${FUNCNAME} "$@" 152 debug-print-function ${FUNCNAME} "$@"
143 153
144 if [[ ${KMNAME} = kdepim ]] && \
145 has kontact ${IUSE//+} && \
146 use kontact; then
147 KMEXTRA="${KMEXTRA} kontact/plugins/${PLUGINNAME:-${PN}}"
148 KMEXTRACTONLY="${KMEXTRACTONLY} kontact/interfaces/"
149 fi
150
151 kde4-meta_src_extract 154 kde4-meta_src_extract
152 kde4-meta_change_cmakelists 155 kde4-meta_change_cmakelists
153} 156}
154 157
155# @FUNCTION: kde4-meta_src_extract 158# @FUNCTION: kde4-meta_src_extract
231 if [[ ${PN} != "libkdegames" ]]; then 234 if [[ ${PN} != "libkdegames" ]]; then
232 KMEXTRACTONLY="${KMEXTRACTONLY} 235 KMEXTRACTONLY="${KMEXTRACTONLY}
233 libkdegames" 236 libkdegames"
234 fi 237 fi
235 ;; 238 ;;
239 kdepim)
240 KMEXTRACTONLY="${KMEXTRACTONLY}
241 kleopatra/ConfigureChecks.cmake"
242 if has kontact ${IUSE//+} && use kontact; then
243 KMEXTRA="${KMEXTRA} kontact/plugins/${PLUGINNAME:-${PN}}"
244 KMEXTRACTONLY="${KMEXTRACTONLY} kontactinterfaces/"
245 fi
246 ;;
236 koffice) 247 koffice)
237 KMEXTRACTONLY="${KMEXTRACTONLY} 248 KMEXTRACTONLY="${KMEXTRACTONLY}
238 config-endian.h.cmake 249 config-endian.h.cmake
239 filters/config-filters.h.cmake 250 filters/config-filters.h.cmake
240 config-openexr.h.cmake 251 config-openexr.h.cmake
242 config-prefix.h.cmake" 253 config-prefix.h.cmake"
243 ;; 254 ;;
244 esac 255 esac
245 # Don't install cmake modules for split ebuilds to avoid collisions. 256 # Don't install cmake modules for split ebuilds to avoid collisions.
246 case ${KMNAME} in 257 case ${KMNAME} in
247 kdebase-workspace|kdebase-runtime|kdepim|kdegames|kdegraphics) 258 kdebase-runtime|kdebase-workspace|kdeedu|kdegames|kdegraphics|kdepim)
248 if [[ ${PN} != "libkdegames" ]]; then 259 case ${PN} in
260 libkdegames|libkdeedu|marble)
261 KMEXTRA="${KMEXTRA}
262 cmake/modules/"
263 ;;
264
265 *)
249 KMCOMPILEONLY="${KMCOMPILEONLY} 266 KMCOMPILEONLY="${KMCOMPILEONLY}
250 cmake/modules/" 267 cmake/modules/"
251 else 268 ;;
252 KMEXTRA="${KMEXTRA} 269 esac
253 cmake/modules/"
254 fi
255 ;; 270 ;;
256 esac 271 esac
257 272
258 debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME}: KMEXTRACTONLY ${KMEXTRACTONLY}" 273 debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME}: KMEXTRACTONLY ${KMEXTRACTONLY}"
259} 274}
296 debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmextra_expanded: ${kmextra_expanded}" 311 debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmextra_expanded: ${kmextra_expanded}"
297 debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmmodule_expanded: ${kmmodule_expanded}" 312 debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmmodule_expanded: ${kmmodule_expanded}"
298 debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmcompileonly_expanded: ${kmcompileonly_expanded}" 313 debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmcompileonly_expanded: ${kmcompileonly_expanded}"
299 314
300 315
301 case ${NEED_KDE} in 316 case ${PV} in
302 svn) : ;; 317 scm|9999*) : ;;
303 *) topdir="${KMNAME}-${PV}/" ;; 318 *) topdir="${KMNAME}-${PV}/" ;;
304 esac 319 esac
305 320
306 # Create final list of stuff to extract 321 # Create final list of stuff to extract
307 for i in ${kmmodule_expanded} ${kmextra_expanded} ${kmcompileonly_expanded} \ 322 for i in ${kmmodule_expanded} ${kmextra_expanded} ${kmcompileonly_expanded} \
311 done 326 done
312 327
313 echo ${extractlist} 328 echo ${extractlist}
314} 329}
315 330
331save_library_dependencies() {
332 local depsfile="${T}/${PN}:${SLOT}"
333
334 echo "Saving library dependendencies in ${depsfile##*/}"
335 echo "EXPORT_LIBRARY_DEPENDENCIES(\"${depsfile}\")" >> "${S}/CMakeLists.txt" || \
336 die "Failed to save the library dependencies."
337}
338
339install_library_dependencies() {
340 local depsfile="${T}/${PN}:${SLOT}"
341 echo "Installing library dependendencies as ${depsfile##*/}"
342 insinto /var/lib/kde
343 doins "${depsfile}" || die "Failed to install library dependencies."
344}
345
346load_library_dependencies() {
347 local pn i depsfile
348 echo "Injecting library dependendencies from '${KMLOADLIBS}'"
349
350 i=0
351 for pn in ${KMLOADLIBS} ; do
352 ((i++))
353 depsfile="/var/lib/kde/${pn}:${SLOT}"
354 [[ -r "${depsfile}" ]] || die "Depsfile '${depsfile}' not accessible. You probably need to reinstall ${pn}."
355 sed -i -e "${i}iINCLUDE(\"${depsfile}\")" "${S}/CMakeLists.txt" || \
356 die "Failed to include library dependencies for ${pn}"
357 done
358}
359
316# @FUNCTION: kde4-meta_src_compile 360# @FUNCTION: kde4-meta_src_compile
317# @DESCRIPTION: 361# @DESCRIPTION:
318# General function for compiling split KDE4 applications. 362# General function for compiling split KDE4 applications.
319kde4-meta_src_compile() { 363kde4-meta_src_compile() {
320 debug-print-function ${FUNCNAME} "$@" 364 debug-print-function ${FUNCNAME} "$@"
321 365
366 case "${EAPI}" in
367 2 | 2_pre3 | 2_pre2 | 2_pre1)
368 ;;
369 *)
322 kde4-meta_src_configure 370 kde4-base_meta_configure
371 ;;
372 esac
323 kde4-meta_src_make 373 kde4-meta_src_make
324} 374}
325 375
326_change_cmakelists_parent_dirs() { 376_change_cmakelists_parent_dirs() {
327 debug-print-function ${FUNCNAME} "$@" 377 debug-print-function ${FUNCNAME} "$@"
328 378
329 local _olddir _dir 379 local _olddir _dir
330 _dir="${S}"/${1} 380 _dir="${S}"/${1}
331 until [[ ${_dir} == "${S}" ]]; do 381 until [[ ${_dir} == "${S}" ]]; do
332 _olddir=$(basename ${_dir}) 382 _olddir=$(basename "${_dir}")
333 _dir=$(dirname ${_dir}) 383 _dir=$(dirname "${_dir}")
334 debug-print "${LINENO}: processing ${_dir} CMakeLists.txt searching for ${_olddir}" 384 debug-print "${LINENO}: processing ${_dir} CMakeLists.txt searching for ${_olddir}"
335 if [[ -f ${_dir}/CMakeLists.txt ]]; then 385 if [[ -f ${_dir}/CMakeLists.txt ]]; then
336 sed -i -e "/[[:space:]]*${_olddir}[[:space:]]*/s/^#DONOTCOMPILE //" ${_dir}/CMakeLists.txt || \ 386 sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${_olddir}[[:space:]]*)/s/#DONOTCOMPILE //g" \
387 -e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${_olddir}[[:space:]]*)/s/#DONOTCOMPILE //g" \
337 die "${LINENO}: died in ${FUNCNAME} while processing ${_dir}" 388 -i ${_dir}/CMakeLists.txt || die "${LINENO}: died in ${FUNCNAME} while processing ${_dir}"
338 fi 389 fi
339 done 390 done
340} 391}
341 392
342kde4-meta_change_cmakelists() { 393kde4-meta_change_cmakelists() {
343 debug-print-function ${FUNCNAME} "$@" 394 debug-print-function ${FUNCNAME} "$@"
344 395
345 pushd "${S}" > /dev/null 396 pushd "${S}" > /dev/null
346 397
398 if [[ -n ${KMSAVELIBS} ]] ; then
399 save_library_dependencies
400 fi
401
402 if [[ -n ${KMLOADLIBS} ]] ; then
403 load_library_dependencies
404 fi
405
347 comment_all_add_subdirectory ./ 406 comment_all_add_subdirectory ./
348 407
349 # Restore "add_subdirectory( cmake )" in ${S}/CMakeLists.txt 408 # Restore "add_subdirectory( cmake )" in ${S}/CMakeLists.txt
350 if [[ -f "${S}"/CMakeLists.txt ]]; then 409 if [[ -f "${S}"/CMakeLists.txt ]]; then
351 sed -i -e '/ *cmake */s/^#DONOTCOMPILE //' "${S}"/CMakeLists.txt || die "${LINENO}: cmake sed died" 410 sed -e '/add_subdirectory[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \
411 -e '/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \
412 -i "${S}"/CMakeLists.txt || die "${LINENO}: cmake sed died"
352 fi 413 fi
353 414
354 if [[ -z ${KMNOMODULE} ]]; then 415 if [[ -z ${KMNOMODULE} ]]; then
355 # Restore "add_subdirectory" in $KMMODULE subdirectories 416 # Restore "add_subdirectory" in $KMMODULE subdirectories
356 find "${S}"/${KMMODULE} -name CMakeLists.txt -print0 | xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \ 417 find "${S}"/${KMMODULE} -name CMakeLists.txt -print0 | xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \
389 die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}" 450 die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}"
390 _change_cmakelists_parent_dirs ${i} 451 _change_cmakelists_parent_dirs ${i}
391 fi 452 fi
392 done 453 done
393 454
394 # Documentation section
395 if [[ -n ${docs} ]]; then
396 sed -i -e '/ *doc */s/^#DONOTCOMPILE //g' "${S}"/CMakeLists.txt || \
397 die "${LINENO}: sed died while uncommenting doc dir"
398
399 if [[ -f "${S}"/doc/CMakeLists.txt ]]; then
400 sed -i -e "/( *${KMMODULE##*/} *)/s/^#DONOTCOMPILE //g" "${S}"/doc/CMakeLists.txt \
401 || die "${LINENO}: sed died while uncommenting apps documentation in doc subdir "
402 fi
403 fi
404
405 # KMEXTRACTONLY section - Some ebuilds need to comment out some subdirs in KMMODULE and they use KMEXTRACTONLY 455 # KMEXTRACTONLY section - Some ebuilds need to comment out some subdirs in KMMODULE and they use KMEXTRACTONLY
406 for i in ${KMEXTRACTONLY}; do 456 for i in ${KMEXTRACTONLY}; do
407 if [[ -d "${S}"/${i} && -f "${S}"/${i}/../CMakeLists.txt ]]; then 457 if [[ -d "${S}"/${i} && -f "${S}"/${i}/../CMakeLists.txt ]]; then
408 sed -i -e "/( *$(basename $i) *)/s/^/#DONOTCOMPILE /" "${S}"/${i}/../CMakeLists.txt || \ 458 sed -i -e "/([[:space:]]*$(basename $i)[[:space:]]*)/s/^/#DONOTCOMPILE /" "${S}"/${i}/../CMakeLists.txt || \
409 die "${LINENO}: sed died while working in the KMEXTRACTONLY section while processing ${i}" 459 die "${LINENO}: sed died while working in the KMEXTRACTONLY section while processing ${i}"
410 fi 460 fi
411 done 461 done
412 462
413 # COLLISION PROTECT section
414 # Only install the startkde script as part of kde-base/kdebase-startkde,
415 # instead of with every package.
416 case ${KMNAME} in 463 case ${KMNAME} in
417 kdebase-workspace) 464 kdebase-workspace)
465 # COLLISION PROTECT section
466 # Only install the startkde script as part of kde-base/kdebase-startkde,
467 # instead of with every package.
418 if [[ ${PN} != "kdebase-startkde" && -f "${S}"/CMakeLists.txt ]]; then 468 if [[ ${PN} != "kdebase-startkde" && -f "${S}"/CMakeLists.txt ]]; then
419 case ${PV} in 469 case ${PV} in
420 *) # The startkde script moved to kdebase-workspace for KDE4 versions > 3.93.0. 470 *) # The startkde script moved to kdebase-workspace for KDE4 versions > 3.93.0.
421 sed -i -e '/startkde/s/^/#DONOTINSTALL /' "${S}"/CMakeLists.txt || \ 471 sed -i -e '/startkde/s/^/#DONOTINSTALL /' "${S}"/CMakeLists.txt || \
422 die "${LINENO}: sed died in the kdebase-startkde collision prevention section" 472 die "${LINENO}: sed died in the kdebase-startkde collision prevention section"
423 ;; 473 ;;
424 esac 474 esac
425 fi 475 fi
426 ;; 476 ;;
477 kdebase-runtime)
478 # COLLISION PROTECT section
479 # Only install the kde4 script as part of kde-base/kdebase-data
480 if [[ ${PN} != "kdebase-data" && -f "${S}"/CMakeLists.txt ]]; then
481 sed -i -e '/^install(PROGRAMS[[:space:]]*[^[:space:]]*\/kde4[[:space:]]/s/^/#DONOTINSTALL /' \
482 "${S}"/CMakeLists.txt || die "Sed to exclude bin/kde4 failed"
483 fi
484 ;;
485 kdepim)
486 case ${PN} in
487 kaddressbook|kalarm|kmailcvt|kontact|korganizer|korn)
488 sed -i -n -e '/qt4_generate_dbus_interface(.*org\.kde\.kmail\.\(kmail\|mailcomposer\)\.xml/p' \
489 -e '/add_custom_target(kmail_xml /,/)/p' "${S}"/kmail/CMakeLists.txt || die "uncommenting xml failed"
490 _change_cmakelists_parent_dirs kmail
491 ;;
492 esac
493 ;;
494 kdeutils)
427 # This is sort of a hack to avoid patching 16 kdeutils packages with 495 # This is sort of a hack to avoid patching 16 kdeutils packages with
428 # r775410 from upstream trunk which makes blitz optional so superkaramba 496 # r775410 from upstream trunk which makes blitz optional so superkaramba
429 # only gets compiled when it is found. Bug #209324. Remove this no later 497 # only gets compiled when it is found. Bug #209324. Remove this no later
430 # than 4.1. 498 # than 4.1.
431 kdeutils)
432 if [[ ${PN} != superkaramba && ${SLOT} == kde-4 ]]; then 499 if [[ ${PN} != superkaramba && ${SLOT} == kde-4 ]]; then
433 sed -i -e '/find_package(Blitz REQUIRED)/d' "${S}"/CMakeLists.txt \ 500 sed -i -e '/find_package(Blitz REQUIRED)/d' "${S}"/CMakeLists.txt \
434 || die "${LINENO}: sed to remove dependency on Blitz failed." 501 || die "${LINENO}: sed to remove dependency on Blitz failed."
435 fi 502 fi
436 ;; 503 ;;
482kde4-meta_src_install() { 549kde4-meta_src_install() {
483 debug-print-function $FUNCNAME "$@" 550 debug-print-function $FUNCNAME "$@"
484 551
485 kde4-meta_src_make_doc 552 kde4-meta_src_make_doc
486 cmake-utils_src_install 553 cmake-utils_src_install
554
555 if [[ -n ${KMSAVELIBS} ]] ; then
556 install_library_dependencies
557 fi
487} 558}
488 559
489# @FUNCTION: kde4-meta_src_make_doc 560# @FUNCTION: kde4-meta_src_make_doc
490# @DESCRIPTION: 561# @DESCRIPTION:
491# This function searches under ${S}/${KMMODULE}, 562# This function searches under ${S}/${KMMODULE},

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.20