Gentoo Archives: gentoo-dev

From: Michael Palimaka <kensington@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Patch: Linguas USE support for cmake-utils.eclass
Date: Sat, 23 Jun 2012 17:40:06
Message-Id: 4FE5FEF7.2020800@gentoo.org
Hi,

A number of package using cmake and qmake currently do something like this:

LANGS="en de fr"
for x in ${LANGS}; do
         IUSE="${IUSE} linguas_${x}"
done

This is ugly, so for some time the loop has been included in qt4-r2, and 
I'd also like to add it to cmake-utils.

As far as I can see, this change will have no visible effect on ebuilds 
that already manually include the loop, and will cause only one package 
to get linguas_* flags that it doesn't already have (which I'll fix).

Thoughts?

--- cmake-utils.eclass
+++ cmake-utils.eclass
@@ -20,0 +21,29 @@
+# @ECLASS-VARIABLE: LANGS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# In case your application provides various translations, use this 
variable to specify
+# them in order to populate "linguas_*" IUSE automatically. Make sure 
that you set this
+# variable before inheriting cmake-utils eclass.
+# Example:
+# @CODE
+#   LANGS="en el de"
+# @CODE
+for x in ${LANGS}; do
+       IUSE+=" linguas_${x}"
+done
+
+# @ECLASS-VARIABLE: LANGSLONG
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Same as above, but this variable is for LINGUAS that must be in long 
format.
+# Remember to set this variable before inheriting cmake-utils eclass.
+# Look at ${PORTDIR}/profiles/desc/linguas.desc for details.
+# Example:
+# @CODE
+#   LANGS="de_DE hu_HU"
+# @CODE
+for x in ${LANGSLONG}; do
+       IUSE+=" linguas_${x%_*}"
+done
+unset x
+

Best regards,
Michael

Replies