toolchain.eclass: move gentoo patches into own helper
[gentoo.git] / eclass / kde5.eclass
index 68bd5968cbadc26630b8edaa4f29e974c25551b4..ee1d3b35aa8c659a03fb4ef47ae93aa0f74a0eee 100644 (file)
@@ -4,6 +4,7 @@
 # @ECLASS: kde5.eclass
 # @MAINTAINER:
 # kde@gentoo.org
+# @SUPPORTED_EAPIS: 7
 # @BLURB: Support eclass for packages that follow KDE packaging conventions.
 # @DESCRIPTION:
 # This eclass is intended to streamline the creation of ebuilds for packages
@@ -33,10 +34,6 @@ _KDE5_ECLASS=1
 
 inherit cmake-utils flag-o-matic kde5-functions virtualx xdg
 
-case ${EAPI} in
-       6) inherit eapi7-ver eutils gnome2-utils ;;
-esac
-
 if [[ ${KDE_BUILD_TYPE} = live ]]; then
        inherit git-r3
 fi
@@ -62,12 +59,6 @@ EXPORT_FUNCTIONS pkg_setup pkg_nofetch src_unpack src_prepare src_configure src_
 # be set depending on the value of CATEGORY.
 : ${KDE_AUTODEPS:=true}
 
-# @ECLASS-VARIABLE: KDE_BLOCK_SLOT4
-# @DESCRIPTION:
-# This variable only has any effect when when CATEGORY = "kde-apps" and
-# KDE_AUTODEPS is also set. If set to "true", add RDEPEND block on kde-apps/${PN}:4
-: ${KDE_BLOCK_SLOT4:=true}
-
 # @ECLASS-VARIABLE: KDE_DEBUG
 # @DESCRIPTION:
 # If set to "false", add -DNDEBUG (via cmake-utils_src_configure) and -DQT_NO_DEBUG
@@ -159,12 +150,7 @@ fi
 # a proper error message via pkg_nofetch.
 KDE_UNRELEASED=( )
 
-if [[ ${KDEBASE} = kdevelop ]]; then
-       HOMEPAGE="https://www.kdevelop.org/"
-else
-       HOMEPAGE="https://kde.org/"
-fi
-
+HOMEPAGE="https://kde.org/"
 LICENSE="GPL-2"
 
 SLOT=5
@@ -217,7 +203,11 @@ case ${KDE_DESIGNERPLUGIN} in
        false)  ;;
        *)
                IUSE+=" designer"
-               BDEPEND+=" designer? ( $(add_frameworks_dep kdesignerplugin) )"
+               if [[ ${CATEGORY} = kde-apps && ${PV} = 19.0[48]* ]]; then
+                       BDEPEND+=" designer? ( $(add_frameworks_dep kdesignerplugin) )"
+               else
+                       BDEPEND+=" designer? ( $(add_qt_dep designer) )"
+               fi
 esac
 
 case ${KDE_EXAMPLES} in
@@ -263,11 +253,7 @@ case ${KDE_SELINUX_MODULE} in
                ;;
 esac
 
-case ${EAPI} in
-       6) DEPEND+=" ${BDEPEND}" ;;
-esac
-
-DEPEND+=" ${COMMONDEPEND} dev-util/desktop-file-utils"
+DEPEND+=" ${COMMONDEPEND}"
 RDEPEND+=" ${COMMONDEPEND}"
 unset COMMONDEPEND
 
@@ -275,14 +261,6 @@ if [[ -n ${KMNAME} && ${KMNAME} != ${PN} && ${KDE_BUILD_TYPE} = release ]]; then
        S=${WORKDIR}/${KMNAME}-${PV}
 fi
 
-if [[ -n ${KDEBASE} && ${KDEBASE} = kdevelop && ${KDE_BUILD_TYPE} = release ]]; then
-       if [[ -n ${KMNAME} ]]; then
-               S=${WORKDIR}/${KMNAME}-${PV}
-       else
-               S=${WORKDIR}/${P}
-       fi
-fi
-
 _kde_is_unreleased() {
        local pair
        for pair in "${KDE_UNRELEASED[@]}" ; do
@@ -308,6 +286,7 @@ _calculate_src_uri() {
 
        case ${PN} in
                kdelibs4support | \
+               kdewebkit | \
                khtml | \
                kjs | \
                kjsembed | \
@@ -315,10 +294,11 @@ _calculate_src_uri() {
                kross)
                        _kmname="portingAids/${_kmname}"
                        ;;
+               kdesignerplugin)
+                       [[ ${PV} = 5.6[01].* ]] || _kmname="portingAids/${_kmname}"
+                       ;;
        esac
 
-       DEPEND+=" app-arch/xz-utils"
-
        case ${CATEGORY} in
                kde-apps)
                        case ${PV} in
@@ -348,23 +328,15 @@ _calculate_src_uri() {
                        ;;
        esac
 
-       if [[ -z ${SRC_URI} && -n ${KDEBASE} ]] ; then
-               local _kdebase
-               case ${PN} in
-                       kdevelop-pg-qt)
-                               _kdebase=${PN} ;;
-                       *)
-                               _kdebase=${KDEBASE} ;;
-               esac
+       if [[ ${PN} = kdevelop* ]]; then
                case ${PV} in
                        *.*.[6-9]? )
-                               SRC_URI="mirror://kde/unstable/${_kdebase}/${PV}/src/${_kmname}-${PV}.tar.xz"
+                               SRC_URI="mirror://kde/unstable/kdevelop/${PV}/src/${_kmname}-${PV}.tar.xz"
                                RESTRICT+=" mirror"
                                ;;
                        *)
-                               SRC_URI="mirror://kde/stable/${_kdebase}/${PV}/src/${_kmname}-${PV}.tar.xz" ;;
+                               SRC_URI="mirror://kde/stable/kdevelop/${PV}/src/${_kmname}-${PV}.tar.xz" ;;
                esac
-               unset _kdebase
        fi
 
        if _kde_is_unreleased ; then
@@ -518,7 +490,10 @@ kde5_src_prepare() {
        fi
 
        # enable only the requested translations when required
-       if [[ -v LINGUAS ]] ; then
+       # always install unconditionally for kconfigwidgets - if you use language
+       # X as system language, and there is a combobox with language names, the
+       # translated language name for language Y is taken from /usr/share/locale/Y/kf5_entry.desktop
+       if [[ -v LINGUAS && ${PN} != kconfigwidgets ]] ; then
                local po
                for po in ${KDE_PO_DIRS}; do
                if [[ -d ${po} ]] ; then
@@ -620,8 +595,12 @@ kde5_src_configure() {
                cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KF5DocTools=ON )
        fi
 
-       if in_iuse designer && ! use designer && [[ ${KDE_DESIGNERPLUGIN} != false ]] ; then
-               cmakeargs+=( -DCMAKE_DISABLE_FIND_PACKAGE_KF5DesignerPlugin=ON )
+       if in_iuse designer && [[ ${KDE_DESIGNERPLUGIN} != false ]] ; then
+               if [[ ${CATEGORY} = kde-frameworks ]]; then
+                       cmakeargs+=( -DBUILD_DESIGNERPLUGIN=$(usex designer) )
+               else
+                       cmakeargs+=( $(cmake-utils_use_find_package designer KF5DesignerPlugin) )
+               fi
        fi
 
        if [[ ${KDE_QTHELP} != false ]]; then
@@ -632,9 +611,9 @@ kde5_src_configure() {
                cmakeargs+=(
                        # install mkspecs in the same directory as qt stuff
                        -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
+                       # move handbook outside of doc dir, bug 667138
+                       -DKDE_INSTALL_DOCBUNDLEDIR="${EPREFIX}/usr/share/help"
                )
-               # move handbook outside of doc dir for at least two QA warnings, bug 667138
-               [[ ${EAPI} != 6 ]] && cmakeargs+=( -DKDE_INSTALL_DOCBUNDLEDIR="${EPREFIX}/usr/share/help" )
        fi
 
        # allow the ebuild to override what we set here
@@ -687,33 +666,11 @@ kde5_src_test() {
 
 # @FUNCTION: kde5_src_install
 # @DESCRIPTION:
-# Wrapper for cmake-utils_src_install with extra logic to avoid compressing
-# certain types of files. For example, khelpcenter is not able to read
-# compressed handbooks.
+# Wrapper for cmake-utils_src_install. Currently doesn't do anything extra.
 kde5_src_install() {
        debug-print-function ${FUNCNAME} "$@"
 
        cmake-utils_src_install
-
-       # We don't want QCH and tags files to be compressed, because then
-       # cmake can't find the tags and qthelp viewers can't find the docs
-       local p=$(best_version dev-qt/qtcore:5)
-       local pv=$(echo ${p/%-r[0-9]*/} | rev | cut -d - -f 1 | rev)
-       if [[ ${pv} = 5.11* ]]; then
-               #todo: clean up trailing slash check when EAPI <7 is removed
-               if [[ -d ${ED%/}/usr/share/doc/qt-${pv} ]]; then
-                       docompress -x /usr/share/doc/qt-${pv}
-               fi
-       fi
-
-       if [[ ${EAPI} = 6 ]]; then
-               # We don't want /usr/share/doc/HTML to be compressed,
-               # because then khelpcenter can't find the docs
-               #todo: clean up trailing slash check when EAPI <7 is removed
-               if [[ -d ${ED%/}/usr/share/doc/HTML ]]; then
-                       docompress -x /usr/share/doc/HTML
-               fi
-       fi
 }
 
 # @FUNCTION: kde5_pkg_preinst