Gentoo Archives: gentoo-dev

From: Mike Gilbert <floppym@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Understanding the LINGUAS variable and use-expand
Date: Wed, 08 Feb 2012 16:33:12
Message-Id: CAJ0EP43+=qVsJqLmSUqZexq209-im5emVRm=JgnBF20v3-fORw@mail.gmail.com
1 I just want to sanity-check my brain here.
2
3 LINGUAS seems to be mainly a variable to control the behavior of
4 gettext's autoconf code, installed as /usr/share/aclocal/po.m4.
5
6 If LINGUAS is set to a list of language codes, the build system will
7 only build/install MO files for those languages. If LINGUAS is unset,
8 the build system will build/install MO files for all available
9 languages.
10
11 Portage will also use-expand LINGUAS, so an ebuild *can* make use of
12 it where USE flags are needed. For example, in SRC_URI, where the USE
13 flags may be used to control downloading of extra language packs.
14
15 Given this information, I come to a few conclusions:
16
17 1. There is technically no need to define IUSE="linguas_$x" if an
18 ebuild is not using the USE flags in other ebuild metadata (like
19 SRC_URI).
20
21 2. In cases where the USE flags are needed, they should be enabled by
22 default to emulate the "default-all" behavior of the autoconf macros.
23 For example: IUSE="+linguas_fr_FR +linguas_de_DE".
24
25 3. An ebuild could use LINGUAS to control installation of translation
26 information which does not come from gettext PO files. It does not
27 necessarily need to make use of the linguas_$x USE flags to do so.
28
29 Does all of that make sense?
30
31 I am considering simplifying www-client/chromium from the current mess
32 based on the linguas USE flags to basically just this:
33
34 if [[ ${LINGUAS} ]]; then
35 for x in *.pak; do
36 mylang=${x%.pak}
37 mylang=%{x/-/_}
38 has $mylang $LINGUAS || rm $x
39 done
40 fi
41
42 As well, there are probably a few other places in the tree where
43 conclusion #1 and #2 should be applied.

Replies