summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eclass/kde4-base.eclass610
-rw-r--r--eclass/kde4-functions.eclass267
-rw-r--r--eclass/kde4-meta.eclass717
3 files changed, 1594 insertions, 0 deletions
diff --git a/eclass/kde4-base.eclass b/eclass/kde4-base.eclass
new file mode 100644
index 00000000000..2cd562575a4
--- /dev/null
+++ b/eclass/kde4-base.eclass
@@ -0,0 +1,610 @@
+# Copyright 2007-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-base.eclass,v 1.37 2009/05/09 13:23:15 scarabeus Exp $
+
+# @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 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
+
+# @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: 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}"
+
+# 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 wariable is used when KDE_REQUIRED is set, to specify required KDE minimal
+# version for apps to work. Currently defaults to 4.2
+# One may override this variable to raise version requirements.
+# For possible values look at KDE_SLOTS and KDE_LIVE_SLOTS variables.
+# Note that for kde-base packages is fixed to ${SLOT}.
+KDE_MINIMAL="${KDE_MINIMAL:-4.2}"
+
+# Fallback behaviour (for now)
+# TODO Remove when tree is clean
+if [[ -n ${NEED_KDE} ]]; then
+ case ${NEED_KDE} in
+ none)
+ KDE_REQUIRED="never"
+ ;;
+ *)
+ KDE_REQUIRED="always"
+ KDE_MINIMAL="${NEED_KDE}"
+ ;;
+ esac
+fi
+
+# OpenGL dependencies
+qtopengldepend="
+ x11-libs/qt-opengl:4
+"
+case ${OPENGL_REQUIRED} in
+ always)
+ COMMONDEPEND="${COMMONDEPEND} ${qtopengldepend}"
+ ;;
+ optional)
+ IUSE="${IUSE} opengl"
+ COMMONDEPEND="${COMMONDEPEND}
+ opengl? ( ${qtopengldepend} )
+ "
+ ;;
+ *) ;;
+esac
+unset qtopengldepend
+
+# WebKit dependencies
+qtwebkitdepend="
+ x11-libs/qt-webkit:4
+"
+case ${WEBKIT_REQUIRED} in
+ always)
+ COMMONDEPEND="${COMMONDEPEND} ${qtwebkitdepend}"
+ ;;
+ optional)
+ IUSE="${IUSE} webkit"
+ COMMONDEPEND="${COMMONDEPEND}
+ webkit? ( ${qtwebkitdepend} )
+ "
+ ;;
+ *) ;;
+esac
+unset qtwebkitdepend
+
+# CppUnit dependencies
+cppuintdepend="
+ dev-util/cppunit
+"
+case ${CPPUNIT_REQUIRED} in
+ always)
+ DEPEND="${DEPEND} ${cppuintdepend}"
+ ;;
+ optional)
+ IUSE="${IUSE} test"
+ DEPEND="${DEPEND}
+ test? ( ${cppuintdepend} )
+ "
+ ;;
+ *) ;;
+esac
+unset cppuintdepend
+
+# DEPRECATED block
+if [[ ${NEED_KDE} != "none" ]]; then
+ # localization deps
+ # DISABLED UNTIL PMS decide correct approach :(
+ if [[ -n ${KDE_LINGUAS} ]]; then
+ LNG_DEP=""
+ for _lng in ${KDE_LINGUAS}; do
+ # there must be or due to issue if lingua is not present in kde-l10n so
+ # it wont die but pick kde-l10n as-is.
+ LNG_DEP="${LNG_DEP}
+ || (
+ kde-base/kde-l10n[linguas_${_lng},kdeprefix=]
+ kde-base/kde-l10n[kdeprefix=]
+ )
+ "
+ done
+ fi
+fi # NEED_KDE != NONE block
+
+# Setup packages inheriting this eclass
+case ${KDEBASE} in
+
+ kde-base)
+ 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
+ # Determine SLOT from PVs
+ case ${PV} in
+ *.9999*) SLOT="${PV/.9999*/}" ;; # stable 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" ;;
+ 9999*) SLOT="live" ;; # regular live
+ *) die "Unsupported ${PV}" ;;
+ esac
+ _kdedir="${SLOT}"
+ _pv="-${PV}:${SLOT}"
+ _pvn="-${PV}"
+
+ # Block installation of other SLOTS unless kdeprefix
+ for slot in ${KDE_SLOTS[@]}; do
+ # Block non kdeprefix ${PN} on other slots
+ if [[ ${SLOT} != ${slot} ]]; then
+ RDEPEND="${RDEPEND}
+ !kdeprefix? ( !kde-base/${PN}:${slot}[-kdeprefix] )
+ "
+ fi
+ done
+ unset slot
+ ;;
+
+ koffice)
+ SLOT="2"
+ _pv="-${KDE_MINIMAL}"
+ _pvn="${_pv}"
+ ;;
+
+ *)
+ _pv="-${KDE_MINIMAL}"
+ _pvn="${_pv}"
+ ;;
+
+esac
+
+# KDE dependencies
+kdecommondepend="
+ dev-lang/perl
+ x11-libs/libXext
+ x11-libs/libXt
+ x11-libs/libXxf86vm
+ 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
+"
+if [[ ${PN} != kdelibs ]]; then
+ if [[ ${KDEBASE} = kde-base ]]; then
+ kdecommondepend="${kdecommondepend}
+ kdeprefix? ( >=kde-base/kdelibs${_pv}[kdeprefix] )
+ !kdeprefix? ( >=kde-base/kdelibs${_pvn}[-kdeprefix] )
+ "
+ else
+ kdecommondepend="${kdecommondepend}
+ >=kde-base/kdelibs${_pv}
+ "
+ fi
+fi
+unset _pv _pvn
+kdedepend="
+ dev-util/pkgconfig
+ >=sys-apps/sandbox-1.3.2
+"
+case ${KDE_REQUIRED} in
+ always)
+ COMMONDEPEND="${COMMONDEPEND} ${kdecommondepend}"
+ DEPEND="${DEPEND} ${kdedepend}"
+ ;;
+ optional)
+ IUSE="${IUSE} kde"
+ COMMONDEPEND="${COMMONDEPEND}
+ kde? ( ${kdecommondepend} )"
+ DEPEND="${DEPEND}
+ kde? ( ${kdedepend} )"
+ ;;
+ *) ;;
+esac
+unset kdecommondepend kdedepend
+
+debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: COMMONDEPEND is ${COMMONDEPEND}"
+debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND (only) is ${DEPEND}"
+debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: RDEPEND (only) is ${RDEPEND}"
+
+# Accumulate dependencies set by this eclass
+DEPEND="${DEPEND} ${COMMONDEPEND}"
+RDEPEND="${RDEPEND} ${COMMONDEPEND}"
+
+# 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 ${BUILD_TYPE} in
+ live)
+ # Determine branch URL based on live type
+ local branch_prefix
+ case ${PV} in
+ 9999*)
+ # trunk
+ branch_prefix="trunk/KDE"
+ ;;
+ *)
+ # branch
+ branch_prefix="branches/KDE/${SLOT}"
+ # @ECLASS-VARIABLE: ESVN_PROJECT_SUFFIX
+ # @DESCRIPTION
+ # Suffix appended to ESVN_PROJECT depending on fetched branch.
+ # Defaults is empty (for -9999 = trunk), and "-${PV}" otherwise.
+ ESVN_PROJECT_SUFFIX="-${PV}"
+ ;;
+ esac
+ SRC_URI=""
+ # @ECLASS-VARIABLE: ESVN_MIRROR
+ # @DESCRIPTION:
+ # This variable allows easy overriding of default kde mirror service
+ # (anonsvn) with anything else you might want to use.
+ ESVN_MIRROR=${ESVN_MIRROR:=svn://anonsvn.kde.org/home/kde}
+ # Split ebuild, or extragear stuff
+ if [[ -n ${KMNAME} ]]; then
+ ESVN_PROJECT="${KMNAME}${ESVN_PROJECT_SUFFIX}"
+ 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}/${branch_prefix}/kdebase/${KMNAME#kdebase-}"
+ ;;
+ kdereview)
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}/${KMMODULE}"
+ ;;
+ kdesupport)
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}/${KMMODULE}"
+ ESVN_PROJECT="${PN}${ESVN_PROJECT_SUFFIX}"
+ ;;
+ kde*)
+ ESVN_REPO_URI="${ESVN_MIRROR}/${branch_prefix}/${KMNAME}"
+ ;;
+ extragear*|playground*)
+ # Unpack them in toplevel dir, so that they won't conflict with kde4-meta
+ # build packages from same svn location.
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}/${KMMODULE}"
+ ESVN_PROJECT="${PN}${ESVN_PROJECT_SUFFIX}"
+ ;;
+ 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}/${branch_prefix}/${PN}"
+ ESVN_PROJECT="${PN}${ESVN_PROJECT_SUFFIX}"
+ 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.85)
+ # block for normally packed unstable releases
+ SRC_URI="mirror://kde/unstable/${PV}/src/${_kmname_pv}.tar.bz2" ;;
+ 4.2.9* | 4.2.8* | 4.2.7* | 4.2.6*)
+ SRC_URI="http://dev.gentooexperimental.org/~alexxy/kde/${PV}/${_kmname_pv}.tar.lzma" ;;
+ 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 for non kde-base applications. It defaults to /usr.
+# kde-base packages go into KDE4 installation directory (KDEDIR) by default.
+# No matter the PREFIX, package will be built agains KDE installed in KDEDIR.
+
+# @FUNCTION: kde4-base_pkg_setup
+# @DESCRIPTION:
+# Do the basic kdeprefix KDEDIR settings and determine with which kde should
+# optional applications link
+kde4-base_pkg_setup() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # QA ebuilds
+ case ${NEED_KDE} in
+ none) ewarn "QA Notice: using deprecated NEED_KDE variable, use KDE_REQUIRED=\"never\" or KDE_REQUIRED=\"optional\" instead. You may want to override KDE_MINIMAL as well (default is KDE_MINIMAL=\"${KDE_MINIMAL}\")." ;;
+ *) [[ -n ${NEED_KDE} ]] && ewarn "QA Notice: using deprecated NEED_KDE variable, use KDE_MINIMAL instead (default is KDE_MINIMAL=\"${KDE_MINIMAL}\")." ;;
+ esac
+ [[ -z ${KDE_MINIMAL_VALID} ]] && ewarn "QA Notice: ignoring invalid KDE_MINIMAL (defaulting to ${KDE_MINIMAL})."
+
+ # Don't set KDEHOME during compilation, it will cause access violations
+ unset KDEHOME
+
+ if [[ ${KDEBASE} = kde-base ]]; then
+ if use kdeprefix; then
+ KDEDIR="${ROOT}usr/kde/${_kdedir}"
+ else
+ KDEDIR="${ROOT}usr"
+ fi
+ PREFIX="${PREFIX:-${KDEDIR}}"
+ else
+ # Determine KDEDIR by loooking for the closest match with KDE_MINIMAL
+ KDEDIR=
+ local kde_minimal_met
+ for slot in ${KDE_SLOTS[@]} ${KDE_LIVE_SLOTS[@]}; do
+ [[ -z ${kde_minimal_met} ]] && [[ ${slot} = ${KDE_MINIMAL} ]] && kde_minimal_met=1
+ if [[ -n ${kde_minimal_met} ]] && has_version "kde-base/kdelibs:${slot}"; then
+ if has_version "kde-base/kdelibs:${slot}[kdeprefix]"; then
+ KDEDIR="${ROOT}usr/kde/${slot}"
+ else
+ KDEDIR="${ROOT}usr"
+ fi
+ break;
+ fi
+ done
+ unset slot
+ [[ -z KDEDIR ]] && die "Failed to determine KDEDIR!"
+ PREFIX="${PREFIX:-${ROOT}usr}"
+ fi
+
+ # Not needed anymore
+ unset _kdedir
+}
+
+# @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
+ base_src_unpack
+ 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
+
+ base_src_prepare
+ [[ ${BUILD_TYPE} = live ]] && subversion_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} "$@"
+
+ # Handle common release builds
+ if ! has debug ${IUSE//+} || ! use debug; then
+ append-cppflags -DQT_NO_DEBUG
+ fi
+
+ # Build tests in src_test only, where we override this value
+ local cmakeargs="-DKDE4_BUILD_TESTS=OFF"
+
+ # Set distribution name
+ [[ ${PN} = kdelibs ]] && cmakeargs="${cmakeargs} -DKDE_DISTRIBUTION_TEXT=Gentoo"
+
+ # Here we set the install prefix
+ cmakeargs="${cmakeargs} -DCMAKE_INSTALL_PREFIX=${PREFIX}"
+
+ # Set environment
+ QTEST_COLORED=1
+ QT_PLUGIN_PATH="${KDEDIR}/$(get_libdir)/kde4/plugins/"
+
+ # Point pkg-config path to KDE *.pc files
+ export PKG_CONFIG_PATH="${KDEDIR}/$(get_libdir)/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}"
+
+ # Shadow existing /usr installations
+ unset KDEDIRS
+
+ if [[ ${KDEDIR} != "${ROOT}usr" ]]; then
+ # Override some environment variables - only when kdeprefix is different,
+ # to not break ccache/distcc
+ PATH="${KDEDIR}/bin:${PATH}"
+ LDPATH="${KDEDIR}/$(get_libdir):${LDPATH}"
+
+ # Append full RPATH
+ cmakeargs="${cmakeargs} -DCMAKE_SKIP_RPATH=OFF"
+ fi
+
+ if has kdeprefix ${IUSE//+} && use kdeprefix; then
+ # Set cmake prefixes to allow buildsystem to localize valid KDE installation
+ # when more are present
+ cmakeargs="${cmakeargs} -DCMAKE_SYSTEM_PREFIX_PATH=${KDEDIR}"
+ else
+ # If prefix is /usr, sysconf needs to be /etc, not /usr/etc
+ cmakeargs="${cmakeargs} -DSYSCONF_INSTALL_DIR=${ROOT}etc"
+ 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="${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} "$@"
+
+ if [[ -n ${KMSAVELIBS} ]] ; then
+ install_library_dependencies
+ fi
+
+ kde4-base_src_make_doc
+ 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}${ROOT}usr/share/doc/${PF}" ]]; then
+ # work around bug #97196
+ dodir /usr/share/doc/KDE4 && \
+ mv "${D}${ROOT}usr/share/doc/${PF}" "${D}${ROOT}usr/share/doc/KDE4/" || \
+ die "Failed to move docs to KDE4/."
+ 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
+
+ if [[ ${BUILD_TYPE} = live ]] && [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then
+ echo
+ einfo "WARNING! This is an experimental live ebuild of ${KMNAME:-${PN}}"
+ einfo "Use it at your own risk."
+ einfo "Do _NOT_ file bugs at bugs.gentoo.org because of this ebuild!"
+ echo
+ 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
+}
diff --git a/eclass/kde4-functions.eclass b/eclass/kde4-functions.eclass
new file mode 100644
index 00000000000..ec54f67319c
--- /dev/null
+++ b/eclass/kde4-functions.eclass
@@ -0,0 +1,267 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.18 2009/05/09 13:23:15 scarabeus Exp $
+
+# @ECLASS: kde4-functions.eclass
+# @MAINTAINER:
+# kde@gentoo.org
+# @BLURB: Common ebuild functions for KDE 4 packages
+# @DESCRIPTION:
+# This eclass contains all functions shared by the different eclasses,
+# for KDE 4 ebuilds.
+
+# @ECLASS-VARIABLE: EAPI
+# @DESCRIPTION:
+# By default kde4 eclasses wants eapi 2 which might be redefinable to newer
+# versions.
+case ${EAPI:-0} in
+ 2) : ;;
+ *) die "No way! EAPI other than 2 is not supported for now." ;;
+esac
+
+# @ECLASS-VARIABLE: KDEBASE
+# @DESCRIPTION:
+# This gets set to a non-zero value when a package is considered a kde or
+# koffice ebuild.
+
+if [[ ${CATEGORY} = kde-base ]]; then
+ debug-print "${ECLASS}: KDEBASE ebuild recognized"
+ KDEBASE=kde-base
+fi
+
+# is this a koffice ebuild?
+if [[ ${KMNAME} = koffice || ${PN} = koffice ]]; then
+ debug-print "${ECLASS}: KOFFICE ebuild recognized"
+ KDEBASE=koffice
+fi
+
+# @ECLASS-VARIABLE: KDE_SLOTS
+# @DESCRIPTION:
+# The slots used by all KDE versions later than 4.0. The live KDE releases use
+# KDE_LIVE_SLOTS instead. Values should be ordered.
+KDE_SLOTS=( "kde-4" "4.1" "4.2" "4.3" )
+
+# @ECLASS-VARIABLE: KDE_LIVE_SLOTS
+# @DESCRIPTION:
+# The slots used by KDE live versions. Values should be ordered.
+KDE_LIVE_SLOTS=( "live" )
+
+# @FUNCTION: buildsycoca
+# @DESCRIPTION:
+# Function to rebuild the KDE System Configuration Cache.
+# All KDE ebuilds should run this in pkg_postinst and pkg_postrm.
+buildsycoca() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if [[ -z ${ROOT%%/} && -x ${KDEDIR}/bin/kbuildsycoca4 ]]; then
+ # Make sure tha cache file exists, writable by root and readable by
+ # others. Otherwise kbuildsycoca4 will fail.
+ touch "${KDEDIR}/share/kde4/services/ksycoca4"
+ chmod 644 "${KDEDIR}/share/kde4/services/ksycoca4"
+
+ # We have to unset DISPLAY and DBUS_SESSION_BUS_ADDRESS, the ones
+ # in the user's environment (through su [without '-']) may cause
+ # kbuildsycoca4 to hang.
+
+ ebegin "Running kbuildsycoca4 to build global database"
+ # This is needed because we support multiple kde versions installed together.
+ # Lookup in order - local, KDEDIR, /usr, do not duplicate entries btw.
+ local KDEDIRS="${ROOT}usr/share"
+ [[ ${KDEDIR} != "${ROOT}usr" ]] && KDEDIRS="${KDEDIR}/share:${KDEDIRS}"
+ XDG_DATA_DIRS="${ROOT}usr/local/share:${KDEDIRS}" \
+ DISPLAY="" DBUS_SESSION_BUS_ADDRESS="" \
+ ${KDEDIR}/bin/kbuildsycoca4 --global --noincremental &> /dev/null
+ eend $?
+ fi
+
+ # fix permission for some directories
+ for x in share/config share/kde4; do
+ [[ ${KDEDIR} = ${ROOT}usr ]] && DIRS=${ROOT}usr || DIRS="${ROOT}usr ${KDEDIR}"
+ for y in ${DIRS}; do
+ [[ -d "${y}/${x}" ]] || break # nothing to do if directory does not exist
+ if [[ $(stat --format=%a "${y}/${x}") != 755 ]]; then
+ ewarn "QA Notice:"
+ ewarn "Package ${PN} is breaking ${y}/${x} permissions."
+ ewarn "Please report this issue to gentoo bugzilla."
+ einfo "Permissions will get adjusted automatically now."
+ find "${y}/${x}" -type d -print0 | xargs -0 chmod 755
+ fi
+ done
+ done
+}
+
+# @FUNCTION: comment_all_add_subdirectory
+# @USAGE: [list of directory names]
+# @DESCRIPTION:
+# Recursively comment all add_subdirectory instructions in listed directories,
+# except those in cmake/.
+comment_all_add_subdirectory() {
+ find "$@" -name CMakeLists.txt -print0 | grep -vFzZ "./cmake" | \
+ xargs -0 sed -i -e '/add_subdirectory/s/^/#DONOTCOMPILE /' -e '/ADD_SUBDIRECTORY/s/^/#DONOTCOMPILE /' || \
+ die "${LINENO}: Initial sed died"
+}
+
+# @ECLASS-VARIABLE: KDE_LINGUAS
+# @DESCRIPTION:
+# This is a whitespace-separated list of translations this ebuild supports.
+# These translations are automatically added to IUSE. Therefore ebuilds must set
+# this variable before inheriting any eclasses. To enable only selected
+# translations, ebuilds must call enable_selected_linguas(). kde4-base.eclass does
+# this for you.
+#
+# Example: KDE_LINGUAS="en_GB de nl"
+for _lingua in ${KDE_LINGUAS}; do
+ IUSE="${IUSE} linguas_${_lingua}"
+done
+
+# @FUNCTION: enable_selected_linguas
+# @DESCRIPTION:
+# Enable translations based on LINGUAS settings and translations supported by
+# the package (see KDE_LINGUAS). By default, translations are found in "${S}"/po
+# but this default can be overridden by defining KDE_LINGUAS_DIR.
+enable_selected_linguas() {
+ local lingua sr_mess wp
+
+ # ebuild overridable linguas directory definition
+ KDE_LINGUAS_DIR=${KDE_LINGUAS_DIR:="${S}/po"}
+ cd "${KDE_LINGUAS_DIR}" || die "wrong linguas dir specified"
+
+ # fix all various crazy sr@Latn variations
+ # this part is only ease for ebuilds, so there wont be any die when this
+ # fail at any point
+ sr_mess="sr@latn sr@latin sr@Latin"
+ for wp in ${sr_mess}; do
+ [[ -e "${wp}.po" ]] && mv "${wp}.po" "sr@Latn.po"
+ if [[ -d "${wp}" ]]; then
+ # move dir and fix cmakelists
+ mv "${wp}" "sr@Latn"
+ sed -i \
+ -e "s:${wp}:sr@Latin:g" \
+ CMakeLists.txt
+ fi
+ done
+
+ for lingua in ${KDE_LINGUAS}; do
+ if [[ -e "${lingua}.po" ]]; then
+ mv "${lingua}.po" "${lingua}.po.old"
+ fi
+ done
+ comment_all_add_subdirectory "${KDE_LINGUAS_DIR}"
+ for lingua in ${LINGUAS}; do
+ ebegin "Enabling LANGUAGE: ${lingua}"
+ if [[ -d "${lingua}" ]]; then
+ sed -e "/add_subdirectory([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
+ -e "/ADD_SUBDIRECTORY([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
+ -i CMakeLists.txt || die "Sed to uncomment linguas_${lingua} failed."
+ fi
+ if [[ -e "${lingua}.po.old" ]]; then
+ mv "${lingua}.po.old" "${lingua}.po"
+ fi
+ eend $?
+ done
+}
+
+# @FUNCTION: get_build_type
+# @DESCRIPTION:
+# Determine whether we are using live ebuild or tbzs.
+get_build_type() {
+ if [[ ${SLOT} = live || ${PV} = *9999* ]]; then
+ BUILD_TYPE="live"
+ else
+ BUILD_TYPE="release"
+ fi
+ export BUILD_TYPE
+}
+
+# @FUNCTION: migrate_store_dir
+# @DESCRIPTION:
+# Universal store dir migration
+# * performs split of kdebase to kdebase-apps when needed
+# * moves playground/extragear kde4-base-style to toplevel dir
+migrate_store_dir() {
+ local cleandir="${ESVN_STORE_DIR}/KDE"
+ if [[ -d "${cleandir}" ]]; then
+ ewarn "'${cleandir}' has been found. Moving contents to new location."
+ addwrite "${ESVN_STORE_DIR}"
+ # Split kdebase
+ local module
+ if pushd "${cleandir}"/kdebase/kdebase > /dev/null; then
+ for module in `find . -maxdepth 1 -type d -name [a-z0-9]\*`; do
+ module="${module#./}"
+ mkdir -p "${ESVN_STORE_DIR}/kdebase-${module}" && mv -f "${module}" "${ESVN_STORE_DIR}/kdebase-${module}" || \
+ die "Failed to move to '${ESVN_STORE_DIR}/kdebase-${module}'."
+ done
+ popd > /dev/null
+ rm -fr "${cleandir}/kdebase" || \
+ die "Failed to remove ${cleandir}/kdebase. You need to remove it manually."
+ fi
+ # Move the rest
+ local pkg
+ for pkg in "${cleandir}"/*; do
+ mv -f "${pkg}" "${ESVN_STORE_DIR}"/ || eerror "Failed to move '${pkg}'"
+ done
+ rmdir "${cleandir}" || die "Could not move obsolete KDE store dir. Please move '${cleandir}' contents to appropriate location (possibly ${ESVN_STORE_DIR}) and manually remove '${cleandir}' in order to continue."
+ fi
+
+ if ! hasq kde4-meta ${INHERITED}; then
+ case ${KMNAME} in
+ extragear*|playground*)
+ local svnlocalpath="${ESVN_STORE_DIR}"/"${KMNAME}"/"${PN}"
+ if [[ -d "${svnlocalpath}" ]]; then
+ local destdir="${ESVN_STORE_DIR}"/"${ESVN_PROJECT}"/"`basename "${ESVN_REPO_URI}"`"
+ ewarn "'${svnlocalpath}' has been found."
+ ewarn "Moving contents to new location: ${destdir}"
+ addwrite "${ESVN_STORE_DIR}"
+ mkdir -p "${ESVN_STORE_DIR}"/"${ESVN_PROJECT}" && mv -f "${svnlocalpath}" "${destdir}" \
+ || die "Failed to move to '${svnlocalpath}'"
+ # Try cleaning empty directories
+ rmdir "`dirname "${svnlocalpath}"`" 2> /dev/null
+ fi
+ ;;
+ esac
+ fi
+}
+
+# Functions handling KMLOADLIBS and KMSAVELIBS
+
+# @FUNCTION: save_library_dependencies
+# @DESCRIPTION:
+# Add exporting CMake dependencies for current package
+save_library_dependencies() {
+ local depsfile="${T}/${PN}:${SLOT}"
+
+ ebegin "Saving library dependencies in ${depsfile##*/}"
+ echo "EXPORT_LIBRARY_DEPENDENCIES(\"${depsfile}\")" >> "${S}/CMakeLists.txt" || \
+ die "Failed to save the library dependencies."
+ eend $?
+}
+
+# @FUNCTION: install_library_dependencies
+# @DESCRIPTION:
+# Install generated CMake library dependencies to /var/lib/kde
+install_library_dependencies() {
+ local depsfile="${T}/${PN}:${SLOT}"
+
+ ebegin "Installing library dependencies as ${depsfile##*/}"
+ insinto ${ROOT}var/lib/kde
+ doins "${depsfile}" || die "Failed to install library dependencies."
+ eend $?
+}
+
+# @FUNCTION: load_library_dependencies
+# @DESCRIPTION:
+# Inject specified library dependencies in current package
+load_library_dependencies() {
+ local pn i depsfile
+ ebegin "Injecting library dependencies from '${KMLOADLIBS}'"
+
+ i=0
+ for pn in ${KMLOADLIBS} ; do
+ ((i++))
+ depsfile="${ROOT}var/lib/kde/${pn}:${SLOT}"
+ [[ -r "${depsfile}" ]] || die "Depsfile '${depsfile}' not accessible. You probably need to reinstall ${pn}."
+ sed -i -e "${i}iINCLUDE(\"${depsfile}\")" "${S}/CMakeLists.txt" || \
+ die "Failed to include library dependencies for ${pn}"
+ done
+ eend $?
+}
diff --git a/eclass/kde4-meta.eclass b/eclass/kde4-meta.eclass
new file mode 100644
index 00000000000..a5d597f85d6
--- /dev/null
+++ b/eclass/kde4-meta.eclass
@@ -0,0 +1,717 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-meta.eclass,v 1.18 2009/05/09 13:23:15 scarabeus Exp $
+#
+# @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.
+
+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 khelpcenter dependency when installing
+if [[ ${PN} != khelpcenter ]] && has doc ${IUSE//+} && use doc; then
+ RDEPEND="${RDEPEND}
+ >=kde-base/khelpcenter-${PV}:${SLOT}[kdeprefix=]
+ "
+fi
+
+# Add dependencies that all packages in a certain module share.
+case ${KMNAME} in
+ kdebase|kdebase-apps|kdebase-workspace|kdebase-runtime|kdegraphic)
+ DEPEND="${DEPEND}
+ >=kde-base/qimageblitz-0.0.4
+ "
+ RDEPEND="${RDEPEND}
+ >=kde-base/qimageblitz-0.0.4
+ "
+ ;;
+ kdenetwork)
+ DEPEND="${DEPEND}
+ >=kde-base/kdepimlibs-${PV}:${SLOT}[kdeprefix=]
+ "
+ RDEPEND="${RDEPEND}
+ >=kde-base/kdepimlibs-${PV}:${SLOT}[kdeprefix=]
+ "
+ ;;
+ kdepim)
+ DEPEND="${DEPEND}
+ dev-libs/boost
+ >=kde-base/kdepimlibs-${PV}:${SLOT}[kdeprefix=]
+ "
+ RDEPEND="${RDEPEND}
+ dev-libs/boost
+ >=kde-base/kdepimlibs-${PV}:${SLOT}[kdeprefix=]
+ "
+ case ${PN} in
+ akregator|kaddressbook|kjots|kmail|kmobiletools|knode|knotes|korganizer|ktimetracker)
+ IUSE="+kontact"
+ RDEPEND="${RDEPEND}
+ kontact? ( >=kde-base/kontactinterfaces-${PV}:${SLOT}[kdeprefix=] )
+ "
+ ;;
+ esac
+ ;;
+ kdegames)
+ if [[ ${PN} != libkdegames ]]; then
+ DEPEND="${DEPEND}
+ >=kde-base/libkdegames-${PV}:${SLOT}[kdeprefix=]
+ "
+ RDEPEND="${RDEPEND}
+ >=kde-base/libkdegames-${PV}:${SLOT}[kdeprefix=]
+ "
+ fi
+ ;;
+ koffice)
+ [[ ${PN} != koffice-data ]] && IUSE="debug"
+ RDEPEND="${RDEPEND}
+ !kdeprefix? (
+ !app-office/${PN}:0
+ !app-office/koffice:0
+ !app-office/koffice-meta:0
+ )
+ "
+ COMMON_DEPEND="
+ dev-cpp/eigen:2
+ media-gfx/imagemagick[openexr?]
+ media-libs/fontconfig
+ media-libs/freetype:2
+ "
+ DEPEND="${DEPEND} ${COMMON_DEPEND}"
+ RDEPEND="${RDEPEND} ${COMMON_DEPEND}"
+ unset COMMON_DEPEND
+ if [[ ${PN} != koffice-libs && ${PN} != koffice-data ]]; then
+ DEPEND="${DEPEND}
+ >=app-office/koffice-libs-${PV}:${SLOT}
+ "
+ RDEPEND="${RDEPEND}
+ >=app-office/koffice-libs-${PV}:${SLOT}
+ "
+ fi
+ ;;
+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 ${BUILD_TYPE} in
+ live)
+ case ${KMNAME} in
+ extragear*|playground*)
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}"
+ ESVN_PROJECT="${KMNAME}${ESVN_PROJECT_SUFFIX}"
+ ;;
+ 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}/${P}"
+ 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}'."