# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/eclass/kde.eclass,v 1.224 2009/11/20 19:02:05 abcd Exp $ # @ECLASS: kde.eclass # @MAINTAINER: # kde@gentoo.org # # original author Dan Armak # # Revisions Caleb Tennis # @BLURB: The kde eclass is inherited by all kde-* eclasses. # @DESCRIPTION: # This eclass is inherited by all kde-* eclasses. Few ebuilds inherit straight from here. [[ -z ${WANT_AUTOMAKE} ]] && WANT_AUTOMAKE="1.9" inherit base eutils kde-functions flag-o-matic libtool autotools DESCRIPTION="Based on the $ECLASS eclass" HOMEPAGE="http://www.kde.org/" IUSE="debug elibc_FreeBSD" # @ECLASS-VARIABLE: KDE_S # @DESCRIPTION: # Like the 'normal' ${S} this variable takes the path to the temporary build # directory. If unset ${S} will be used. # @ECLASS-VARIABLE: USE_KEG_PACKAGING # @DESCRIPTION: # Set USE_KEG_PACKAGING=1 before inheriting if the package use extragear-like # packaging and then supports ${LANGS} and ${LANGS_DOC} variables. By default # translations are found in the po subdirectory of ${S}. Set KEG_PO_DIR to # override this default. if [[ -n ${USE_KEG_PACKAGING} && -n "${LANGS}${LANGS_DOC}" ]]; then for lang in ${LANGS} ${LANGS_DOC}; do IUSE="${IUSE} linguas_${lang}" done fi DEPEND="sys-devel/make dev-util/pkgconfig dev-lang/perl" if [[ ${CATEGORY} != "kde-base" ]] ; then DEPEND="${DEPEND} x11-libs/libXt x11-proto/xf86vidmodeproto xinerama? ( x11-proto/xineramaproto )" RDEPEND="xinerama? ( x11-libs/libXinerama )" IUSE="${IUSE} xinerama" else RDEPEND="" fi # overridden in other places like kde-dist, kde-source and some individual ebuilds SLOT="0" # @FUNCTION: kde_pkg_setup # @DESCRIPTION: # Filters some compiler flags that can break things kde_pkg_setup() { # Let filter visibility flags that will *really* hurt your KDE # _experimental_ support for this is enabled by kdehiddenvisibility useflag filter-flags -fvisibility=hidden -fvisibility-inlines-hidden } # @FUNCTION: kde_src_unpack # @DESCRIPTION: # This function unpacks the sources and patches it. The patches need to be named # $PN-$PV-*{diff,patch} # # This function also handles the linguas if extragear-like packaging is enabled. # (See USE_KEG_PACKAGING) kde_src_unpack() { debug-print-function $FUNCNAME "$@" [[ -z "${KDE_S}" ]] && KDE_S="${S}" local 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 be named $PN-$PV-*{diff,patch} and be # placed in $PATCHDIR. Monolithic ebuilds will use the split ebuild patches. [[ -d "${KDE_S}" ]] || base_src_unpack unpack if [[ -d "${PATCHDIR}" ]] ; then local packages p f if is-parent-package ${CATEGORY}/${PN} ; then packages="$(get-child-packages ${CATEGORY}/${PN})" packages="${packages//${CATEGORY}\//} ${PN}" else packages="${PN}" fi if [[ -n ${PATCHES[@]} && $(declare -p PATCHES) != 'declare -a '* ]]; then PATCHES=(${PATCHES}) fi for p in ${packages}; do for f in "${PATCHDIR}"/${p}-${PV}-*{diff,patch}; do [[ -e ${f} ]] && PATCHES+=("${f}") done if [[ -n "${KDEBASE}" ]]; then for f in "${PATCHDIR}"/${p}-${SLOT}-*{diff,patch}; do [[ -e ${f} ]] && PATCHES+=("${f}") done fi done fi [[ -n ${PATCHES[@]} ]] && base_src_unpack autopatch else # Call base_src_unpack, which has sections, to do unpacking and patching # step by step transparently as defined in the ebuild. base_src_unpack "$@" fi # if extragear-like packaging is enabled, set the translations and the # documentation depending on LINGUAS settings if [[ -n ${USE_KEG_PACKAGING} ]]; then if [[ -z ${LINGUAS} ]]; then einfo "You can drop some of the translations of the interface and" einfo "documentation by setting the \${LINGUAS} variable to the" einfo "languages you want installed." einfo einfo "Enabling all languages" else # we sanitise LINGUAS to avoid issues when a user specifies the same # linguas twice. bug #215016. local sanitised_linguas=$(echo "${LINGUAS}" | tr '[[:space:]]' '\n' | sort | uniq) if [[ -n ${LANGS} ]]; then MAKE_PO=$(echo "${sanitised_linguas} ${LANGS}" | tr '[[:space:]]' '\n' | sort | uniq -d | tr '\n' ' ') einfo "Enabling translations for: ${MAKE_PO}" sed -i -e "s:^SUBDIRS[ \t]*=.*:SUBDIRS = ${MAKE_PO}:" "${KDE_S}/${KEG_PO_DIR:-po}/Makefile.am" \ || die "sed for locale failed" rm -f "${KDE_S}/configure" fi if [[ -n ${LANGS_DOC} ]]; then MAKE_DOC=$(echo "${sanitised_linguas} ${LANGS_DOC}" | tr '[[:space:]]' '\n' | sort | uniq -d | tr '\n' ' ') einfo "Enabling documentation for: ${MAKE_DOC}" [[ -n ${MAKE_DOC} ]] && [[ -n ${DOC_DIR_SUFFIX} ]] && MAKE_DOC=$(echo "${MAKE_DOC}" | tr '\n' ' ') && MAKE_DOC="${MAKE_DOC// /${DOC_DIR_SUFFIX} }" sed -i -e "s:^SUBDIRS[ \t]*=.*:SUBDIRS = ${MAKE_DOC} ${PN}:" \ "${KDE_S}/doc/Makefile.am" || die "sed for locale failed" rm -f "${KDE_S}/configure" fi fi fi # fix the 'languageChange undeclared' bug group: touch all .ui files, so that the # makefile regenerate any .cpp and .h files depending on them. cd "${KDE_S}" debug-print "$FUNCNAME: Searching for .ui files in ${PWD}" UIFILES="$(find . -name '*.ui' -print)" debug-print "$FUNCNAME: .ui files found:" debug-print "$UIFILES" # done in two stages, because touch doens't have a silent/force mode if [[ -n "$UIFILES" ]]; then debug-print "$FUNCNAME: touching .ui files..." touch $UIFILES fi if [[ -d "${WORKDIR}/admin" ]] && [[ -d "${KDE_S}/admin" ]]; then ebegin "Updating admin/ directory..." rm -rf "${KDE_S}/admin" "${KDE_S}/configure" || die "Unable to remove old admin/ directory" ln -s "${WORKDIR}/admin" "${KDE_S}/admin" || die "Unable to symlink the new admin/ directory" eend 0 fi } # dull function for keep working eapi2 and later kde_src_prepare() { : # prevent the patches applied twice; we cant repatch src_unpack onto two # functions (unpack and prepare) } # @FUNCTION: kde_src_configure # @USAGE: [ myconf ] [ configure ] [ all ] # @DESCRIPTION: # This function compiles the sources. It takes care of "cannot write to .kde # or .qt"-problem due to sandbox and some other sandbox issues. # # If no argument is given, all is assumed. kde_src_configure() { debug-print-function $FUNCNAME "$@" [[ -z "$1" ]] && kde_src_configure all [[ -z "${KDE_S}" ]] && KDE_S="${S}" cd "${KDE_S}" export kde_widgetdir="$KDEDIR/$(get_libdir)/kde3/plugins/designer" # fix the sandbox errors "can't writ to .kde or .qt" problems. # this is a fake homedir that is writeable under the sandbox, so that the build process # can do anything it wants with it. REALHOME="$HOME" mkdir -p "${T}"/fakehome/.kde mkdir -p "${T}"/fakehome/.qt export HOME="${T}"/fakehome addwrite "${QTDIR}/etc/settings" # Fix bug 96177: if KDEROOTHOME is defined, the ebuild accesses the real homedir via it, and not our exported $HOME unset KDEHOME unset KDEROOTHOME # things that should access the real homedir [[ -d "$REALHOME/.ccache" ]] && ln -sf "$REALHOME/.ccache" "$HOME/" while [[ "$1" ]]; do case $1 in myconf) debug-print-section myconf if [[ ${CATEGORY} != "kde-base" ]] || [[ ${CATEGORY} == "kde-base" && ${PV##*.} -lt 10 ]] ; then myconf+=" --with-x --enable-mitshm $(use_with xinerama) --with-qt-dir=${QTDIR} --enable-mt --with-qt-libraries=${QTDIR}/$(get_libdir)" else myconf+=" --with-qt-dir=${QTDIR} --enable-mt --with-qt-libraries=${QTDIR}/$(get_libdir)" fi # calculate dependencies separately from compiling, enables ccache to work on kde compiles myconf="$myconf --disable-dependency-tracking" if use debug ; then myconf="$myconf --enable-debug=full --with-debug" else myconf="$myconf --disable-debug --without-debug" fi if hasq kdeenablefinal ${IUSE}; then myconf="$myconf $(use_enable kdeenablefinal final)" fi myconf="$myconf --without-arts" debug-print "$FUNCNAME: myconf: set to ${myconf}" ;; configure) debug-print-section configure debug-print "$FUNCNAME::configure: myconf=$myconf" export WANT_AUTOMAKE # rebuild configure script, etc # This can happen with e.g. a cvs snapshot if [[ ! -f "./configure" ]]; then # This is needed to fix building with autoconf 2.60. # Many thanks to who preferred such a stupid check rather # than a working arithmetic comparison. if [[ -f admin/cvs.sh ]]; then sed -i -e '/case $AUTO\(CONF\|HEADER\)_VERSION in/,+1 s/2\.5/2.[56]/g' \ admin/cvs.sh fi # Replace the detection script with a dummy, let our wrappers do the work if [[ -f admin/detect-autoconf.sh ]]; then cat - > admin/detect-autoconf.sh <