summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMaciej Mrozowski (reavertm) <reavertm@poczta.fm>2009-02-05 03:12:15 +0100
committerMaciej Mrozowski (reavertm) <reavertm@poczta.fm>2009-02-05 03:12:15 +0100
commitbc11ba4e7b541ef1bd82bc0531d74c6f41b9510b (patch)
tree4252f0c24f2a25303dd8969ea248b28f827d6c7f /eclass
parentfb1907f093f74891933593bd60a132ee83354f0d (diff)
downloadkde-bc11ba4e7b541ef1bd82bc0531d74c6f41b9510b.tar.gz
kde-bc11ba4e7b541ef1bd82bc0531d74c6f41b9510b.tar.bz2
kde-bc11ba4e7b541ef1bd82bc0531d74c6f41b9510b.zip
Draft of kde4 eclass capable of handling unstable snapshots and SLOT 4.3
other fixes: - live kdegames no longer need SRC_URI="" - added some quotations - for live extragear/playground packages - inherited class determines ESVN_STORE_DIR (it's now possible to build live plasmoids and similar right away without specifying ESVN_REPO_URI in ebuild)
Diffstat (limited to 'eclass')
-rw-r--r--eclass/kde4-base.eclass676
-rw-r--r--eclass/kde4-meta.eclass664
2 files changed, 1340 insertions, 0 deletions
diff --git a/eclass/kde4-base.eclass b/eclass/kde4-base.eclass
new file mode 100644
index 00000000000..bfd50b605c7
--- /dev/null
+++ b/eclass/kde4-base.eclass
@@ -0,0 +1,676 @@
+# Copyright 2007-2009 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 base cmake-utils eutils multilib kde4-functions
+
+get_build_type
+if [[ ${BUILD_TYPE} = live ]]; then
+ inherit subversion
+fi
+
+EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm
+
+# @FUNCTION: kde4-base_set_qt_dependencies
+# @DESCRIPTION:
+# Set qt dependencies. And use opengl based on OPENGL_REQUIRED variable.
+kde4-base_set_qt_dependencies() {
+ local qtdepend qtopengldepend
+
+ qtdepend="
+ x11-libs/qt-core:4[qt3support,ssl]
+ x11-libs/qt-gui:4[accessibility,dbus]
+ x11-libs/qt-qt3support:4[accessibility]
+ x11-libs/qt-script:4
+ x11-libs/qt-sql:4[qt3support]
+ x11-libs/qt-svg:4
+ x11-libs/qt-test:4
+ x11-libs/qt-webkit:4"
+ qtopengldepend="x11-libs/qt-opengl:4"
+
+ # opengl dependencies
+ case ${OPENGL_REQUIRED} in
+ always)
+ qtdepend="${qtdepend}
+ ${qtopengldepend}"
+ ;;
+ optional)
+ IUSE="${IUSE} opengl"
+ qtdepend="${qtdepend}
+ opengl? ( ${qtopengldepend} )"
+ ;;
+ *)
+ OPENGL_REQUIRED="never"
+ ;;
+ esac
+
+ COMMONDEPEND="${COMMONDEPEND} ${qtdepend}"
+}
+kde4-base_set_qt_dependencies
+
+# Set the cmake dependencies
+# Quite a few packages fail with cmake-2.4 even for KDE 4.1, so we just require 2.6.2
+CMAKEDEPEND=">=dev-util/cmake-2.6.2"
+
+# Set the common dependencies
+DEPEND="${DEPEND} ${COMMONDEPEND} ${CMAKEDEPEND}
+ dev-util/pkgconfig
+ x11-libs/libXt
+ x11-proto/xf86vidmodeproto"
+RDEPEND="${RDEPEND} ${COMMONDEPEND}"
+
+if [[ $BUILD_TYPE = live ]]; then
+ # Disable tests for live ebuilds
+ RESTRICT="${RESTRICT} test"
+ # Live ebuilds in kde-base default to kdeprefix by default
+ IUSE="${IUSE} +kdeprefix"
+else
+ # All other ebuild types default to -kdeprefix as before
+ IUSE="${IUSE} kdeprefix"
+fi
+
+# @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: 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}"
+
+case ${CPPUNIT_REQUIRED} in
+ always)
+ DEPEND="${DEPEND} dev-util/cppunit"
+ ;;
+ optional)
+ IUSE="${IUSE} test"
+ DEPEND="${DEPEND}
+ test? ( dev-util/cppunit )"
+ ;;
+ *)
+ CPPUNIT_REQUIRED="never"
+ ;;
+esac
+
+# @ECLASS-VARIABLE: NEED_KDE
+# @DESCRIPTION:
+# This variable sets the version of KDE4 which will be used by the eclass.
+# For kde-base packages, if it is not set by the ebuild,
+# it's assumed that the required KDE4 version is the latest available.
+# For non kde-base packages, it is also set to the latest by default.
+#
+# For more precise adjustments or for specifying particular kde version,
+# KDE_MINIMAL variable can be used.
+#
+# @CODE
+# Acceptable values are:
+# - latest - Use latest version in the portage tree
+# Default for kde-base ebuilds.
+# - live - Use live release (live ebuilds)
+# - none - Let the ebuild handle SLOT, kde dependencies, KDEDIR, ...
+# - 4.2, 4.1, kde-4 - respective slots for kde versions
+# @CODE
+# Note: default NEED_KDE is latest
+NEED_KDE="${NEED_KDE:=latest}"
+export NEED_KDE
+
+# @ECLASS-VARIABLE: KDE_MINIMAL
+# @DESCRIPTION:
+# This wariable is used when NEED_KDE="latest" is set, to specify the
+# required KDE minimal version for which apps will work.
+# @CODE
+# KDE_MINIMAL="-4.1"
+# @CODE
+# Note: default minimal version is kde-4.1, which means that the apps will work
+# with any KDE version >=${KDE_MINIMAL}
+KDE_MINIMAL="${KDE_MINIMAL:=4.1}"
+export KDE_MINIMAL
+
+# FIXME: the code section, explanation of live. The last sentence needs other
+# formulation too.
+#
+# @ECLASS-VARIABLE: KDE_WANTED
+# @DESCRIPTION:
+# When NEED_KDE=latest is inherited, KDE_WANTED serves to indicate the prefered kde
+# version. It's value is looked for before any other. Useful when having more
+# +kdeprefix installs: you can choose which kde version, if present, to link
+# against.
+#
+# @CODE
+# Acceptable values are:
+# stable = whatever is main tree (now 4.1)
+# testing = whatever is in testing on main tree
+# snapshot = whatever is released under snapshots (4.2 at present)
+# live = live svn ebuilds, also default value, do not be scared it goes in this
+#
+# order: live->snapshot->testing->stable, when searching for kde. This way we
+# allow users to use just kde4snapshots and use software from the tree.
+KDE_WANTED="${KDE_WANTED:=live}"
+export KDE_WANTED
+
+case ${NEED_KDE} in
+ latest)
+ if [[ $KDEBASE = kde-base ]]; then
+ case ${PV} in
+ 4.3* | 4.2.9* | 4.2.8* | 4.2.7* | 4.2.6*)
+ _kdedir="4.3"
+ _pv="-${PV}:4.3"
+ _pvn="-${PV}"
+ ;;
+ 4.2* | 4.1.9* | 4.1.8* | 4.1.7* | 4.1.6*)
+ _kdedir="4.2"
+ _pv="-${PV}:4.2"
+ _pvn="-${PV}"
+ ;;
+ 4.1*| 4.0.9* | 4.0.8*)
+ _kdedir="4.1"
+ _pv="-${PV}:4.1"
+ _pvn="-${PV}"
+ ;;
+ 4.0*)
+ _kdedir="4.0"
+ _pv="-${PV}:kde-4"
+ _pvn="-${PV}"
+ ;;
+ 3.9*)
+ _kdedir="3.9"
+ _pv="-${PV}:kde-4"
+ _pvn="-${PV}"
+ ;;
+ 9999*)
+ _kdedir="live"
+ _pv="-${PV}:live"
+ _pvn="-${PV}"
+ ;;
+ *)
+ die "NEED_KDE=latest not supported for PV=${PV}" ;;
+ esac
+ _operator=">="
+ else
+ # this creates dependency on any version of kde4
+ _operator=">="
+ _pv="-${KDE_MINIMAL}"
+ _pvn=${_pv}
+ fi
+ ;;
+
+ # NEED_KDE="${PV}"
+ scm|svn|live|9999*)
+ _kdedir="live"
+ _operator=">="
+ _pv="-${NEED_KDE}:live"
+ _pvn="-${NEED_KDE}"
+ export NEED_KDE="live"
+ ;;
+ 4.3 | 4.2.9* | 4.2.8* | 4.2.7* | 4.2.6*)
+ _kdedir="4.3"
+ _pv="-${NEED_KDE}:4.3"
+ _pvn="-${NEED_KDE}"
+ _operator=">="
+ ;;
+ 4.2 | 4.1.9* | 4.1.8* | 4.1.7* | 4.1.6*)
+ _kdedir="4.2"
+ _pv="-${NEED_KDE}:4.2"
+ _pvn="-${NEED_KDE}"
+ _operator=">="
+ ;;
+ 4.1 | 4.0.9* | 4.0.8*)
+ _kdedir="4.1"
+ _pv="-${NEED_KDE}:4.1"
+ _pvn="-${NEED_KDE}"
+ _operator=">="
+ ;;
+ 4.0* | 4)
+ _kdedir="4.0"
+ _operator=">="
+ _pv="-${NEED_KDE}:kde-4"
+ _pvn="-${NEED_KDE}"
+ ;;
+ 3.9*)
+ _kdedir="3.9"
+ _operator=">="
+ _pv="-${NEED_KDE}:kde-4"
+ _pvn="-${NEED_KDE}"
+ ;;
+
+ # The ebuild handles dependencies, KDEDIR, SLOT.
+ none)
+ :
+ ;;
+
+ *)
+ die "NEED_KDE=${NEED_KDE} currently not supported."
+ ;;
+esac
+
+if [[ ${NEED_KDE} != none ]]; then
+
+ #Set the SLOT
+ if [[ -n ${KDEBASE} ]]; then
+ if [[ ${NEED_KDE} = live ]]; then
+ SLOT="live"
+ else
+ case ${KMNAME} in
+ koffice)
+ case ${PV} in
+ 9999*) SLOT="live" ;;
+ *) SLOT="2" ;;
+ esac
+ ;;
+ kdevelop)
+ case ${PV} in
+ 9999*) SLOT="live" ;;
+ 4.0*|3.9*) SLOT="4" ;;
+ esac
+ ;;
+ kdevplatform)
+ case ${PV} in
+ 9999*) SLOT="live" ;;
+ 1.0*|0.9*) SLOT="1" ;;
+ esac
+ ;;
+ *)
+ case ${PV} in
+ 9999*) SLOT="live" ;;
+ 4.3* | 4.2.9* | 4.2.8* | 4.2.7* | 4.2.6*) SLOT="4.3" ;;
+ 4.2* | 4.1.9* | 4.1.8* | 4.1.7* | 4.1.6*) SLOT="4.2" ;;
+ 4.1* | 4.0.9* | 4.0.8*) SLOT="4.1" ;;
+ *) SLOT="4.1" ;;
+ esac
+ ;;
+ esac
+ fi
+ fi
+
+ # Block installation of other SLOTS unless kdeprefix
+ for KDE_SLOT in ${KDE_SLOTS[@]}; do
+ # block non kdeprefix ${PN} on other slots
+ # we do this only if we do not depend on any version of kde
+ if [[ ${SLOT} != ${KDE_SLOT} ]]; then
+ DEPEND="${DEPEND}
+ !kdeprefix? ( !kde-base/${PN}:${KDE_SLOT}[-kdeprefix] )"
+ RDEPEND="${RDEPEND}
+ !kdeprefix? ( !kde-base/${PN}:${KDE_SLOT}[-kdeprefix] )"
+ fi
+ done
+
+ # Adding kdelibs, kdepimlibs and kdebase-data deps to all other packages.
+ # We only need to add the dependencies if ${PN} is not "kdelibs" or "kdepimlibs"
+ if [[ ${PN} != kdelibs ]]; then
+ DEPEND="${DEPEND}
+ kdeprefix? ( ${_operator}kde-base/kdelibs${_pv}[kdeprefix] )
+ !kdeprefix? ( ${_operator}kde-base/kdelibs${_pvn}[-kdeprefix] )"
+ RDEPEND="${RDEPEND}
+ kdeprefix? ( ${_operator}kde-base/kdelibs${_pv}[kdeprefix] )
+ !kdeprefix? ( ${_operator}kde-base/kdelibs${_pvn}[-kdeprefix] )"
+ if [[ ${PN} != kdepimlibs ]]; then
+ DEPEND="${DEPEND}
+ kdeprefix? ( ${_operator}kde-base/kdepimlibs${_pv}[kdeprefix] )
+ !kdeprefix? ( ${_operator}kde-base/kdepimlibs${_pvn}[-kdeprefix] )"
+ RDEPEND="${RDEPEND}
+ kdeprefix? ( ${_operator}kde-base/kdepimlibs${_pv}[kdeprefix] )
+ !kdeprefix? ( ${_operator}kde-base/kdepimlibs${_pvn}[-kdeprefix] )"
+ if [[ ${PN} != kdebase-data ]]; then
+ RDEPEND="${RDEPEND}
+ kdeprefix? ( ${_operator}kde-base/kdebase-data${_pv}[kdeprefix] )
+ !kdeprefix? ( ${_operator}kde-base/kdebase-data${_pvn}[-kdeprefix] )"
+ fi
+ fi
+ fi
+ unset _operator _pv _pvn
+fi
+
+# Fetch section - If the ebuild's category is not 'kde-base' and if it is not a
+# koffice ebuild, the URI should be set in the ebuild itself
+case ${SLOT} in
+ live)
+ SRC_URI=""
+ ESVN_MIRROR=${ESVN_MIRROR:=svn://anonsvn.kde.org/home/kde}
+ # Split ebuild, or extragear stuff
+ if [[ -n ${KMNAME} ]]; then
+ ESVN_PROJECT="${KMNAME}"
+ if [[ -z ${KMNOMODULE} && -z ${KMMODULE} ]]; then
+ KMMODULE="${PN}"
+ fi
+ # Split kde-base/ ebuilds: (they reside in trunk/KDE)
+ case ${KMNAME} in
+ kdebase-*)
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/KDE/kdebase/${KMNAME#kdebase-}"
+ ;;
+ kdereview)
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}/${KMMODULE}"
+ ;;
+ kde*)
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/KDE/${KMNAME}"
+ ;;
+ extragear*|playground*)
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}/${KMMODULE}"
+ ;;
+ koffice)
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}"
+ ;;
+ *)
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}/${KMMODULE}"
+ ;;
+ esac
+ else
+ # kdelibs, kdepimlibs
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/KDE/${PN}"
+ ESVN_PROJECT="${PN}"
+ fi
+ # limit syncing to 1 hour.
+ ESVN_UP_FREQ=${ESVN_UP_FREQ:-1}
+ ;;
+ *)
+ if [[ -n ${KDEBASE} ]]; then
+ if [[ -n ${KMNAME} ]]; then
+ case ${KMNAME} in
+ kdebase-apps)
+ _kmname="kdebase" ;;
+ *)
+ _kmname=${KMNAME} ;;
+ esac
+ else
+ _kmname=${PN}
+ fi
+ _kmname_pv="${_kmname}-${PV}"
+ if [[ $NEED_KDE != live ]]; then
+ case ${KDEBASE} in
+ kde-base)
+ case ${PV} in
+ 4.2.60)
+ SRC_URI="mirror://kde/unstable/${PV}/src/${_kmname_pv}.svn912032tar.bz2" ;;
+ 4.2.61)
+ SRC_URI="mirror://kde/unstable/${PV}/src/${_kmname_pv}.svn917530.tar.bz2" ;;
+ 4.1.9* | 4.1.8* | 4.1.7* | 4.1.6* | 4.0.9* | 4.0.8*)
+ SRC_URI="mirror://kde/unstable/${PV}/src/${_kmname_pv}.tar.bz2" ;;
+ *) SRC_URI="mirror://kde/stable/${PV}/src/${_kmname_pv}.tar.bz2" ;;
+ esac
+ ;;
+ koffice)
+ SRC_URI="mirror://kde/unstable/${_kmname_pv}/src/${_kmname_pv}.tar.bz2"
+ ;;
+ esac
+ fi
+ unset _kmname _kmname_pv
+ fi
+ ;;
+esac
+
+debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SRC_URI is ${SRC_URI}"
+
+# @ECLASS-VARIABLE: PREFIX
+# @DESCRIPTION:
+# Set the installation PREFIX. All kde-base ebuilds go into the KDE4 installation directory.
+# Applications installed by the other ebuilds go into ${KDEDIR} by default, this value
+# can be superseded by defining PREFIX before inheriting kde4-base.
+# This value is set on pkg_setup
+PREFIX=""
+
+debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SLOT ${SLOT} - NEED_KDE ${NEED_KDE}"
+
+# @FUNCTION: kde4-base_pkg_setup
+# @DESCRIPTION:
+# Adds flags needed by all of KDE 4 to $QT4_BUILT_WITH_USE_CHECK. Uses
+# kde4-functions_check_use from kde4-functions.eclass to print appropriate
+# errors and die if any required flags listed in $QT4_BUILT_WITH_USE_CHECK or
+# $KDE4_BUILT_WITH_USE_CHECK are missing.
+kde4-base_pkg_setup() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # Don't set KDEHOME during compile, it will cause access violations
+ unset KDEHOME
+
+ # Search for best suitable kde installation for misc kde package.
+ # Computation based on NEED_KDE and KDE_MINIMAL
+ get_latest_kdedir
+
+ if [[ ${NEED_KDE} != none ]]; then
+ # Set PREFIX
+ if use kdeprefix; then
+ KDEDIR="/usr/kde/${_kdedir}"
+ KDEDIRS="/usr/local/:/usr:${KDEDIR}"
+ else
+ KDEDIR="/usr"
+ KDEDIRS="/usr/local/:/usr"
+ fi
+ fi
+ # Set the prefix based on KDEDIR
+ # Make it a consequence of kdeprefix
+ PREFIX=${KDEDIR}
+
+ unset _kdedir
+
+ # check if qt has correct deps
+ [[ -n ${QT4_BUILT_WITH_USE_CHECK} || -n ${KDE4_BUILT_WITH_USE_CHECK[@]} ]] && \
+ die "built_with_use illegal in this EAPI!"
+
+ if [[ ${BUILD_TYPE} = live && -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then
+ echo
+ elog "WARNING! This is an experimental live ebuild of ${KMNAME:-${PN}}"
+ elog "Use it at your own risk."
+ elog "Do _NOT_ file bugs at bugs.gentoo.org because of this ebuild!"
+ echo
+ fi
+}
+
+# @FUNCTION: kde4-base_src_unpack
+# @DESCRIPTION:
+# This function unpacks the source tarballs for KDE4 applications.
+kde4-base_src_unpack() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if [[ ${BUILD_TYPE} = live ]]; then
+ migrate_store_dir
+ subversion_src_unpack
+ else
+ unpack "${A}" || die "Unpack ${A} failed"
+ # Detect real toplevel dir - issue with unstable snapshots
+ local topleveldir=`basename ${SRC_URI%.tar.*}`
+ if [[ "${topleveldir}" != "${P}" ]]; then
+ mv "${topleveldir}" "${P}" || die "Died while moving \"${topleveldir}\" to \"${P}\""
+ fi
+ fi
+}
+
+# @FUNCTION: kde4-base_src_compile
+# @DESCRIPTION:
+# General pre-configure and pre-compile function for KDE4 applications.
+# It also handles translations if KDE_LINGUAS is defined. See KDE_LINGUAS and
+# enable_selected_linguas() in kde4-functions.eclass(5) for further details.
+kde4-base_src_prepare() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # Only enable selected languages, used for KDE extragear apps.
+ if [[ -n ${KDE_LINGUAS} ]]; then
+ enable_selected_linguas
+ fi
+
+ # Autopatch
+ base_src_prepare
+
+ # Save library dependencies
+ if [[ -n ${KMSAVELIBS} ]] ; then
+ save_library_dependencies
+ fi
+
+ # Inject library dependencies
+ if [[ -n ${KMLOADLIBS} ]] ; then
+ load_library_dependencies
+ fi
+}
+
+# @FUNCTION: kde4-base_src_configure
+# @DESCRIPTION:
+# Function for configuring the build of KDE4 applications.
+kde4-base_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # We prefer KDE's own Debugfull mode over the standard Debug
+ if has debug ${IUSE//+} && use debug ; then
+ ebegin "Enabling debug flag"
+ mycmakeargs="${mycmakeargs} -DCMAKE_BUILD_TYPE=Debugfull"
+ eend $?
+ fi
+
+ # Enable generation of HTML handbook
+ if has htmlhandbook ${IUSE//+} && use htmlhandbook; then
+ ebegin "Enabling building of HTML handbook"
+ mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_HTMLHANDBOOK=ON"
+ eend $?
+ fi
+
+ # Build tests in src_test only, where we override this value
+ mycmakeargs="${mycmakeargs} -DKDE4_BUILD_TESTS=OFF"
+
+ # Set distribution name
+ [[ ${PN} = kdelibs ]] && mycmakeargs="${mycmakeargs} -DKDE_DISTRIBUTION_TEXT=Gentoo"
+
+ # runpath linking
+ mycmakeargs="${mycmakeargs} -DKDE4_USE_ALWAYS_FULL_RPATH=ON"
+
+ # Here we set the install prefix
+ mycmakeargs="${mycmakeargs} -DCMAKE_INSTALL_PREFIX=${PREFIX}"
+
+ # If prefix is /usr, sysconf needs to be /etc, not /usr/etc
+ use kdeprefix || mycmakeargs="${mycmakeargs} -DSYSCONF_INSTALL_DIR=/etc"
+
+ # Set environment
+ QTEST_COLORED=1
+ QT_PLUGIN_PATH="${KDEDIR}/$(get_libdir)/kde4/plugins/"
+
+ # hardcode path to *.cmake KDE files
+ export PKG_CONFIG_PATH="${PKG_CONFIG_PATH:+${PKG_CONFIG_PATH}:}${KDEDIR}/$(get_libdir)/pkgconfig"
+
+ # additonal arguments for KOFFICE
+ if [[ ${KMNAME} = koffice ]]; then
+ case ${PN} in
+ koffice-data) : ;;
+ *)
+ mycmakeargs="${mycmakeargs}
+ -DWITH_OpenEXR=ON
+ $(cmake-utils_use_with crypt QCA2)
+ $(cmake-utils_use_with opengl OpenGL)"
+ if use crypt; then
+ mycmakeargs="${mycmakeargs}
+ -DQCA2_LIBRARIES=/usr/$(get_libdir)/qca2/libqca.so.2"
+ fi
+ ;;
+ esac
+ fi
+
+ [ -e CMakeLists.txt ] && cmake-utils_src_configure
+}
+
+# @FUNCTION: kde4-base_src_compile
+# @DESCRIPTION:
+# General function for compiling KDE4 applications.
+kde4-base_src_compile() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ kde4-base_src_make
+}
+
+# @FUNCTION: kde4-base_src_make
+# @DESCRIPTION:
+# Function for building KDE4 applications.
+# Options are passed to cmake-utils_src_make.
+kde4-base_src_make() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if [[ -d "$WORKDIR/${PN}_build" ]]; then
+ pushd "${WORKDIR}/${PN}_build" > /dev/null
+ fi
+ [ -e [Mm]akefile ] && cmake-utils_src_make "$@"
+}
+
+# @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="${mycmakeargs} -DKDE4_BUILD_TESTS=ON"
+ cmake-utils_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} "$@"
+
+ if [[ -n ${KMSAVELIBS} ]] ; then
+ install_library_dependencies
+ fi
+
+ kde4-base_src_make_doc
+ if [[ -d "$WORKDIR/${PN}_build" ]]; then
+ pushd "${WORKDIR}/${PN}_build" > /dev/null
+ fi
+ [ -e [Mm]akefile ] && cmake-utils_src_install
+}
+
+# @FUNCTION: kde4-base_src_make_doc
+# @DESCRIPTION:
+# Function for installing the documentation of KDE4 applications.
+kde4-base_src_make_doc() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local doc
+ for doc in AUTHORS ChangeLog* README* NEWS TODO; do
+ [[ -s ${doc} ]] && dodoc ${doc}
+ done
+
+ if [[ -z ${KMNAME} ]]; then
+ for doc in {apps,runtime,workspace,.}/*/{AUTHORS,README*}; do
+ if [[ -s ${doc} ]]; then
+ local doc_complete=${doc}
+ doc="${doc#*/}"
+ newdoc "$doc_complete" "${doc%/*}.${doc##*/}"
+ fi
+ done
+ fi
+
+ if [[ -n ${KDEBASE} && -d "${D}/usr/share/doc/${PF}" ]]; then
+ # work around bug #97196
+ dodir /usr/share/doc/kde && \
+ mv "${D}/usr/share/doc/${PF}" "${D}"/usr/share/doc/kde/ || \
+ die "Failed to move docs to kde/ failed."
+ fi
+}
+
+# @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
+}
+
+# @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
+}
diff --git a/eclass/kde4-meta.eclass b/eclass/kde4-meta.eclass
new file mode 100644
index 00000000000..dbc02d63ca1
--- /dev/null
+++ b/eclass/kde4-meta.eclass
@@ -0,0 +1,664 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+#
+# @ECLASS: kde4-meta.eclass
+# @MAINTAINER:
+# kde@gentoo.org
+# @BLURB: Eclass for writing "split" KDE packages.
+# @DESCRIPTION:
+# This eclass provides all necessary functions for writing split KDE ebuilds.
+#
+# You must define KMNAME to use this eclass, and do so before inheriting it. All other variables are optional.
+# Do not include the same item in more than one of KMMODULE, KMMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY.
+
+# we want opengl optional in each koffice package
+if [[ ${KMNAME} = koffice ]]; then
+ case ${PN} in
+ koffice-data)
+ ;;
+ *)
+ OPENGL_REQUIRED=optional
+ ;;
+ esac
+fi
+
+inherit kde4-base versionator
+
+EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm
+
+if [[ -z ${KMNAME} ]]; then
+ die "kde4-meta.eclass inherited but KMNAME not defined - broken ebuild"
+fi
+
+case ${KDEBASE} in
+ kde-base)
+ HOMEPAGE="http://www.kde.org/"
+ LICENSE="GPL-2"
+ ;;
+ koffice)
+ HOMEPAGE="http://www.koffice.org/"
+ LICENSE="GPL-2"
+ ;;
+esac
+
+# Add dependencies that all packages in a certain module share.
+case ${KMNAME} in
+ kdebase|kdebase-workspace|kdebase-runtime)
+ DEPEND="${DEPEND} >=kde-base/qimageblitz-0.0.4"
+ RDEPEND="${RDEPEND} >=kde-base/qimageblitz-0.0.4"
+ ;;
+ kdepim)
+ DEPEND="${DEPEND} dev-libs/boost app-office/akonadi-server"
+ RDEPEND="${RDEPEND} dev-libs/boost"
+ if [[ ${PN} != kode ]]; then
+ DEPEND="${DEPEND} >=kde-base/kode-${PV}:${SLOT}"
+ RDEPEND="${RDEPEND} >=kde-base/kode-${PV}:${SLOT}"
+ fi
+ case ${PN} in
+ akregator|kaddressbook|kjots|kmail|kmobiletools|knode|knotes|korganizer|ktimetracker)
+ IUSE="+kontact"
+ DEPEND="${DEPEND} kontact? ( >=kde-base/kontactinterfaces-${PV}:${SLOT} )"
+ RDEPEND="${RDEPEND} kontact? ( >=kde-base/kontactinterfaces-${PV}:${SLOT} )"
+ ;;
+ esac
+ ;;
+ kdegames)
+ if [[ ${PN} != libkdegames ]]; then
+ DEPEND="${DEPEND} >=kde-base/libkdegames-${PV}:${SLOT}"
+ RDEPEND="${RDEPEND} >=kde-base/libkdegames-${PV}:${SLOT}"
+ fi
+ ;;
+ koffice)
+ case ${PV} in
+ 9999*) DEPEND="${DEPEND} !app-office/${PN}:2" ;;
+ 1.9*|2*) DEPEND="${DEPEND} !app-office/${PN}:live" ;;
+ esac
+ DEPEND="${DEPEND}
+ !app-office/${PN}:0
+ !app-office/koffice:0
+ !app-office/koffice-meta:0"
+ case ${PN} in
+ koffice-data)
+ DEPEND="${DEPEND} media-libs/lcms"
+ RDEPEND="${RDEPEND} media-libs/lcms"
+ ;;
+ *)
+ IUSE="+crypt"
+ DEPEND="${DEPEND} crypt? ( >=app-crypt/qca-2 )"
+ RDEPEND="${RDEPEND} crypt? ( >=app-crypt/qca-2 )"
+ if [[ $PN != koffice-libs ]]; then
+ DEPEND="${DEPEND} >=app-office/koffice-libs-${PV}:${SLOT}"
+ RDEPEND="${RDEPEND} >=app-office/koffice-libs-${PV}:${SLOT}"
+ fi
+ ;;
+ esac
+ ;;
+esac
+
+debug-print "line ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - after metapackage-specific dependencies"
+debug-print "line ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - after metapackage-specific dependencies"
+
+# Useful to build kde4-meta style stuff from extragear/playground (plasmoids etc)
+case ${SLOT} in
+ live)
+ case ${KMNAME} in
+ extragear*|playground*)
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}"
+ ;;
+ esac
+ ;;
+esac
+
+# @ECLASS-VARIABLE: KMNAME
+# @DESCRIPTION:
+# Name of the parent-module (e.g. kdebase, kdepim, ...). You _must_ set it
+# _before_ inheriting this eclass, (unlike the other parameters), since it's
+# used to set $SRC_URI.
+
+# @ECLASS-VARIABLE: KMMODULE
+# @DESCRIPTION:
+# Specify exactly one subdirectory of $KMNAME here. Defaults to $PN.
+# The subdirectory listed here is treated exactly like items in $KMEXTRA.
+#
+# Example: The ebuild name of "kdebase/l10n" is kde-base/kdebase-l10n, because
+# just 'l10n' would be too confusing. Hence it sets KMMODULE="l10n".
+
+# @ECLASS-VARIABLE: KMNOMODULE
+# @DESCRIPTION:
+# If set to "true", $KMMODULE doesn't have to be defined.
+#
+# Example usage: If you're installing subdirectories of a package, like plugins,
+# you mark the top subdirectory (containing the package) as $KMEXTRACTONLY, and
+# set KMNOMODULE="true".
+if [[ -z ${KMMODULE} && ${KMNOMODULE} != true ]]; then
+ KMMODULE=${PN}
+fi
+
+# @ECLASS-VARIABLE: KMEXTRA
+# @DESCRIPTION:
+# All subdirectories listed here will be extracted, compiled & installed.
+# $KMMODULE is always added to $KMEXTRA.
+# If the htmlhandbook USE-flag is set, and if this directory exists,
+# then "doc/$KMMODULE" is added to $KMEXTRA. In other cases, this should be
+# handled in the ebuild.
+# If the documentation is in a different subdirectory, you should add it to KMEXTRA.
+
+# @ECLASS-VARIABLE: KMCOMPILEONLY
+# @DESCRIPTION:
+# All subdirectories listed here will be extracted & compiled, but not installed.
+
+# TODO: better formulation may be needed
+# @ECLASS-VARIABLE: KMEXTRACTONLY
+# @DESCRIPTION:
+# All subdirectories listed here will be extracted, but neither compiled nor installed.
+# This can be used to avoid compilation in a subdirectory of a directory in $KMMODULE or $KMEXTRA
+
+# @ECLASS-VARIABLE: KMTARPARAMS
+# @DESCRIPTION:
+# Specify extra parameters to pass to tar, in kde4-meta_src_extract.
+# '-xpf -j' are passed to tar by default.
+
+# @FUNCTION: kde4-meta_pkg_setup
+# @DESCRIPTION:
+# Currently just calls its equivalent in kde4-base.eclass(5). Use this one in
+# split ebuilds.
+kde4-meta_pkg_setup() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ kde4-base_pkg_setup
+}
+
+# @FUNCTION: kde4-meta_src_unpack
+# @DESCRIPTION:
+# This function unpacks the source for split ebuilds. See also
+# kde4-meta-src_extract.
+kde4-meta_src_unpack() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if [[ ${BUILD_TYPE} = live ]]; then
+ migrate_store_dir
+ S="${WORKDIR}/${PN}-${PV}"
+ mkdir -p "${S}"
+ ESVN_RESTRICT="export" subversion_src_unpack
+ subversion_wc_info
+ subversion_bootstrap
+ kde4-meta_src_extract
+ else
+ kde4-meta_src_extract
+ fi
+}
+
+# FIXME: the difference between kde4-meta_src_extract and kde4-meta_src_unpack?
+
+# @FUNCTION: kde4-meta_src_extract
+# @DESCRIPTION:
+# A function to unpack the source for a split KDE ebuild.
+# Also see KMMODULE, KMNOMODULE, KMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY and
+# KMTARPARAMS.
+kde4-meta_src_extract() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if [[ ${BUILD_TYPE} = live ]]; then
+ local rsync_options subdir kmnamedir targetdir
+ # Export working copy to ${S}
+ einfo "Exporting parts of working copy to ${S}"
+ kde4-meta_create_extractlists
+
+ rsync_options="--group --links --owner --perms --quiet --exclude=.svn/"
+
+ # Copy ${KMNAME} non-recursively (toplevel files)
+ rsync ${rsync_options} "${ESVN_WC_PATH}"/${kmnamedir}* "${S}" \
+ || die "${ESVN}: can't export toplevel files to '${S}'."
+ # Copy cmake directory
+ if [[ -d "${ESVN_WC_PATH}/${kmnamedir}cmake" ]]; then
+ rsync --recursive ${rsync_options} "${ESVN_WC_PATH}/${kmnamedir}cmake" "${S}" \
+ || die "${ESVN}: can't export cmake files to '${S}'."
+ fi
+ # Copy all subdirectories
+ for subdir in $(__list_needed_subdirectories); do
+ targetdir=""
+ if [[ $subdir = doc/* && ! -e "$ESVN_WC_PATH/$kmnamedir$subdir" ]]; then
+ continue
+ fi
+
+ [[ ${subdir%/} = */* ]] && targetdir=${subdir%/} && targetdir=${targetdir%/*} && mkdir -p "${S}/${targetdir}"
+ rsync --recursive ${rsync_options} "${ESVN_WC_PATH}/${kmnamedir}${subdir%/}" "${S}/${targetdir}" \
+ || die "${ESVN}: can't export subdirectory '${subdir}' to '${S}/${targetdir}'."
+ done
+
+ if [[ ${KMNAME} = kdebase-runtime && ${PN} != kdebase-data ]]; then
+ sed -i -e '/^install(PROGRAMS[[:space:]]*[^[:space:]]*\/kde4[[:space:]]/s/^/#DONOTINSTALL /' \
+ "${S}"/CMakeLists.txt || die "Sed to exclude bin/kde4 failed"
+ fi
+ else
+ local abort tarfile f extractlist topleveldir moduleprefix
+ tarfile="${DISTDIR}/${A}"
+
+ # Detect real toplevel dir - issue with unstable snapshots
+ # It will be used in __list_needed_subdirectories
+ topleveldir=`basename ${SRC_URI%.tar.*}`/
+
+ ebegin "Unpacking parts of ${A} to ${WORKDIR}"
+
+ kde4-meta_create_extractlists
+
+ # Go one level deeper for kdebase-apps in tarballs (releases)
+ if [[ ${KMNAME} == kdebase-apps && ${BUILD_TYPE} == release ]]; then
+ moduleprefix=apps/
+ KMTARPARAMS="${KMTARPARAMS} --transform=s|apps/||"
+ fi
+
+ for f in cmake/ CMakeLists.txt ConfigureChecks.cmake config.h.cmake \
+ AUTHORS COPYING INSTALL README NEWS ChangeLog
+ do
+ extractlist="${extractlist} ${topleveldir}${moduleprefix}${f}"
+ done
+ extractlist="${extractlist} $(__list_needed_subdirectories)"
+ KMTARPARAMS="${KMTARPARAMS} -j"
+
+ pushd "${WORKDIR}" > /dev/null
+ [[ -n ${KDE4_STRICTER} ]] && echo tar -xpf "${tarfile}" ${KMTARPARAMS} ${extractlist} >&2
+ tar -xpf "${tarfile}" ${KMTARPARAMS} ${extractlist} 2> /dev/null
+
+ # Default $S is based on $P; rename the extracted directory to match $S if necessary
+ if [[ "${topleveldir}" != "${P}" ]]; then
+ mv "${topleveldir}" "${P}" || die "Died while moving \"${topleveldir}\" to \"${P}\""
+ fi
+
+ popd > /dev/null
+
+ eend $?
+
+ # We need to clear it here to make verification below work
+ unset moduleprefix
+
+ if [[ -n ${KDE4_STRICTER} ]]; then
+ for f in $(__list_needed_subdirectories fatal); do
+ if [[ ! -e "${S}/${f#*/}" ]]; then
+ eerror "'${f#*/}' is missing"
+ abort=true
+ fi
+ done
+ [[ -n ${abort} ]] && die "There were missing files."
+ fi
+ fi
+ # fix koffice linking
+ if [[ ${KMNAME} = koffice ]]; then
+ koffice_fix_libraries
+ fi
+}
+
+# @FUNCTION: kde4-meta_create_extractlists
+# @DESCRIPTION:
+# Create lists of files and subdirectories to extract.
+# Also see descriptions of KMMODULE, KMNOMODULE, KMEXTRA, KMCOMPILEONLY,
+# KMEXTRACTONLY and KMTARPARAMS.
+kde4-meta_create_extractlists() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if has htmlhandbook ${IUSE//+} && use htmlhandbook; then
+ # We use the basename of $KMMODULE because $KMMODULE can contain
+ # the path to the module subdirectory.
+ KMEXTRA_NONFATAL="${KMEXTRA_NONFATAL} doc/${KMMODULE##*/}"
+ fi
+
+ # Add some CMake-files to KMEXTRACTONLY.
+ # Note that this actually doesn't include KMEXTRA handling.
+ # In those cases you should care to add the relevant files to KMEXTRACTONLY
+ case ${KMNAME} in
+ kdebase)
+ KMEXTRACTONLY="${KMEXTRACTONLY}
+ apps/config-apps.h.cmake
+ apps/ConfigureChecks.cmake"
+ ;;
+ kdebase-apps)
+ KMEXTRACTONLY="${KMEXTRACTONLY}
+ config-apps.h.cmake
+ ConfigureChecks.cmake"
+ ;;
+ kdebase-runtime)
+ KMEXTRACTONLY="${KMEXTRACTONLY}
+ config-runtime.h.cmake"
+ ;;
+ kdebase-workspace)
+ KMEXTRACTONLY="${KMEXTRACTONLY}
+ config-unix.h.cmake
+ ConfigureChecks.cmake
+ config-workspace.h.cmake
+ config-X11.h.cmake
+ startkde.cmake"
+ case ${SLOT} in
+ 4.2|4.3)
+ KMEXTRACTONLY="${KMEXTRACTONLY}
+ KDE4WorkspaceConfig.cmake.in"
+ ;;
+ *) : ;;
+ esac
+ ;;
+ kdegames)
+ if [[ ${PN} != libkdegames ]]; then
+ KMEXTRACTONLY="${KMEXTRACTONLY}
+ libkdegames"
+ fi
+ ;;
+ kdepim)
+ KMEXTRACTONLY="${KMEXTRACTONLY}
+ kleopatra/ConfigureChecks.cmake
+ libkdepim/kdepim_export.h"
+ if has kontact ${IUSE//+} && use kontact; then
+ KMEXTRA="${KMEXTRA} kontact/plugins/${PLUGINNAME:-${PN}}"
+ KMEXTRACTONLY="${KMEXTRACTONLY} kontactinterfaces/"
+ fi
+ ;;
+ koffice)
+ KMEXTRACTONLY="${KMEXTRACTONLY}
+ config-endian.h.cmake
+ filters/config-filters.h.cmake
+ config-openctl.h.cmake
+ config-openexr.h.cmake
+ config-opengl.h.cmake
+ config-prefix.h.cmake"
+ case ${PN} in
+ koffice-libs|koffice-data)
+ ;;
+ *)
+ # add basic extract for all packages
+ KMEXTRACTONLY="${KMEXTRACTONLY}
+ filters/
+ libs/
+ plugins/"
+ if [[ ${PN} != kplato ]]; then
+ KMEXTRA="${KMEXTRA} filters/${PN}"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ # Don't install cmake modules for split ebuilds, to avoid collisions.
+ case ${KMNAME} in
+ kdebase-runtime|kdebase-workspace|kdeedu|kdegames|kdegraphics|kdepim)
+ case ${PN} in
+ libkdegames|libkdeedu|marble|libkworkspace)
+ KMEXTRA="${KMEXTRA}
+ cmake/modules/"
+ ;;
+ *)
+ KMCOMPILEONLY="${KMCOMPILEONLY}
+ cmake/modules/"
+ ;;
+ esac
+ ;;
+ esac
+
+ debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME}: KMEXTRACTONLY ${KMEXTRACTONLY}"
+}
+
+__list_needed_subdirectories() {
+ local i j kmextra kmextra_expanded kmmodule_expanded kmcompileonly_expanded extractlist topdir
+
+ # We expand KMEXTRA by adding CMakeLists.txt files
+ kmextra="${KMEXTRA}"
+ [[ ${1} != fatal ]] && kmextra="${kmextra} ${KMEXTRA_NONFATAL}"
+ for i in ${kmextra}; do
+ kmextra_expanded="${kmextra_expanded} ${i}"
+ j=$(dirname ${i})
+ while [[ ${j} != "." ]]; do
+ kmextra_expanded="${kmextra_expanded} ${j}/CMakeLists.txt";
+ j=$(dirname ${j})
+ done
+ done
+
+ # Expand KMMODULE
+ if [[ -n ${KMMODULE} ]]; then
+ kmmodule_expanded="${KMMODULE}"
+ j=$(dirname ${KMMODULE})
+ while [[ ${j} != "." ]]; do
+ kmmodule_expanded="${kmmodule_expanded} ${j}/CMakeLists.txt";
+ j=$(dirname ${j})
+ done
+ fi
+
+ # Expand KMCOMPILEONLY
+ for i in ${KMCOMPILEONLY}; do
+ kmcompileonly_expanded="${kmcompileonly_expanded} ${i}"
+ j=$(dirname ${i})
+ while [[ ${j} != "." ]]; do
+ kmcompileonly_expanded="${kmcompileonly_expanded} ${j}/CMakeLists.txt";
+ j=$(dirname ${j})
+ done
+ done
+
+ debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmextra_expanded: ${kmextra_expanded}"
+ debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmmodule_expanded: ${kmmodule_expanded}"
+ debug-print "line ${