# Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # @ECLASS: kde4-base.eclass # @MAINTAINER: # kde@gentoo.org # @BLURB: This eclass provides functions for kde 4.X ebuilds # @DESCRIPTION: # The kde4-base.eclass provides support for building KDE4 based ebuilds # and KDE4 applications. # # NOTE: KDE 4 ebuilds by default define EAPI="2", this can be redefined but # eclass will fail with version older than 2. inherit kde4-functions base eutils get_build_type if [[ ${BUILD_TYPE} = live ]]; then if [[ ${KDEBASE} = kdevelop ]]; then inherit git else inherit subversion fi fi # @ECLASS-VARIABLE: CMAKE_REQUIRED # @DESCRIPTION: # Specify if cmake buildsystem is being used. Possible values are 'always' and 'never'. # Please note that if it's set to 'never' you need to explicitly override following phases: # src_configure, src_compile, src_test and src_install. # Defaults to 'always'. : ${CMAKE_REQUIRED:=always} if [[ ${CMAKE_REQUIRED} = always ]]; then buildsystem_eclass="cmake-utils" export_fns="src_configure src_compile src_test src_install" fi # Verify KDE_MINIMAL (display QA notice in pkg_setup, still we need to fix it here) if [[ -n ${KDE_MINIMAL} ]]; then for slot in ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do [[ ${KDE_MINIMAL} = ${slot} ]] && KDE_MINIMAL_VALID=1 && break done unset slot [[ -z ${KDE_MINIMAL_VALID} ]] && unset KDE_MINIMAL else KDE_MINIMAL_VALID=1 fi # @ECLASS-VARIABLE: KDE_MINIMAL # @DESCRIPTION: # This variable is used when KDE_REQUIRED is set, to specify required KDE minimal # version for apps to work. Currently defaults to 4.4 # One may override this variable to raise version requirements. # For possible values look at KDE_SLOTS and KDE_LIVE_SLOTS variables. # Note that it is fixed to ${SLOT} for kde-base packages. KDE_MINIMAL="${KDE_MINIMAL:-4.4}" # Set slot for packages in kde-base, koffice and kdevelop case ${KDEBASE} in kde-base) # Determine SLOT from PVs case ${PV} in *.9999*) SLOT="${PV/.9999*/}" ;; # stable live 4.6* | 4.5.[6-9]*) SLOT="4.6" ;; 4.5* | 4.4.[6-9]*) SLOT="4.5" ;; 4.4* | 4.3.[6-9]*) SLOT="4.4" ;; 9999*) SLOT="live" ;; # regular live *) die "Unsupported ${PV}" ;; esac KDE_MINIMAL="${SLOT}" ;; koffice) SLOT="2" ;; kdevelop) if [[ ${BUILD_TYPE} = live ]]; then # @ECLASS-VARIABLE: KDEVELOP_VERSION # @DESCRIPTION: # Specifies KDevelop version. Default is 4.0.0 for tagged packages and 9999 for live packages. # Applies to KDEBASE=kdevelop only. KDEVELOP_VERSION="${KDEVELOP_VERSION:-9999}" # @ECLASS-VARIABLE: KDEVPLATFORM_VERSION # @DESCRIPTION: # Specifies KDevplatform version. Default is 1.0.0 for tagged packages and 9999 for live packages. # Applies to KDEBASE=kdevelop only. KDEVPLATFORM_VERSION="${KDEVPLATFORM_VERSION:-9999}" else case ${PN} in kdevelop|quanta) KDEVELOP_VERSION=${PV} KDEVPLATFORM_VERSION="$(($(get_major_version)-3)).$(get_after_major_version)" ;; kdevplatform) KDEVELOP_VERSION="$(($(get_major_version)+3)).$(get_after_major_version)" KDEVPLATFORM_VERSION=${PV} ;; *) KDEVELOP_VERSION="${KDEVELOP_VERSION:-4.0.0}" KDEVPLATFORM_VERSION="${KDEVPLATFORM_VERSION:-1.0.0}" esac fi SLOT="4" ;; esac slot_is_at_least 4.5 ${KDE_MINIMAL} && CMAKE_MIN_VERSION="2.8.1" inherit ${buildsystem_eclass} EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare ${export_fns} pkg_postinst pkg_postrm unset buildsystem_eclass unset export_fns case ${KDEBASE} in kde-base) HOMEPAGE="http://www.kde.org/" LICENSE="GPL-2" ;; koffice) HOMEPAGE="http://www.koffice.org/" LICENSE="GPL-2" ;; kdevelop) HOMEPAGE="http://www.kdevelop.org/" LICENSE="GPL-2" ;; esac # @ECLASS-VARIABLE: OPENGL_REQUIRED # @DESCRIPTION: # Is qt-opengl required? Possible values are 'always', 'optional' and 'never'. # This variable must be set before inheriting any eclasses. Defaults to 'never'. OPENGL_REQUIRED="${OPENGL_REQUIRED:-never}" # @ECLASS-VARIABLE: MULTIMEDIA_REQUIRED # @DESCRIPTION: # Is qt-multimedia required? Possible values are 'always', 'optional' and 'never'. # This variable must be set before inheriting any eclasses. Defaults to 'never'. MULTIMEDIA_REQUIRED="${MULTIMEDIA_REQUIRED:-never}" # @ECLASS-VARIABLE: WEBKIT_REQUIRED # @DESCRIPTION: # Is qt-webkit requred? Possible values are 'always', 'optional' and 'never'. # This variable must be set before inheriting any eclasses. Defaults to 'never'. WEBKIT_REQUIRED="${WEBKIT_REQUIRED:-never}" # @ECLASS-VARIABLE: CPPUNIT_REQUIRED # @DESCRIPTION: # Is cppunit required for tests? Possible values are 'always', 'optional' and 'never'. # This variable must be set before inheriting any eclasses. Defaults to 'never'. CPPUNIT_REQUIRED="${CPPUNIT_REQUIRED:-never}" # @ECLASS-VARIABLE: KDE_REQUIRED # @DESCRIPTION: # Is kde required? Possible values are 'always', 'optional' and 'never'. # This variable must be set before inheriting any eclasses. Defaults to 'always' # If set to always or optional, KDE_MINIMAL may be overriden as well. # Note that for kde-base packages this variable is fixed to 'always'. KDE_REQUIRED="${KDE_REQUIRED:-always}" # Setup packages inheriting this eclass case ${KDEBASE} in kde-base) if [[ $BUILD_TYPE = live ]]; then # Disable tests for live ebuilds RESTRICT+=" test" # Live ebuilds in kde-base default to kdeprefix by default IUSE+=" +kdeprefix" else # All other ebuild types default to -kdeprefix as before IUSE+=" kdeprefix" fi # This code is to prevent portage from searching GENTOO_MIRRORS for # packages that will never be mirrored. (As they only will ever be in # the overlay). case ${PV} in *9999* | 4.?.[6-9]?) RESTRICT+=" mirror" ;; esac # Block installation of other SLOTS unless kdeprefix RDEPEND+=" $(block_other_slots)" ;; esac # @ECLASS-VARIABLE: QT_MINIMAL # @DESCRIPTION: # Determine version of qt we enforce as minimal for the package. 4.4.0 4.5.1... # 4.6.0 for 4.4 and 4.6.3 for 4.5 and later if slot_is_at_least 4.5 "${KDE_MINIMAL}"; then QT_MINIMAL="${QT_MINIMAL:-4.6.3}" else QT_MINIMAL="${QT_MINIMAL:-4.6.0}" fi # OpenGL dependencies qtopengldepend=" >=x11-libs/qt-opengl-${QT_MINIMAL}:4 " case ${OPENGL_REQUIRED} in always) COMMONDEPEND+=" ${qtopengldepend}" ;; optional) IUSE+=" opengl" COMMONDEPEND+=" opengl? ( ${qtopengldepend} )" ;; *) ;; esac unset qtopengldepend # MultiMedia dependencies qtmultimediadepend=" >=x11-libs/qt-multimedia-${QT_MINIMAL}:4 " case ${MULTIMEDIA_REQUIRED} in always) COMMONDEPEND+=" ${qtmultimediadepend}" ;; optional) IUSE+=" multimedia" COMMONDEPEND+=" multimedia? ( ${qtmultimediadepend} )" ;; *) ;; esac unset qtmultimediadepend # WebKit dependencies case ${KDE_REQUIRED} in always) qtwebkitusedeps="[kde]" ;; optional) qtwebkitusedeps="[kde?]" ;; *) ;; esac qtwebkitdepend=" >=x11-libs/qt-webkit-${QT_MINIMAL}:4${qtwebkitusedeps} " unset qtwebkitusedeps case ${WEBKIT_REQUIRED} in always) COMMONDEPEND+=" ${qtwebkitdepend}" ;; optional) IUSE+=" webkit" COMMONDEPEND+=" webkit? ( ${qtwebkitdepend} )" ;; *) ;; esac unset qtwebkitdepend # CppUnit dependencies cppuintdepend=" dev-util/cppunit " case ${CPPUNIT_REQUIRED} in always) DEPEND+=" ${cppuintdepend}" ;; optional) IUSE+=" test" DEPEND+=" test? ( ${cppuintdepend} )" ;; *) ;; esac unset cppuintdepend # KDE dependencies # Qt accessibility classes are needed in various places, bug 325461 kdecommondepend=" >=x11-libs/qt-core-${QT_MINIMAL}:4[qt3support,ssl] >=x11-libs/qt-gui-${QT_MINIMAL}:4[accessibility,dbus] >=x11-libs/qt-qt3support-${QT_MINIMAL}:4[accessibility,kde] >=x11-libs/qt-script-${QT_MINIMAL}:4 >=x11-libs/qt-sql-${QT_MINIMAL}:4[qt3support] >=x11-libs/qt-svg-${QT_MINIMAL}:4 >=x11-libs/qt-test-${QT_MINIMAL}:4 !aqua? ( x11-libs/libXext x11-libs/libXt x11-libs/libXxf86vm ) " #perl is not needed on host (+ difficult crosscompilation) tc-is-cross-compiler || kdecommondepend+=" dev-lang/perl" if [[ ${PN} != kdelibs ]]; then if [[ ${KDEBASE} = kde-base ]]; then kdecommondepend+=" $(add_kdebase_dep kdelibs)" else kdecommondepend+=" >=kde-base/kdelibs-${KDE_MINIMAL} " if [[ ${KDEBASE} = kdevelop ]]; then if [[ ${PN} != kdevplatform ]]; then # @ECLASS-VARIABLE: KDEVPLATFORM_REQUIRED # @DESCRIPTION: # Specifies whether kdevplatform is required. Possible values are 'always' (default) and 'never'. # Applies to KDEBASE=kdevelop only. KDEVPLATFORM_REQUIRED="${KDEVPLATFORM_REQUIRED:-always}" case ${KDEVPLATFORM_REQUIRED} in always) kdecommondepend+=" >=dev-util/kdevplatform-${KDEVPLATFORM_VERSION} " ;; *) ;; esac fi fi fi fi kdedepend=" dev-util/automoc dev-util/pkgconfig !aqua? ( || ( >=x11-libs/libXtst-1.1.0 &-) != "declare -a mycmakeargs="* ]]; then mycmakeargs=(${mycmakeargs}) fi mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}") cmake-utils_src_configure } # @FUNCTION: kde4-base_src_compile # @DESCRIPTION: # General function for compiling KDE4 applications. kde4-base_src_compile() { debug-print-function ${FUNCNAME} "$@" cmake-utils_src_compile "$@" } # @FUNCTION: kde4-base_src_test # @DESCRIPTION: # Function for testing KDE4 applications. kde4-base_src_test() { debug-print-function ${FUNCNAME} "$@" # Override this value, set in kde4-base_src_configure() mycmakeargs+=(-DKDE4_BUILD_TESTS=ON) cmake-utils_src_configure kde4-base_src_compile cmake-utils_src_test } # @FUNCTION: kde4-base_src_install # @DESCRIPTION: # Function for installing KDE4 applications. kde4-base_src_install() { debug-print-function ${FUNCNAME} "$@" # Prefix support, for usage in ebuilds if [[ ${EAPI} == 2 ]] && ! use prefix; then ED=${D} fi if [[ -n ${KMSAVELIBS} ]] ; then install_library_dependencies fi # Install common documentation of KDE4 applications local doc if ! has kde4-meta ${INHERITED}; then for doc in "${S}"/{AUTHORS,CHANGELOG,ChangeLog*,README*,NEWS,TODO,HACKING}; do [[ -f "${doc}" ]] && [[ -s "${doc}" ]] && dodoc "${doc}" done for doc in "${S}"/*/{AUTHORS,CHANGELOG,ChangeLog*,README*,NEWS,TODO,HACKING}; do [[ -f "${doc}" ]] && [[ -s "${doc}" ]] && newdoc "${doc}" "$(basename $(dirname ${doc})).$(basename ${doc})" done fi cmake-utils_src_install } # @FUNCTION: kde4-base_pkg_postinst # @DESCRIPTION: # Function to rebuild the KDE System Configuration Cache after an application has been installed. kde4-base_pkg_postinst() { debug-print-function ${FUNCNAME} "$@" buildsycoca if [[ ${BUILD_TYPE} = live ]] && [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then echo einfo "WARNING! This is an experimental live ebuild of ${CATEGORY}/${PN}" einfo "Use it at your own risk." einfo "Do _NOT_ file bugs at bugs.gentoo.org because of this ebuild!" echo elif [[ ${BUILD_TYPE} != live ]] && [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]] && has kdeprefix ${IUSE//+} && use kdeprefix; then # warning about kdeprefix for non-live users echo ewarn "WARNING! You have the kdeprefix useflag enabled." ewarn "This setting is strongly discouraged and might lead to potential trouble" ewarn "with KDE update strategies." ewarn "You are using this setup at your own risk and the kde team does not" ewarn "take responsibilities for dead kittens." echo fi if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]] && ! has_version 'kde-base/kdebase-runtime-meta' && ! has_version 'kde-base/kdebase-startkde'; then # warn about not supported approach if [[ ${KDE_REQUIRED} == always ]] || ( [[ ${KDE_REQUIRED} == optional ]] && use kde ); then echo ewarn "WARNING! Your system configuration contains neither \"kde-base/kdebase-runtime-meta\"" ewarn "nor \"kde-base/kdebase-startkde\". You need one of above." ewarn "With this setting you are unsupported by KDE team." ewarn "All missing features you report for misc packages will be probably ignored or closed as INVALID." fi fi } # @FUNCTION: kde4-base_pkg_postrm # @DESCRIPTION: # Function to rebuild the KDE System Configuration Cache after an application has been removed. kde4-base_pkg_postrm() { debug-print-function ${FUNCNAME} "$@" buildsycoca }