summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass')
-rw-r--r--eclass/kde4-base.eclass36
-rw-r--r--eclass/kde4-functions.eclass31
2 files changed, 57 insertions, 10 deletions
diff --git a/eclass/kde4-base.eclass b/eclass/kde4-base.eclass
index 9ac67447696b..142c2fc4e020 100644
--- a/eclass/kde4-base.eclass
+++ b/eclass/kde4-base.eclass
@@ -1,6 +1,6 @@
# Copyright 2007-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-base.eclass,v 1.7 2008/04/03 18:12:48 philantrop Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-base.eclass,v 1.8 2008/04/04 22:15:24 zlin Exp $
# @ECLASS: kde4-base.eclass
# @MAINTAINER:
@@ -350,7 +350,8 @@ kde4-base_pkg_setup() {
# Apply ${PN}-${PV}-*{diff,patch}
# @CODE
#
-# If ${PATCHES} is non-zero all patches in it gets applied.
+# If ${PATCHES} is non-zero all patches in it get applied. If there is more
+# than one patch please make ${PATCHES} an array for proper quoting.
kde4-base_apply_patches() {
local _patchdir _packages _p
_patchdir="${WORKDIR}/patches/"
@@ -361,14 +362,23 @@ kde4-base_apply_patches() {
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
+ if [[ ${#PATCHES[@]} -gt 1 ]]; then
+ 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
+ else
+ 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
fi
- [[ -n ${PATCHES} ]] && base_src_unpack autopatch
+ [[ -n ${PATCHES[@]} ]] && base_src_unpack autopatch
}
# @FUNCTION: kde4-base_src_unpack
@@ -380,6 +390,9 @@ kde4-base_apply_patches() {
#
# In addition it calls kde4-base_apply_patches when no arguments are passed to
# this function.
+#
+# 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_unpack() {
debug-print-function $FUNCNAME "$@"
@@ -404,6 +417,11 @@ kde4-base_src_unpack() {
ln -s "${WORKDIR}/cmake" "${KDE_S}/cmake" || die "Unable to symlink the new cmake/ directory"
eend 0
fi
+
+ # Only enable selected languages, used for KDE extragear apps.
+ if [[ -n ${KDE_LINGUAS} ]]; then
+ enable_selected_linguas
+ fi
}
# @FUNCTION: kde4-base_src_compile
diff --git a/eclass/kde4-functions.eclass b/eclass/kde4-functions.eclass
index 89092e6b8190..39fc3d08a0c9 100644
--- a/eclass/kde4-functions.eclass
+++ b/eclass/kde4-functions.eclass
@@ -1,6 +1,6 @@
# 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.4 2008/03/13 17:57:51 ingmar Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/kde4-functions.eclass,v 1.5 2008/04/04 22:15:24 zlin Exp $
# @ECLASS: kde4-functions.eclass
# @MAINTAINER:
@@ -401,6 +401,35 @@ comment_all_add_subdirectory() {
die "${LINENO}: Initial sed died"
}
+# @ECLASS-VARIABLE: KDE_LINGUAS
+# @DESCRIPTION:
+# This is a whitespace-separated list of translations that this ebuild supports.
+# These translations automatically get added to IUSE. Therefore ebuilds must set
+# this variable before inheriting any eclasses. To only enable 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 what translations are
+# supported (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
+ comment_all_add_subdirectory "${KDE_LINGUAS_DIR:-${S}/po}"
+ for lingua in ${KDE_LINGUAS}; do
+ if use linguas_${lingua}; then
+ sed -e "/add_subdirectory(\s*${lingua}\s*)\s*$/ s/^#DONOTCOMPILE //" \
+ -i "${KDE_LINGUAS_DIR:-${S}/po}"/CMakeLists.txt || die "Sed to uncomment linguas_${lingua} failed."
+ fi
+ done
+}
+
# @ECLASS-VARIABLE: QT4_BUILT_WITH_USE_CHECK
# @DESCRIPTION:
# A list of USE flags that x11-libs/qt:4 needs to be built with.