| 1 | # Copyright 1999-2009 Gentoo Foundation |
1 | # Copyright 1999-2009 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.26 2009/10/06 18:02:12 alexxy Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/kde4-meta.eclass,v 1.27 2009/10/27 14:16:49 scarabeus 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. |
| … | |
… | |
| 20 | die "kde4-meta.eclass inherited but KMNAME not defined - broken ebuild" |
20 | die "kde4-meta.eclass inherited but KMNAME not defined - broken ebuild" |
| 21 | fi |
21 | fi |
| 22 | |
22 | |
| 23 | # Add khelpcenter dependency when installing handbooks |
23 | # Add khelpcenter dependency when installing handbooks |
| 24 | if [[ ${PN} != khelpcenter ]] && has handbook ${IUSE//+}; then |
24 | if [[ ${PN} != khelpcenter ]] && has handbook ${IUSE//+}; then |
| 25 | RDEPEND+=" handbook? ( >=kde-base/khelpcenter-${PV}:${SLOT}[kdeprefix=] )" |
25 | RDEPEND+=" handbook? ( $(add_kdebase_dep khelpcenter) )" |
| 26 | fi |
26 | fi |
| 27 | |
27 | |
| 28 | # Add dependencies that all packages in a certain module share. |
28 | # Add dependencies that all packages in a certain module share. |
| 29 | case ${KMNAME} in |
29 | case ${KMNAME} in |
| 30 | kdebase|kdebase-apps|kdebase-workspace|kdebase-runtime|kdegraphics) |
30 | kdebase|kdebase-apps|kdebase-workspace|kdebase-runtime|kdegraphics) |
| 31 | COMMONDEPEND+=" >=kde-base/qimageblitz-0.0.4" |
31 | COMMONDEPEND+=" >=kde-base/qimageblitz-0.0.4" |
| 32 | ;; |
32 | ;; |
| 33 | kdenetwork) |
|
|
| 34 | COMMONDEPEND+=" >=kde-base/kdepimlibs-${PV}:${SLOT}[kdeprefix=]" |
|
|
| 35 | ;; |
|
|
| 36 | kdepim|kdepim-runtime) |
33 | kdepim|kdepim-runtime) |
| 37 | COMMONDEPEND+=" |
34 | COMMONDEPEND+=" |
| 38 | dev-libs/boost |
35 | dev-libs/boost |
| 39 | >=kde-base/kdepimlibs-${PV}:${SLOT}[kdeprefix=] |
36 | $(add_kdebase_dep kdepimlibs) |
| 40 | " |
37 | " |
| 41 | case ${PN} in |
38 | case ${PN} in |
| 42 | akregator|kaddressbook|kjots|kmail|knode|knotes|korganizer|ktimetracker) |
39 | akregator|kaddressbook|kjots|kmail|knode|knotes|korganizer|ktimetracker) |
| 43 | IUSE+=" +kontact" |
40 | IUSE+=" +kontact" |
| 44 | if ! slot_is_at_least 4.4 ${SLOT} || [[ ${SLOT} == 4.4 && ${PV} < 4.3.68 ]]; then |
41 | if ! slot_is_at_least 4.4 ${SLOT} || [[ ${SLOT} == 4.4 && ${PV} < 4.3.68 ]]; then |
| 45 | RDEPEND+=" kontact? ( >=kde-base/kontactinterfaces-${PV}:${SLOT}[kdeprefix=] )" |
42 | RDEPEND+=" kontact? ( $(add_kdebase_dep kontactinterfaces) )" |
| 46 | fi |
43 | fi |
| 47 | ;; |
44 | ;; |
| 48 | esac |
45 | esac |
| 49 | ;; |
46 | ;; |
| 50 | kdegames) |
47 | kdegames) |
| 51 | if [[ ${PN} != libkdegames ]]; then |
48 | if [[ ${PN} != libkdegames ]]; then |
| 52 | COMMONDEPEND+=" >=kde-base/libkdegames-${PV}:${SLOT}[kdeprefix=] " |
49 | COMMONDEPEND+=" $(add_kdebase_dep libkdegames)" |
| 53 | fi |
50 | fi |
| 54 | ;; |
51 | ;; |
| 55 | koffice) |
52 | koffice) |
| 56 | [[ ${PN} != koffice-data ]] && IUSE+=" debug" |
53 | [[ ${PN} != koffice-data ]] && IUSE+=" debug" |
| 57 | RDEPEND+=" |
54 | RDEPEND+=" |
| … | |
… | |
| 506 | pushd "${S}" > /dev/null |
503 | pushd "${S}" > /dev/null |
| 507 | |
504 | |
| 508 | comment_all_add_subdirectory ./ |
505 | comment_all_add_subdirectory ./ |
| 509 | |
506 | |
| 510 | # Restore "add_subdirectory( cmake )" in ${S}/CMakeLists.txt |
507 | # Restore "add_subdirectory( cmake )" in ${S}/CMakeLists.txt |
| 511 | if [[ -f "${S}"/CMakeLists.txt ]]; then |
508 | if [[ -f CMakeLists.txt ]]; then |
| 512 | sed -e '/add_subdirectory[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \ |
509 | sed -e '/add_subdirectory[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \ |
| 513 | -e '/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \ |
510 | -e '/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \ |
| 514 | -i "${S}"/CMakeLists.txt || die "${LINENO}: cmake sed died" |
511 | -i CMakeLists.txt || die "${LINENO}: cmake sed died" |
| 515 | fi |
512 | fi |
| 516 | |
513 | |
| 517 | if [[ -z ${KMNOMODULE} ]]; then |
514 | if [[ -z ${KMNOMODULE} ]]; then |
| 518 | # Restore "add_subdirectory" in $KMMODULE subdirectories |
515 | # Restore "add_subdirectory" in $KMMODULE subdirectories |
| 519 | find "${S}"/${KMMODULE} -name CMakeLists.txt -print0 | xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \ |
516 | find "${S}"/${KMMODULE} -name CMakeLists.txt -print0 | \ |
|
|
517 | xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \ |
| 520 | die "${LINENO}: died in KMMODULE section" |
518 | die "${LINENO}: died in KMMODULE section" |
| 521 | _change_cmakelists_parent_dirs ${KMMODULE} |
519 | _change_cmakelists_parent_dirs ${KMMODULE} |
| 522 | fi |
520 | fi |
| 523 | |
521 | |
| 524 | local i |
522 | local i |
| 525 | |
523 | |
| 526 | # KMEXTRACTONLY section - Some ebuilds need to comment out some subdirs in KMMODULE and they use KMEXTRACTONLY |
524 | # KMEXTRACTONLY section - Some ebuilds need to comment out some subdirs in KMMODULE and they use KMEXTRACTONLY |
| 527 | for i in ${KMEXTRACTONLY}; do |
525 | for i in ${KMEXTRACTONLY}; do |
| 528 | if [[ -d "${S}"/${i} && -f "${S}"/${i}/../CMakeLists.txt ]]; then |
526 | if [[ -d ${i} && -f ${i}/../CMakeLists.txt ]]; then |
| 529 | sed -i -e "/([[:space:]]*$(basename $i)[[:space:]]*)/s/^/#DONOTCOMPILE /" "${S}"/${i}/../CMakeLists.txt || \ |
527 | sed -e "/([[:space:]]*$(basename $i)[[:space:]]*)/s/^/#DONOTCOMPILE /" \ |
|
|
528 | -i ${i}/../CMakeLists.txt || \ |
| 530 | die "${LINENO}: sed died while working in the KMEXTRACTONLY section while processing ${i}" |
529 | die "${LINENO}: sed died while working in the KMEXTRACTONLY section while processing ${i}" |
| 531 | fi |
530 | fi |
| 532 | done |
531 | done |
| 533 | |
532 | |
| 534 | # KMCOMPILEONLY |
533 | # KMCOMPILEONLY |
| … | |
… | |
| 556 | # KMEXTRA_NONFATAL section |
555 | # KMEXTRA_NONFATAL section |
| 557 | for i in ${KMEXTRA_NONFATAL}; do |
556 | for i in ${KMEXTRA_NONFATAL}; do |
| 558 | if [[ -d "${S}"/${i} ]]; then |
557 | if [[ -d "${S}"/${i} ]]; then |
| 559 | find "${S}"/${i} -name CMakeLists.txt -print0 | \ |
558 | find "${S}"/${i} -name CMakeLists.txt -print0 | \ |
| 560 | xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \ |
559 | xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \ |
| 561 | die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}" |
560 | die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}" |
| 562 | _change_cmakelists_parent_dirs ${i} |
561 | _change_cmakelists_parent_dirs ${i} |
| 563 | fi |
562 | fi |
| 564 | done |
563 | done |
| 565 | |
564 | |
| 566 | case ${KMNAME} in |
565 | case ${KMNAME} in |
| 567 | kdebase-workspace) |
566 | kdebase-workspace) |
| 568 | # COLLISION PROTECT section |
567 | # COLLISION PROTECT section |
| 569 | # Install the startkde script just once, as a part of kde-base/kdebase-startkde, |
568 | # Install the startkde script just once, as a part of kde-base/kdebase-startkde, |
| 570 | # not as a part of every package. |
569 | # not as a part of every package. |
| 571 | if [[ ${PN} != kdebase-startkde && -f "${S}"/CMakeLists.txt ]]; then |
570 | if [[ ${PN} != kdebase-startkde && -f CMakeLists.txt ]]; then |
| 572 | # The startkde script moved to kdebase-workspace for KDE4 versions > 3.93.0. |
571 | # The startkde script moved to kdebase-workspace for KDE4 versions > 3.93.0. |
| 573 | sed -i -e '/startkde/s/^/#DONOTINSTALL /' "${S}"/CMakeLists.txt || \ |
572 | sed -e '/startkde/s/^/#DONOTINSTALL /' \ |
| 574 | die "${LINENO}: sed died in the kdebase-startkde collision prevention section" |
573 | -i CMakeLists.txt || die "${LINENO}: sed died in the kdebase-startkde collision prevention section" |
| 575 | fi |
574 | fi |
| 576 | # Strip EXPORT feature section from workspace for KDE4 versions > 4.1.82 |
575 | # Strip EXPORT feature section from workspace for KDE4 versions > 4.1.82 |
| 577 | if [[ ${PN} != libkworkspace ]]; then |
576 | if [[ ${PN} != libkworkspace ]]; then |
| 578 | sed -i \ |
|
|
| 579 | -e '/install(FILES ${CMAKE_CURRENT_BINARY_DIR}\/KDE4WorkspaceConfig.cmake/,/^[[:space:]]*FILE KDE4WorkspaceLibraryTargets.cmake )[[:space:]]*^/d' \ |
577 | sed -e '/install(FILES ${CMAKE_CURRENT_BINARY_DIR}\/KDE4WorkspaceConfig.cmake/,/^[[:space:]]*FILE KDE4WorkspaceLibraryTargets.cmake )[[:space:]]*^/d' \ |
| 580 | CMakeLists.txt || die "${LINENO}: sed died in kdebase-workspace strip config install and fix EXPORT section" |
578 | -i CMakeLists.txt || die "${LINENO}: sed died in kdebase-workspace strip config install and fix EXPORT section" |
| 581 | fi |
579 | fi |
| 582 | ;; |
580 | ;; |
| 583 | kdebase-runtime) |
581 | kdebase-runtime) |
| 584 | # COLLISION PROTECT section |
582 | # COLLISION PROTECT section |
| 585 | # Only install the kde4 script as part of kde-base/kdebase-data |
583 | # Only install the kde4 script as part of kde-base/kdebase-data |
| 586 | if [[ ${PN} != kdebase-data && -f "${S}"/CMakeLists.txt ]]; then |
584 | if [[ ${PN} != kdebase-data && -f CMakeLists.txt ]]; then |
| 587 | sed -i -e '/^install(PROGRAMS[[:space:]]*[^[:space:]]*\/kde4[[:space:]]/s/^/#DONOTINSTALL /' \ |
585 | sed -e '/^install(PROGRAMS[[:space:]]*[^[:space:]]*\/kde4[[:space:]]/s/^/#DONOTINSTALL /' \ |
| 588 | "${S}"/CMakeLists.txt || die "Sed to exclude bin/kde4 failed" |
586 | -i CMakeLists.txt || die "Sed to exclude bin/kde4 failed" |
| 589 | fi |
587 | fi |
|
|
588 | ;; |
|
|
589 | kdenetwork) |
|
|
590 | # Disable hardcoded kdepimlibs check |
|
|
591 | sed -e 's/find_package(KdepimLibs REQUIRED)/macro_optional_find_package(KdepimLibs)/' \ |
|
|
592 | -i CMakeLists.txt || die "failed to disable hardcoded checks" |
| 590 | ;; |
593 | ;; |
| 591 | kdepim) |
594 | kdepim) |
| 592 | case ${PN} in |
595 | case ${PN} in |
| 593 | kaddressbook|kalarm|kmailcvt|kontact|korganizer|korn) |
596 | kaddressbook|kalarm|kmailcvt|kontact|korganizer|korn) |
| 594 | sed -i -n -e '/qt4_generate_dbus_interface(.*org\.kde\.kmail\.\(kmail\|mailcomposer\)\.xml/p' \ |
597 | sed -n -e '/qt4_generate_dbus_interface(.*org\.kde\.kmail\.\(kmail\|mailcomposer\)\.xml/p' \ |
| 595 | -e '/add_custom_target(kmail_xml /,/)/p' "${S}"/kmail/CMakeLists.txt || die "uncommenting xml failed" |
598 | -e '/add_custom_target(kmail_xml /,/)/p' \ |
|
|
599 | -i kmail/CMakeLists.txt || die "uncommenting xml failed" |
| 596 | _change_cmakelists_parent_dirs kmail |
600 | _change_cmakelists_parent_dirs kmail |
| 597 | ;; |
601 | ;; |
| 598 | esac |
602 | esac |
| 599 | ;; |
603 | ;; |
| 600 | kdewebdev) |
604 | kdewebdev) |
| … | |
… | |
| 606 | -i CMakeLists.txt || die "failed to disable hardcoded checks" |
610 | -i CMakeLists.txt || die "failed to disable hardcoded checks" |
| 607 | ;; |
611 | ;; |
| 608 | koffice) |
612 | koffice) |
| 609 | # prevent collisions |
613 | # prevent collisions |
| 610 | if [[ ${PN} != koffice-data ]]; then |
614 | if [[ ${PN} != koffice-data ]]; then |
| 611 | sed -i -e '/install(.*FindKOfficeLibs.cmake/,/)/ d' \ |
615 | sed -e '/install(.*FindKOfficeLibs.cmake/,/)/ d' \ |
| 612 | "${S}"/cmake/modules/CMakeLists.txt || \ |
|
|
| 613 | die "${LINENO}: sed died in collision prevention section" |
616 | -i cmake/modules/CMakeLists.txt || die "${LINENO}: sed died in collision prevention section" |
| 614 | sed -i -e '/install(.\+config-openexr\.h.\+)/d' \ |
617 | sed -e '/install(.\+config-openexr\.h.\+)/d' \ |
| 615 | "${S}"//CMakeLists.txt || \ |
|
|
| 616 | die "${LINENO}: sed died in collision prevention section" |
618 | -i CMakeLists.txt || die "${LINENO}: sed died in collision prevention section" |
| 617 | fi |
619 | fi |
|
|
620 | # koffice 2.0 |
|
|
621 | case ${PV} in |
|
|
622 | 2.0.[1-9]) |
|
|
623 | sed -i -n -e '1h;1!H;${g;s/install(.\+config-openexr.h.\+)//;p}' \ |
|
|
624 | "${S}"/CMakeLists.txt || \ |
|
|
625 | die "${LINENO}: sed died in collision prevention section" |
|
|
626 | ;; |
|
|
627 | *) ;; |
|
|
628 | esac |
| 618 | esac |
629 | esac |
| 619 | |
630 | |
| 620 | popd > /dev/null |
631 | popd > /dev/null |
| 621 | } |
632 | } |
| 622 | |
633 | |