public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] New eclasses for KDE 4
@ 2008-01-11 23:22 Wulf C. Krueger
  2008-01-12  0:19 ` Vlastimil Babka
  2008-01-13  0:23 ` Donnie Berkholz
  0 siblings, 2 replies; 3+ messages in thread
From: Wulf C. Krueger @ 2008-01-11 23:22 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1: Type: text/plain, Size: 526 bytes --]

Hello, fellow Gentoo devs!

Attached you'll find the new eclasses for KDE 4. We'd like to commit them 
on Sunday, 14th, to be able to get KDE 4.0.0 into the official tree 
(package.masked, though).

We would welcome any comments, especially if accompanied by patches ;) 
and, of course, your kind approval to commit it. :-)

You can always find the current version of the eclasses in my gitweb as 
well:

https://www2.mailstation.de/gitweb/?p=genkde4svn-dev.git;a=tree;f=eclass;hb=HEAD

-- 
Best regards, Wulf

[-- Attachment #1.2: kde4-base.eclass --]
[-- Type: text/plain, Size: 11954 bytes --]

# Copyright 2007 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.0 ebuilds
# @DESCRIPTION:
# The kde4-base.eclass provides support for building KDE4 monolithic ebuilds
# and KDE4 applications.

inherit base eutils multilib cmake-utils kde4-functions

EXPORT_FUNCTIONS pkg_setup src_compile src_test src_install pkg_postinst pkg_postrm

DEPEND="${DEPEND}
	>=dev-util/cmake-2.4.7-r1
	dev-util/pkgconfig
	x11-libs/libXt
	>=x11-libs/qt-4.3.0:4
	x11-proto/xf86vidmodeproto
	x11-proto/xineramaproto"
RDEPEND="${RDEPEND}
	x11-libs/libXinerama
	>=x11-libs/qt-4.3.3:4"

if hasq test ${IUSE//+}; then
	DEPEND="${DEPEND}
		test? ( dev-util/cppunit )"
fi

# @ECLASS-VARIABLE: NEED_KDE
# @DESCRIPTION:
# This variable sets the version of KDE4 which will be used by the eclass.
# This variable must be set by the ebuild, for all categories except for "kde-base".
# For kde-base packages, if it is not set by the ebuild,
# it's assumed that the required KDE4 version is the latest, non-live, available.
#
# Acceptable values are:
#	- latest - Use latest version in the portage tree
#		Default for kde-base ebuilds.
#	- svn - Use svn release (live ebuilds)
#	- :SLOT - Use any version in the SLOT specified in the NEED_KDE value.
#	- VERSION_NUMBER - Use the KDE4 version specified in the NEED_KDE value.
#	- VERSION_NUMBER:SLOT - Use the KDE4 version and SLOT specified in the NEED_KDE value.
#	- none - Let the ebuild handle SLOT, kde dependencies, ...
#
# Note: There is no default NEED_KDE for ebuilds not in kde-base,
# so you must set it explicitly in the ebuild, in all other cases.
if [[ -z ${NEED_KDE} ]]; then
	if [[ -n ${KDEBASE} ]]; then
		NEED_KDE="latest"
	else
		die "kde4-base.eclass inherited but NEED_KDE not defined - broken ebuild"
	fi
fi
export NEED_KDE

case ${NEED_KDE} in
	latest)
		# Should only be used by 'kde-base'-ebuilds
		if [[ "${KDEBASE}" == "kde-base" ]]; then
			case ${PV} in
				3.9*)	_kdedir="3.9" ;;
				4*)		_kdedir="4.0" ;;
				*)		die "NEED_KDE=latest not supported for PV=${PV}" ;;
			esac
			_operator=">="
			_pv="-${PV}:kde-4"
		else
			_kdedir="4.0"
			_pv=":kde-4"
		fi
		;;
	svn|9999*|:kde-svn)
		_kdedir="svn"
		_pv=":kde-svn"
		export NEED_KDE="svn"
		;;
	*:kde-svn)
		_kdedir="svn"
		_operator=">="
		_pv="-${NEED_KDE}"
		export NEED_KDE="svn"
		;;
	# The ebuild handles dependencies, KDEDIR, SLOT.
	none)
		# This shouldn't be used for kde-base ebuilds.
		if [[ -n ${KDEBASE} ]]; then
			die 'Ebuilds part of kde-base ebuilds should not use NEED_KDE="none".'
		fi
		;;
	# NEED_KDE=":${SLOT}"
	:kde-4)
		_kdedir="4.0"
		_pv="${NEED_KDE}"
		;;
	# NEED_KDE="${PV}:${SLOT}"
	*:kde-4)
		_kdedir="4.0"
		_operator=">="
		_pv="-${NEED_KDE}"
		;;
	3.9*)
		_kdedir="3.9"
		_operator=">="
		_pv="-${NEED_KDE}:kde-4"
		;;
	4*)
		_kdedir="4.0"
		_operator=">="
		_pv="-${NEED_KDE}:kde-4"
		;;
	*)	die "NEED_KDE=${NEED_KDE} currently not supported."
		;;
esac

if [[ ${NEED_KDE} != none ]]; then
	KDEDIR="/usr/kde/${_kdedir}"
	KDEDIRS="/usr:/usr/local:${KDEDIR}"

	if [[ -n ${KDEBASE} ]]; then
		if [[ ${NEED_KDE} = svn ]]; then
			SLOT="kde-svn"
		else
			SLOT="kde-4"
		fi
	fi

	# We only need to add the dependencies if ${PN} is not "kdelibs" or "kdepimlibs"
	if [[ ${PN} != "kdelibs" ]]; then
		DEPEND="${DEPEND}
		${_operator}kde-base/kdelibs${_pv}"
		RDEPEND="${RDEPEND}
		${_operator}kde-base/kdelibs${_pv}"
		if [[ ${PN} != "kdepimlibs" ]]; then
			DEPEND="${DEPEND}
			${_operator}kde-base/kdepimlibs${_pv}"
			RDEPEND="${RDEPEND}
			${_operator}kde-base/kdepimlibs${_pv}"
		fi
	fi

	unset _operator _pv _kdedir
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
if [[ -n ${KDEBASE} ]]; then
	if [[ -n ${KMNAME} ]]; then
		_kmname=${KMNAME}
	else
		_kmname=${PN}
	fi
	_kmname_pv="${_kmname}-${PV}"
	if [[ ${NEED_KDE} != "svn" ]]; then
		case ${KDEBASE} in
			kde-base)
			case ${PV} in
			3.96.0)
				case ${_kmname} in
					kdelibs|kdepimlibs|kdebase-runtime)
						SRC_URI="mirror://kde/stable/${PV/.0/}/src/${_kmname_pv}.tar.bz2" ;;
					*)	SRC_URI="mirror://kde/unstable/${PV/.0/}/src/${_kmname_pv}.tar.bz2" ;;
				esac ;;
			3.97*) SRC_URI="mirror://kde/unstable/${PV/.0/}/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

debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SRC_URI is ${SRC_URI}"
debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND ${DEPEND} - before blockers"

# Monolithic ebuilds should add blockers for split ebuilds in the same slot.
# If KMNAME is not set then this is not a split package
if [[ -n ${KDEBASE} && -z ${KMNAME} ]]; then
	for _x in $(get-child-packages ${CATEGORY}/${PN}); do
		DEPEND="${DEPEND} !${_x}:${SLOT}"
		RDEPEND="${RDEPEND} !${_x}:${SLOT}"
	done
	unset _x
fi

debug-print "${BASH_SOURCE} ${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND ${DEPEND} - after blockers"

# @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 /usr/ by default, this value
# can be superseded by defining PREFIX before inheriting kde4-base.
if [[ -n ${KDEBASE} ]]; then
	PREFIX=${KDEDIR}
else
	# if PREFIX is not defined we set it to the default value of /usr
	PREFIX="${PREFIX:-/usr}"
fi

debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SLOT ${SLOT} - KDEDIR ${KDEDIR} - KDEDIRS ${KDEDIRS}- PREFIX ${PREFIX} - 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 "$@"

	# KDE4 applications require qt4 compiled with USE="accessibility dbus jpeg png qt3support ssl zlib".
	QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} accessibility dbus jpeg png qt3support ssl zlib"

	if hasq debug ${IUSE//+} && use debug; then
		QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} debug"
	fi

	if hasq opengl ${IUSE//+} && use opengl; then
		QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK} opengl"
	fi

	kde4-functions_check_use
}

# @FUNCTION: kde4-base_src_unpack
# @USAGE: [source files]
# @DESCRIPTION:
# This function unpacks the source tarballs for KDE4 applications.
#
# If an argument is passed to this function, then standard src_unpack is executed.
#
# Otherwise, if the directory ${WORKDIR}/patches/ exists,
# we apply all patches in that directory, provided they follow this format:
# - Monolithic ebuilds, (from kde-base)
#		- $CATEGORY=kde-base:
#			Apply ${CHILD_EBUILD_NAME}-${SLOT}-*{diff,patch}
#		- $CATEGORY=!kde-base:
#			Apply ${CHILD_EBUILD_NAME}-${PV}-*{diff,patch}
# - Split ebuilds:
#		- $CATEGORY=kde-base:
#			Apply ${PN}-${SLOT}-*{diff,patch}
#		- $CATEGORY!=kde-base:
#			Apply ${PN}-${PV}-*{diff,patch}
#
kde4-base_src_unpack() {
	debug-print-function $FUNCNAME "$@"

	[[ -z "${KDE_S}" ]] && KDE_S="${S}"

	local _patchdir _packages _p
	_patchdir="${WORKDIR}/patches/"
	if [[ -z $* ]]; then
		# Unpack first and deal with KDE patches after examing possible patch sets.
		# To be picked up, patches need to conform to the guidelines stated before.
		# Monolithic ebuilds will use the split ebuild patches.
		[[ -d "${KDE_S}" ]] || unpack ${A}
		if [[ -d "${_patchdir}" ]]; then
			if is-parent-package ${CATEGORY}/${PN} ; then
				_packages="$(get-child-packages ${CATEGORY}/${PN})"
				_packages="${_packages//${CATEGORY}\//} ${PN}"
			else
				_packages="${PN}"
			fi
			for _p in ${_packages}; do
				PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${PV}-*{diff,patch} 2>/dev/null)"
				if [[ -n "${KDEBASE}" ]]; then
					PATCHES="${PATCHES} $(ls ${_patchdir}/${_p}-${SLOT}-*{diff,patch} 2>/dev/null)"
				fi
			done
		fi
		[[ -n ${PATCHES} ]] && base_src_unpack autopatch
	else
		# Call base_src_unpack, which unpacks and patches
		# step by step transparently as defined in the ebuild.
		base_src_unpack $*
	fi

	# Updated cmake dir
	if [[ -d "${WORKDIR}/cmake" ]] && [[ -d "${KDE_S}/cmake" ]]; then
		ebegin "Updating cmake/ directory..."
		rm -rf "${KDE_S}/cmake" || die "Unable to remove old cmake/ directory"
		ln -s "${WORKDIR}/cmake" "${KDE_S}/cmake" || die "Unable to symlink the new cmake/ directory"
	eend 0
	fi
}

# @FUNCTION: kde4-base_src_compile
# @DESCRIPTION:
# General function for compiling KDE4 applications.
kde4-base_src_compile() {
	debug-print-function ${FUNCNAME} "$@"

	kde4-base_src_configure
	kde4-base_src_make
}

# @FUNCTION: kde4-base_src_configure
# @DESCRIPTION:
# Function for configuring the build of KDE4 applications.
kde4-base_src_configure() {
	debug-print-function ${FUNCNAME} "$@"

	# Final flag handling
	if hasq kdeenablefinal ${IUSE//+} && use kdeenablefinal; then
		einfo "Activating enable-final flag"
		mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_FINAL=ON"
	fi

	 # Enable generation of HTML handbook
	if hasq htmlhandbook ${IUSE//+} && use htmlhandbook; then
		einfo "Enabling building of HTML handbook"
		mycmakeargs="${mycmakeargs} -DKDE4_ENABLE_HTMLHANDBOOK=ON"
	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"

	# rpath linking
	mycmakeargs="${mycmakeargs} -DKDE4_USE_ALWAYS_FULL_RPATH=ON"

	# Here we set the install prefix
	mycmakeargs="${mycmakeargs} -DCMAKE_INSTALL_PREFIX=${PREFIX}"

	# Set environment
	QTEST_COLORED=1
	QT_PLUGIN_PATH=${KDEDIR}/$(get_libdir)/kde4/plugins/

	cmake-utils_src_configureout
}

# @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} "$@"

	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 testing KDE4 applications.
kde4-base_src_install() {
	debug-print-function ${FUNCNAME} "$@"

	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}"/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() {
	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() {
	buildsycoca
}

[-- Attachment #1.3: kde4-meta.eclass --]
[-- Type: text/plain, Size: 14580 bytes --]

# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
# @ECLASS: kde4-functions.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 multilib kde4-functions kde4-base

EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install

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" ;;
	*)			die "KDEBASE=${KDEBASE} is unsupported." ;;
esac

debug-print "${BASH_SOURCE} ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - before blockers"
debug-print "${BASH_SOURCE} ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - before blockers"

# Add a blocker on the package we're derived from
DEPEND="${DEPEND} !$(get-parent-package ${CATEGORY}/${PN}):${SLOT}"
RDEPEND="${RDEPEND} !$(get-parent-package ${CATEGORY}/${PN}):${SLOT}"

debug-print "line ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - after blockers"
debug-print "line ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - after blockers"

# 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)
		if [[ ${PN} != kode ]]; then
			DEPEND="${DEPEND} >=kde-base/kode-${PV}:${SLOT}"
			RDEPEND="${RDEPEND} >=kde-base/kode-${PV}:${SLOT}"
		fi
		case ${PN} in
			akregator|kaddressbook|kmail|kmobiletools|knode|knotes|korganizer|ktimetracker)
				IUSE="+kontact"
				DEPEND="${DEPEND} kontact? ( >=kde-base/kontact-${PV}:${SLOT} )"
				RDEPEND="${RDEPEND} kontact? ( >=kde-base/kontact-${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 ${PN} in
			koffice-libs|koffice-data) : ;;
			*)
			DEPEND="${DEPEND} >=app-office/koffice-libs-${PV}:${SLOT}"
			RDEPEND="${RDEPEND} >=app-office/koffice-libs-${PV}:${SLOT}"
			;;
		esac
	;;
esac

debug-print "line ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - after metapackage-specific dependencies"
debug-print "line ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - after metapackage-specific dependencies"


# @ECLASS-VARIABLE: KMNAME
# @DESCRIPTION:
# Name of the parent-module (eg 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 usage: The ebuild name of "kdebase/l10n" is kde-base/kdebase-l10n,
# because just 'l10n' would be too confusing.

# @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 topsubdirectory (containing the package) as $KMEXTRACTONLY, and set KMNOMODULE="true".
if [[ ${KMNOMODULE} != "true" && -z ${KMMODULE} ]]; 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.

# @ECLASS-VARIABLE: KMEXTRACTONLY
# @DESCRIPTION:
# All subdirectories listed here will be extracted, but not 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.

kde4-meta_pkg_setup() {
	kde4-base_pkg_setup
}

kde4-meta_src_unpack() {
	debug-print-function  ${FUNCNAME} "$@"

	if [[ ${KMNAME} = kdepim ]] && \
		hasq kontact ${IUSE//+} && \
		use kontact; then
			KMEXTRA="${KMEXTRA} kontact/plugins/${PLUGINNAME:-${PN}}"
			KMEXTRACTONLY="${KMEXTRACTONLY} kontact/interfaces/"
	fi

	kde4-meta_src_extract
	kde4-meta_change_cmakelists
}

# @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() {
	local tarball tarfile f extractlist
	tarball="${KMNAME}-${PV}.tar.bz2"
	tarfile="${DISTDIR}"/${tarball}

	einfo "Unpacking parts of ${tarball} to ${WORKDIR}"

	kde4-meta_create_extractlists

	for f in cmake/ CMakeLists.txt ConfigureChecks.cmake config.h.cmake \
		AUTHORS COPYING INSTALL README NEWS ChangeLog
	do
		extractlist="${extractlist} ${KMNAME}-${PV}/${f}"
	done
	extractlist="${extractlist} $(__list_needed_subdirectories)"
	KMTARPARAMS="${KMTARPARAMS} -j"

	pushd "${WORKDIR}" > /dev/null
	tar -xpf $tarfile $KMTARPARAMS $extractlist 2> /dev/null

	# Default $S is based on $P; rename the extracted directory to match $S
	mv ${KMNAME}-${PV} ${P} || die "Died while moving \"${KMNAME}-${PV}\" to \"${P}\""

	popd > /dev/null
	kde4-base_src_unpack
}

# Create lists of files and subdirectories to extract.
# Also see the descriptions of KMMODULE, KMNOMODULE, KMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY and KMTARPARAMS.
kde4-meta_create_extractlists() {
	debug-print-function ${FUNCNAME} "$@"

	if hasq htmlhandbook ${IUSE//+} && use htmlhandbook; then
		# We use the basename of $KMMODULE because $KMMODULE can contain
		# the path to the module subdirectory.
		KMEXTRA="${KMEXTRA} 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-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"
		;;
		kdegames)
		if [[ ${PN} != "libkdegames" ]]; then
			KMEXTRACTONLY="${KMEXTRACTONLY}
				libkdegames"
		fi
		;;
		koffice)
			KMEXTRACTONLY="${KMEXTRACTONLY}
				config-endian.h.cmake
				filters/config-filters.h.cmake
				config-openexr.h.cmake
				config-opengl.h.cmake
				config-prefix.h.cmake"
		;;
	esac
	# Don't install cmake modules for split ebuilds to avoid collisions.
	case ${KMNAME} in
		kdebase-workspace|kdebase-runtime|kdepim|kdegames)
			KMCOMPILEONLY="${KMCOMPILEONLY}
				cmake/modules/"
		;;
	esac

	debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME}: KMEXTRACTONLY ${KMEXTRACTONLY}"
}

__list_needed_subdirectories() {
	local i j kmextra_expanded kmmodule_expanded kmcompileonly_expanded extractlist topdir

	# We expand KMEXTRA by adding CMakeLists.txt files
	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 ${LINENO} ${ECLASS} ${FUNCNAME} - kmcompileonly_expanded: ${kmcompileonly_expanded}"


	case ${NEED_KDE} in
		svn) : ;;
		*) topdir="${KMNAME}-${PV}/" ;;
	esac

	# Create final list of stuff to extract
	for i in ${kmmodule_expanded} ${kmextra_expanded} ${kmcompileonly_expanded} \
		${KMEXTRACTONLY}
	do
		extractlist="${extractlist} ${topdir}${i}"
	done

	echo ${extractlist}
}

kde4-meta_src_compile() {
	debug-print-function  ${FUNCNAME} "$@"

	kde4-meta_src_configure
	kde4-meta_src_make
}

_change_cmakelists_parent_dirs() {
	debug-print-function ${FUNCNAME} "$@"

	local _olddir _dir
	_dir="${S}"/${1}
	until [[ ${_dir} == "${S}" ]]; do
		_olddir=$(basename ${_dir})
		_dir=$(dirname ${_dir})
		debug-print "${LINENO}: processing ${_dir} CMakeLists.txt searching for ${_olddir}"
		if [[ -f ${_dir}/CMakeLists.txt ]]; then
			sed -i -e "/[[:space:]]*${_olddir}[[:space:]]*/s/^#DONOTCOMPILE //" ${_dir}/CMakeLists.txt || \
				die "${LINENO}: died in ${FUNCNAME} while processing ${_dir}"
		fi
	done
}

kde4-meta_change_cmakelists() {
	debug-print-function  ${FUNCNAME} "$@"

	pushd "${S}" > /dev/null

	comment_all_add_subdirectory ./

	# Restore "add_subdirectory( cmake )" in ${S}/CMakeLists.txt
	if [[ -f "${S}"/CMakeLists.txt ]]; then
		sed -i -e '/ *cmake */s/^#DONOTCOMPILE //' "${S}"/CMakeLists.txt || die "${LINENO}: cmake sed died"
	fi

	if [[ -z ${KMNOMODULE} ]]; then
		# Restore "add_subdirectory" in $KMMODULE subdirectories
		find "${S}"/${KMMODULE} -name CMakeLists.txt -print0 | xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \
			die "${LINENO}: died in KMMODULE section"
		_change_cmakelists_parent_dirs ${KMMODULE}
	fi

	# KMCOMPILEONLY
	local i
	for i in ${KMCOMPILEONLY}; do
		debug-print "${LINENO}: KMCOMPILEONLY, processing ${i}"
		# Uncomment "add_subdirectory" instructions inside $KMCOMPILEONLY, then comment "install" instructions.
		find "${S}"/${i} -name CMakeLists.txt -print0 | \
			xargs -0 sed -i \
				-e 's/^#DONOTCOMPILE //g' \
				-e '/install(.*)/{s/^/#DONOTINSTALL /;}' \
				-e '/^install(/,/)/{s/^/#DONOTINSTALL /;}' \
				-e '/kde4_install_icons(.*)/{s/^/#DONOTINSTALL /;}' || \
				die "${LINENO}: sed died in the KMCOMPILEONLY section while processing ${i}"
		_change_cmakelists_parent_dirs ${i}
	done

	# KMEXTRA section
	for i in ${KMEXTRA}; do
		debug-print "${LINENO}: KMEXTRA section, processing ${i}"
		# Ebuilds use KMEXTRA incorrectly to extract files which should be in $KMEXTRACTONLY 
		if [[ -d "${S}"/${i} ]]; then
			find "${S}"/${i} -name CMakeLists.txt -print0 | \
				xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \
				die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}"
			_change_cmakelists_parent_dirs ${i}
		else
			[[ ${i} == doc/* ]] || \
			die "KMEXTRA should be used to compile and install subdirectories other than \$KMMODULE. Use KMEXTRACTONLY to extract some files."
		fi
	done

	# Documentation section
	if [[ -n ${docs} ]]; then
		sed -i -e '/ *doc */s/^#DONOTCOMPILE //g' "${S}"/CMakeLists.txt || \
			die "${LINENO}: sed died while uncommenting doc dir"

		if [[ -f "${S}"/doc/CMakeLists.txt ]]; then
			sed -i -e "/( *${KMMODULE##*/} *)/s/^#DONOTCOMPILE //g" "${S}"/doc/CMakeLists.txt \
				|| die "${LINENO}: sed died while uncommenting apps documentation in doc subdir "
		fi
	fi

	# KMEXTRACTONLY section - Some ebuilds need to comment out some subdirs in KMMODULE and they use KMEXTRACTONLY
	for i in ${KMEXTRACTONLY}; do
		if [[ -d "${S}"/${i} && -f "${S}"/${i}/../CMakeLists.txt ]]; then
			sed -i -e "/( *$(basename $i) *)/s/^/#DONOTCOMPILE /" "${S}"/${i}/../CMakeLists.txt || \
				die "${LINENO}: sed died while working in the KMEXTRACTONLY section while processing ${i}"
		fi
	done

	# COLLISION PROTECT section
	# Only install the startkde script as part of kde-base/kdebase-startkde,
	# instead of with every package.
	case ${KMNAME} in
		kdebase-workspace)
		if [[ ${PN} != "kdebase-startkde" && -f "${S}"/CMakeLists.txt ]]; then
			case ${PV} in
				*) # The startkde script moved to kdebase-workspace for KDE4 versions > 3.93.0.
				sed -i -e '/startkde/s/^/#DONOTINSTALL /' "${S}"/CMakeLists.txt || \
					die "${LINENO}: sed died in the kdebase-startkde collision prevention section"
				;;
			esac
		fi
		;;
		koffice)
		if [[ ${PN} != koffice-libs ]]; then
			sed -i -e '/^INSTALL(FILES.*koffice.desktop/ s/^/#DONOTINSTALL /' \
				doc/CMakeLists.txt || \
				die "${LINENO}: sed died in the koffice.desktop collision prevention section"
		fi
		;;
	esac

	popd > /dev/null
}

kde4-meta_src_configure() {
	debug-print-function  ${FUNCNAME} "$@"

	kde4-base_src_configure
}

kde4-meta_src_make() {
	debug-print-function  ${FUNCNAME} "$@"

	kde4-base_src_make
}

kde4-meta_src_test() {
	debug-print-function $FUNCNAME "$@"

	kde4-base_src_test
}

kde4-meta_src_install() {
	debug-print-function $FUNCNAME "$@"

	kde4-meta_src_make_doc
	kde4-meta_src_make_install
}

kde4-meta_src_make_install() {
	debug-print-function  $FUNCNAME "$@"

	cmake-utils_src_install
}

# @FUNCTION: kde4-meta_src_make_doc
# @DESCRIPTION:
# This function searches under ${S}/${KMMODULE},
# and tries to install "AUTHORS ChangeLog* README* NEWS todo" if these files exist.
kde4-meta_src_make_doc() {
	debug-print-function  $FUNCNAME "$@"

	local doc
	for doc in AUTHORS ChangeLog* README* NEWS TODO; do
		[[ -s ${KMMODULE}/$doc ]] && newdoc "${KMMODULE}/${doc}" "${doc}.${KMMODULE##*/}"
	done

	kde4-base_src_make_doc
}

[-- Attachment #1.4: kde4-functions.eclass --]
[-- Type: text/plain, Size: 17082 bytes --]

# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# @ECLASS: kde4-functions.eclass
# @MAINTAINER:
# kde@gentoo.org
# @BLURB: Common ebuild functions for monolithic and split KDE 4 packages
# @DESCRIPTION:
# This eclass contains all functions shared by the different eclasses,
# for KDE 4 monolithic and split ebuilds.

# @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_DERIVATION_MAP
# @DESCRIPTION:
# Map of the monolithic->split ebuild derivation.
# Used to build dependencies describing the relationships between them:
# Monolithic ebuilds block their split counterparts in the same slot, and vice versa.
#
# Also see get-parent-package(), get-child-packages(), is-parent-package()
KDE_DERIVATION_MAP='
kde-base/kdeaccessibility kde-base/kdeaccessibility-colorschemes
kde-base/kdeaccessibility kde-base/kdeaccessibility-iconthemes
kde-base/kdeaccessibility kde-base/kmag
kde-base/kdeaccessibility kde-base/kmousetool
kde-base/kdeaccessibility kde-base/kmouth
kde-base/kdeaccessibility kde-base/kttsd
kde-base/kdeadmin kde-base/kcron
kde-base/kdeadmin kde-base/kdat
kde-base/kdeadmin kde-base/knetworkconf
kde-base/kdeadmin kde-base/ksysv
kde-base/kdeadmin kde-base/kuser
kde-base/kdeadmin kde-base/lilo-config
kde-base/kdeadmin kde-base/secpolicy
kde-base/kdeartwork kde-base/kdeartwork-colorschemes
kde-base/kdeartwork kde-base/kdeartwork-emoticons
kde-base/kdeartwork kde-base/kdeartwork-icewm-themes
kde-base/kdeartwork kde-base/kdeartwork-iconthemes
kde-base/kdeartwork kde-base/kdeartwork-kscreensaver
kde-base/kdeartwork kde-base/kdeartwork-kworldclock
kde-base/kdeartwork kde-base/kdeartwork-sounds
kde-base/kdeartwork kde-base/kdeartwork-styles
kde-base/kdeartwork kde-base/kdeartwork-wallpapers
kde-base/kdebase kde-base/dolphin
kde-base/kdebase kde-base/kappfinder
kde-base/kdebase kde-base/kdepasswd
kde-base/kdebase kde-base/kdialog
kde-base/kdebase kde-base/keditbookmarks
kde-base/kdebase kde-base/kfind
kde-base/kdebase kde-base/konqueror
kde-base/kdebase kde-base/konsole
kde-base/kdebase kde-base/kwrite
kde-base/kdebase kde-base/libkonq
kde-base/kdebase kde-base/nsplugins
kde-base/kdebase-runtime kde-base/drkonqi
kde-base/kdebase-runtime kde-base/kcmshell
kde-base/kdebase-runtime kde-base/kcontrol
kde-base/kdebase-runtime kde-base/kdebase-data
kde-base/kdebase-runtime kde-base/kdebase-kioslaves
kde-base/kdebase-runtime kde-base/kdebugdialog
kde-base/kdebase-runtime kde-base/kde-menu
kde-base/kdebase-runtime kde-base/kdesu
kde-base/kdebase-runtime kde-base/kfile
kde-base/kdebase-runtime kde-base/khelpcenter
kde-base/kdebase-runtime kde-base/kioclient
kde-base/kdebase-runtime kde-base/kmimetypefinder
kde-base/kdebase-runtime kde-base/knetattach
kde-base/kdebase-runtime kde-base/knewstuff
kde-base/kdebase-runtime kde-base/knotify
kde-base/kdebase-runtime kde-base/kpasswdserver
kde-base/kdebase-runtime kde-base/kquitapp
kde-base/kdebase-runtime kde-base/kreadconfig
kde-base/kdebase-runtime kde-base/kstart
kde-base/kdebase-runtime kde-base/kstyles
kde-base/kdebase-runtime kde-base/ktimezoned
kde-base/kdebase-runtime kde-base/ktraderclient
kde-base/kdebase-runtime kde-base/kuiserver
kde-base/kdebase-runtime kde-base/kurifilter-plugins
kde-base/kdebase-runtime kde-base/nepomuk
kde-base/kdebase-runtime kde-base/phonon
kde-base/kdebase-runtime kde-base/renamedlgplugins
kde-base/kdebase-runtime kde-base/soliduiserver
kde-base/kdebase-workspace kde-base/kcheckpass
kde-base/kdebase-workspace kde-base/kcminit
kde-base/kdebase-workspace kde-base/kdebase-startkde
kde-base/kdebase-workspace kde-base/kstartupconfig
kde-base/kdebase-workspace kde-base/kde-menu-icons
kde-base/kdebase-workspace kde-base/kde-wallpapers
kde-base/kdebase-workspace kde-base/kdm
kde-base/kdebase-workspace kde-base/khotkeys
kde-base/kdebase-workspace kde-base/klipper
kde-base/kdebase-workspace kde-base/kmenuedit
kde-base/kdebase-workspace kde-base/krunner
kde-base/kdebase-workspace kde-base/kscreensaver
kde-base/kdebase-workspace kde-base/ksmserver
kde-base/kdebase-workspace kde-base/ksplash
kde-base/kdebase-workspace kde-base/ksysguard
kde-base/kdebase-workspace kde-base/ksystraycmd
kde-base/kdebase-workspace kde-base/ktip
kde-base/kdebase-workspace kde-base/kwin
kde-base/kdebase-workspace kde-base/libkworkspace
kde-base/kdebase-workspace kde-base/libplasma
kde-base/kdebase-workspace kde-base/libtaskmanager
kde-base/kdebase-workspace kde-base/plasma
kde-base/kdebase-workspace kde-base/solid
kde-base/kdebase-workspace kde-base/systemsettings
kde-base/kdebindings kde-base/kalyptus
kde-base/kdebindings kde-base/kdejava
kde-base/kdebindings kde-base/kimono
kde-base/kdebindings kde-base/kjsembed
kde-base/kdebindings kde-base/korundum
kde-base/kdebindings kde-base/krosspython
kde-base/kdebindings kde-base/krossruby
kde-base/kdebindings kde-base/pykde4
kde-base/kdebindings kde-base/qyoto
kde-base/kdebindings kde-base/qtjava
kde-base/kdebindings kde-base/qtruby
kde-base/kdebindings kde-base/qtsharp
kde-base/kdebindings kde-base/smoke
kde-base/kdebindings kde-base/xparts
kde-base/kdeedu kde-base/blinken
kde-base/kdeedu kde-base/kalgebra
kde-base/kdeedu kde-base/kalzium
kde-base/kdeedu kde-base/kanagram
kde-base/kdeedu kde-base/kbruch
kde-base/kdeedu kde-base/kgeography
kde-base/kdeedu kde-base/khangman
kde-base/kdeedu kde-base/kig
kde-base/kdeedu kde-base/kiten
kde-base/kdeedu kde-base/klettres
kde-base/kdeedu kde-base/kmplot
kde-base/kdeedu kde-base/kpercentage
kde-base/kdeedu kde-base/kstars
kde-base/kdeedu kde-base/ktouch
kde-base/kdeedu kde-base/kturtle
kde-base/kdeedu kde-base/kwordquiz
kde-base/kdeedu kde-base/libkdeedu
kde-base/kdeedu kde-base/marble
kde-base/kdeedu kde-base/parley
kde-base/kdegames kde-base/bovo
kde-base/kdegames kde-base/katomic
kde-base/kdegames kde-base/kbattleship
kde-base/kdegames kde-base/kblackbox
kde-base/kdegames kde-base/kbounce
kde-base/kdegames kde-base/kfourinline
kde-base/kdegames kde-base/kgoldrunner
kde-base/kdegames kde-base/kiriki
kde-base/kdegames kde-base/kjumpingcube
kde-base/kdegames kde-base/klines
kde-base/kdegames kde-base/kmahjongg
kde-base/kdegames kde-base/kmines
kde-base/kdegames kde-base/knetwalk
kde-base/kdegames kde-base/kolf
kde-base/kdegames kde-base/konquest
kde-base/kdegames kde-base/kpat
kde-base/kdegames kde-base/kreversi
kde-base/kdegames kde-base/ksame
kde-base/kdegames kde-base/kshisen
kde-base/kdegames kde-base/kspaceduel
kde-base/kdegames kde-base/ksquares
kde-base/kdegames kde-base/ksudoku
kde-base/kdegames kde-base/ktuberling
kde-base/kdegames kde-base/libkdegames
kde-base/kdegames kde-base/libkmahjongg
kde-base/kdegames kde-base/lskat
kde-base/kdegraphics kde-base/gwenview
kde-base/kdegraphics kde-base/kamera
kde-base/kdegraphics kde-base/kcolorchooser
kde-base/kdegraphics kde-base/kgamma
kde-base/kdegraphics kde-base/kghostview
kde-base/kdegraphics kde-base/kolourpaint
kde-base/kdegraphics kde-base/kruler
kde-base/kdegraphics kde-base/ksnapshot
kde-base/kdegraphics kde-base/libkscan
kde-base/kdegraphics kde-base/okular
kde-base/kdegraphics kde-base/svgpart
kde-base/kdemultimedia kde-base/juk
kde-base/kdemultimedia kde-base/kdemultimedia-kioslaves
kde-base/kdemultimedia kde-base/kmix
kde-base/kdemultimedia kde-base/kscd
kde-base/kdemultimedia kde-base/libkcddb
kde-base/kdemultimedia kde-base/libkcompactdisc
kde-base/kdenetwork kde-base/kdenetwork-filesharing
kde-base/kdenetwork kde-base/kdnssd
kde-base/kdenetwork kde-base/kget
kde-base/kdenetwork kde-base/knewsticker
kde-base/kdenetwork kde-base/kopete
kde-base/kdenetwork kde-base/kppp
kde-base/kdenetwork kde-base/krdc
kde-base/kdenetwork kde-base/krfb
kde-base/kdenetwork kde-base/klanbrowsing
kde-base/kdenetwork kde-base/kwifimanager
kde-base/kdenetwork kde-base/lisa
kde-base/kdepim kde-base/akonadi
kde-base/kdepim kde-base/akregator
kde-base/kdepim kde-base/certmanager
kde-base/kdepim kde-base/kabc2mutt
kde-base/kdepim kde-base/kabcclient
kde-base/kdepim kde-base/kaddressbook
kde-base/kdepim kde-base/kalarm
kde-base/kdepim kde-base/kdemaildir
kde-base/kdepim kde-base/kdepim-kioslaves
kde-base/kdepim kde-base/kdepim-kresources
kde-base/kdepim kde-base/kdepim-wizards
kde-base/kdepim kde-base/kfeed
kde-base/kdepim kde-base/kitchensync
kde-base/kdepim kde-base/kleopatra
kde-base/kdepim kde-base/kmail
kde-base/kdepim kde-base/kmailcvt
kde-base/kdepim kde-base/kmobiletools
kde-base/kdepim kde-base/knode
kde-base/kdepim kde-base/knotes
kde-base/kdepim kde-base/kode
kde-base/kdepim kde-base/konsolekalendar
kde-base/kdepim kde-base/kontact
kde-base/kdepim kde-base/kontact-specialdates
kde-base/kdepim kde-base/korganizer
kde-base/kdepim kde-base/korn
kde-base/kdepim kde-base/kpilot
kde-base/kdepim kde-base/ktimetracker
kde-base/kdepim kde-base/ktnef
kde-base/kdepim kde-base/libkdepim
kde-base/kdepim kde-base/libkholidays
kde-base/kdepim kde-base/libkleo
kde-base/kdepim kde-base/libkpgp
kde-base/kdepim kde-base/libksieve
kde-base/kdepim kde-base/mailtransport
kde-base/kdepim kde-base/mimelib
kde-base/kdepim kde-base/networkstatus
kde-base/kdesdk kde-base/cervisia
kde-base/kdesdk kde-base/kdeaccounts-plugin
kde-base/kdesdk kde-base/kapptemplate
kde-base/kdesdk kde-base/kate
kde-base/kdesdk kde-base/kbabel
kde-base/kdesdk kde-base/kbugbuster
kde-base/kdesdk kde-base/kcachegrind
kde-base/kdesdk kde-base/kdesdk-kioslaves
kde-base/kdesdk kde-base/kdesdk-misc
kde-base/kdesdk kde-base/kdesdk-scripts
kde-base/kdesdk kde-base/kmtrace
kde-base/kdesdk kde-base/kompare
kde-base/kdesdk kde-base/kspy
kde-base/kdesdk kde-base/kstartperf
kde-base/kdesdk	kde-base/strigi-analyzer
kde-base/kdesdk kde-base/kuiviewer
kde-base/kdesdk kde-base/poxml
kde-base/kdesdk kde-base/umbrello
kde-base/kdetoys kde-base/amor
kde-base/kdetoys kde-base/kteatime
kde-base/kdetoys kde-base/ktux
kde-base/kdetoys kde-base/kweather
kde-base/kdetoys kde-base/kworldclock
kde-base/kdeutils kde-base/ark
kde-base/kdeutils kde-base/kcalc
kde-base/kdeutils kde-base/kcharselect
kde-base/kdeutils kde-base/kdessh
kde-base/kdeutils kde-base/kdf
kde-base/kdeutils kde-base/kedit
kde-base/kdeutils kde-base/kfloppy
kde-base/kdeutils kde-base/kgpg
kde-base/kdeutils kde-base/khexedit
kde-base/kdeutils kde-base/kjots
kde-base/kdeutils kde-base/kmilo
kde-base/kdeutils kde-base/kregexpeditor
kde-base/kdeutils kde-base/kdessh
kde-base/kdeutils kde-base/ktimer
kde-base/kdeutils kde-base/kwallet
kde-base/kdeutils kde-base/superkaramba
kde-base/kdeutils kde-base/sweeper
kde-base/kdewebdev kde-base/kfilereplace
kde-base/kdewebdev kde-base/kimagemapeditor
kde-base/kdewebdev kde-base/klinkstatus
kde-base/kdewebdev kde-base/kxsldbg
kde-base/kdewebdev kde-base/quanta
app-office/koffice app-office/karbon
app-office/koffice app-office/kchart
app-office/koffice app-office/kexi
app-office/koffice app-office/kformula
app-office/koffice app-office/kivio
app-office/koffice app-office/koffice-data
app-office/koffice app-office/koffice-libs
app-office/koffice app-office/koshell
app-office/koffice app-office/kplato
app-office/koffice app-office/kpresenter
app-office/koffice app-office/krita
app-office/koffice app-office/kspread
app-office/koffice app-office/kugar
app-office/koffice app-office/kword
'

# @FUNCTION: get-parent-package
# @USAGE: get-parent-package <split ebuild>
# @DESCRIPTION:
# Echoes the name of the monolithic package that a given split ebuild was derived from.
get-parent-package() {
	local parent child
	while read parent child; do
		if [[ "${child}" == "$1" ]]; then
			echo ${parent}
			return 0
		fi
	done <<< "$KDE_DERIVATION_MAP"
	die "Package $target not found in KDE_DERIVATION_MAP, please report bug"
}

# @FUNCTION: get-child-packages
# @USAGE: get-child-packages <monolithic ebuild>
# @DESCRIPTION:
# Echoes the names of all (split) ebuilds derived from a given monolithic ebuild.
get-child-packages() {
	local parent child
	while read parent child; do
		[[ "${parent}" == "$1" ]] && echo -n "${child} "
	done <<< "$KDE_DERIVATION_MAP"
}

# @FUNCTION:
# @USAGE: is-parent-package <$CATEGORY/$PN>
# @DESCRIPTION:
# Returns zero exit-status if the given package is a parent (monolithic) ebuild.
# Returns non-zero exit-status if it's not.
is-parent-package() {
	local parent child
	while read parent child; do
		[[ "${parent}" == "$1" ]] && return 0
	done <<< "$KDE_DERIVATION_MAP"
	return 1
}

# @FUNCTION: buildsycoca
# @DESCRIPTION:
# Function to rebuild the KDE System Configuration Cache.
# All KDE ebuilds should run this in pkg_postinst and pkg_postrm.
#
# Note that kde4-base.eclass already does this.
buildsycoca() {
	debug-print-function ${FUNCNAME} "$@"

	if [[ -x ${KDEDIR}/bin/kbuildsycoca4 ]] && [[ -z "${ROOT}" || "${ROOT}" == "/" ]]; then
		# First of all, make sure that the /usr/share/services directory exists
		# and it has the right permissions
		mkdir -p /usr/share/services
		chown root:0 /usr/share/services
		chmod 0755 /usr/share/services

		# kbuildsycoca4 needs a running dbus session to work correctly.
		# We have to start a new dbus session, because the DBUS_SESSION_BUS_ADDRESS in the environment
		# could from from the user's environment (through su [without '-']), causing kbuildsycoca4 to hang.

		einfo "Starting dbus session for kbuildsycoca4"
		local _i
		for _i in $(dbus-launch); do
			# We export both the ADDRESS _and_ the PID. We need the latter only to kill our session.
			debug-print "Exporting: ${_i}"
			export "${_i}";
		done
		debug-print "kbuildsycoca4 is using ${DBUS_SESSION_BUS_ADDRESS}"

		ebegin "Running kbuildsycoca4 to build global database"
		# This is needed because we support multiple kde versions installed together.
		XDG_DATA_DIRS="/usr/share:${KDEDIRS}/share:/usr/local/share"
		${KDEDIR}/bin/kbuildsycoca4 --global --noincremental &> /dev/null
		eend $?

		einfo "Killing dbus session for kbuildsycoca4"
		debug-print "ADDRES ${DBUS_SESSION_BUS_ADDRESS}"
		debug-print "PID: ${DBUS_SESSION_BUS_PID}"
		kill ${DBUS_SESSION_BUS_PID}
		eend $?
		unset DBUS_SESSION_BUS_ADDRES DBUS_SESSION_BUS_PID
	fi
}

# @FUNCTION: comment_all_add_subdirectory
# @DESCRIPTION:
# recursively comment all add_subdirectory instructions in except the ones in
# cmake/.
comment_all_add_subdirectory() {
	find "$@" -name CMakeLists.txt -print0 | grep -vFzZ "./cmake" | \
		xargs -0 sed -i -e '/add_subdirectory/s/^/#DONOTCOMPILE /' || \
		die "${LINENO}: Initial sed died"
}

# @VARIABLE: QT4_BUILT_WITH_USE_CHECK
# @DESCRIPTION:
# A list of USE flags that x11-libs/qt:4 needs to be built with.
#
# This list is automatically appended to KDE4_BUILT_WITH_USE_CHECK,
# so don't call qt4_pkg_setup manually.

# @VARIABLE: KDE4_BUILT_WITH_USE_CHECK
# @DESCRIPTION:
# The contents of $KDE4_BUILT_WITH_USE_CHECK gets fed to built_with_use
# (eutils.eclass), line per line.
#
# Example:
# pkg_setup() {
#	KDE4_BUILT_WITH_USE_CHECK="--missing true sys-apps/dbus X"
#	use alsa && KDE4_BUILT_WITH_USE_CHECK="${KDE4_BUILT_WITH_USE_CHECK}
#		--missing true media-libs/alsa-lib midi"
#	kde4-base_pkg_setup
# }

# run built_with_use on each flag and print appropriate error messages if any
# flags are missing
_kde4-functions_built_with_use() {
	local missing opt pkg flag flags

	if [[ ${1} = "--missing" ]]; then
		missing="${1} ${2}" && shift 2
	fi
	if [[ ${1:0:1} = "-" ]]; then
		opt=${1} && shift
	fi

	pkg=${1} && shift

	for flag in "${@}"; do
		flags="${flags} ${flag}"
		if ! built_with_use ${missing} ${opt} ${pkg} ${flag}; then
			flags="${flags}*"
		else
			[[ ${opt} = "-o" ]] && return 0
		fi
	done
	if [[ "${flags# }" = "${@}" ]]; then
		return 0
	fi
	if [[ ${opt} = "-o" ]]; then
		eerror "This package requires '${pkg}' to be built with any of the following USE flags: '$*'."
	else
		eerror "This package requires '${pkg}' to be built with the following USE flags: '${flags# }'."
	fi
	return 1
}

# @FUNCTION: kde4-functions_check_use
# @DESCRIPTION:
# - Check if the Qt4 libraries are built with the USE flags
#	listed in $QT4_BUILT_WITH_USE_CHECK.
# - Check if a list of packages are built with certain USE flags,
#	as listed in $KDE4_BUILT_WITH_USE_CHECK.
#
# If any of the required USE flags are missing, an eerror will be printed for
# each package with missing USE flags.
kde4-functions_check_use() {
	# I like to keep flags sorted
	QT4_BUILT_WITH_USE_CHECK=$(echo "${QT4_BUILT_WITH_USE_CHECK}" | \
		tr '[:space:]' '\n' | sort | xargs)

	KDE4_BUILT_WITH_USE_CHECK="x11-libs/qt:4 ${QT4_BUILT_WITH_USE_CHECK}
				${KDE4_BUILT_WITH_USE_CHECK}"

	local line missing
	while read line; do
		[[ -z ${line} ]] && continue
		if ! _kde4-functions_built_with_use ${line}; then
			missing=true
		fi
	done <<< "${KDE4_BUILT_WITH_USE_CHECK}"
	if [[ -n ${missing} ]]; then
		echo
		eerror "Flags marked with an * are missing."
		die "Missing USE flags found"
	fi
}

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-dev] New eclasses for KDE 4
  2008-01-11 23:22 [gentoo-dev] New eclasses for KDE 4 Wulf C. Krueger
@ 2008-01-12  0:19 ` Vlastimil Babka
  2008-01-13  0:23 ` Donnie Berkholz
  1 sibling, 0 replies; 3+ messages in thread
From: Vlastimil Babka @ 2008-01-12  0:19 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Wulf C. Krueger wrote:
| We would welcome any comments, especially if accompanied by patches ;)
| and, of course, your kind approval to commit it. :-)

Hi,

Checked only briefly, it's late :) but I miss a comment in the header
that you need EAPI=1 in ebuild to use this eclass (slot deps...),
perhaps a check that it's really set?


And some small things I noticed:
DEPEND="${DEPEND} - first time you define DEPEND it's empty, no? Not
carried from eclass to eclass (as it used to be when the portage
behavior was broken IIRC) but separate in each eclass.

kde4-meta.eclass says # @ECLASS: kde4-functions.eclass

The (non-existing atm :) Copyright could use 2008 already :)

VB
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.8 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkeIB5wACgkQtbrAj05h3oTtbQCeM+V7yKKG5uOLablx357W8QId
2KAAn1bTJvdZ8wM+38QgWBnHwGO0cbB0
=rVAg
-----END PGP SIGNATURE-----
-- 
gentoo-dev@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-dev] New eclasses for KDE 4
  2008-01-11 23:22 [gentoo-dev] New eclasses for KDE 4 Wulf C. Krueger
  2008-01-12  0:19 ` Vlastimil Babka
@ 2008-01-13  0:23 ` Donnie Berkholz
  1 sibling, 0 replies; 3+ messages in thread
From: Donnie Berkholz @ 2008-01-13  0:23 UTC (permalink / raw
  To: gentoo-dev

On 00:22 Sat 12 Jan     , Wulf C. Krueger wrote:
> Hello, fellow Gentoo devs!
> 
> Attached you'll find the new eclasses for KDE 4. We'd like to commit them 
> on Sunday, 14th, to be able to get KDE 4.0.0 into the official tree 
> (package.masked, though).
> 
> We would welcome any comments, especially if accompanied by patches ;) 
> and, of course, your kind approval to commit it. :-)

Could you use has() instead of hasq() ?

Thanks,
Donnie
-- 
gentoo-dev@lists.gentoo.org mailing list



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-13  0:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-11 23:22 [gentoo-dev] New eclasses for KDE 4 Wulf C. Krueger
2008-01-12  0:19 ` Vlastimil Babka
2008-01-13  0:23 ` Donnie Berkholz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox