commit:     c822da7f7e0261e0deda8f62e130749bcb933f2e
Author:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
AuthorDate: Mon May  5 14:45:16 2014 +0000
Commit:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
CommitDate: Mon May  5 14:45:36 2014 +0000
URL:        
http://git.overlays.gentoo.org/gitweb/?p=proj/kde.git;a=commit;h=c822da7f

[eclass] Add KDE_NLS.

---
 eclass/kde5.eclass | 49 ++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 40 insertions(+), 9 deletions(-)

diff --git a/eclass/kde5.eclass b/eclass/kde5.eclass
index f904567..900cf3e 100644
--- a/eclass/kde5.eclass
+++ b/eclass/kde5.eclass
@@ -70,6 +70,17 @@ fi
 # generate and install KDE handbook.
 KDE_HANDBOOK="${KDE_HANDBOOK:-false}"
 
+# @ECLASS-VARIABLE: KDE_NLS
+# @DESCRIPTION:
+# If set to "false", do nothing.
+# Otherwise, add "nls" to IUSE, generate and install translations based on
+# the LINGUAS environment variable.
+if [[ ${CATEGORY} = kde-frameworks ]]; then
+       : ${KDE_NLS:=true}
+else
+       : ${KDE_NLS:=false}
+fi
+
 # @ECLASS-VARIABLE: KDE_TEST
 # @DESCRIPTION:
 # If set to "false", do nothing.
@@ -134,6 +145,13 @@ case ${KDE_HANDBOOK} in
                ;;
 esac
 
+case ${KDE_NLS} in
+       false)  ;;
+       *)
+               IUSE+=" nls"
+               ;;
+esac
+
 case ${KDE_TEST} in
        false)  ;;
        *)
@@ -245,26 +263,39 @@ kde5_src_unpack() {
 kde5_src_prepare() {
        debug-print-function ${FUNCNAME} "$@"
 
+       # only build examples when required
+       if ! in_iuse examples || ! use examples ; then
+               comment_add_subdirectory examples
+       fi
+
+       # only enable handbook when required
+       if ! use_if_iuse handbook ; then
+               comment_add_subdirectory doc
+       fi
+
+       # enable only the requested translations
+       # when required
+       if use_if_iuse nls ; then
+               for lang in $(ls po) ; do
+                       if ! has ${lang} ${LINGUAS} ; then
+                               rm -r po/${lang}
+                       fi
+               done
+       else
+               rm -r po
+       fi
+
        # in frameworks, tests = manual tests so never
        # build them
        if [[ ${CATEGORY} = kde-frameworks ]]; then
                comment_add_subdirectory tests
        fi
 
-       # only build examples when required
-       if ! in_iuse examples || ! use examples ; then
-               comment_add_subdirectory examples
-       fi
-
        # only build unit tests when required
        if ! in_iuse test || ! use test ; then
                comment_add_subdirectory autotests
        fi
 
-       # only enable handbook when required
-       if ! use_if_iuse handbook ; then
-               comment_add_subdirectory doc
-       fi
 
        cmake-utils_src_prepare
 }

Reply via email to