Skip to contentSkip to conversation

gettext changes to solve bug #7124

PATCH Superseded Thomas Petazzoni 2 participants 5 messages Aug 15, 2014 – Aug 16, 2014

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover gettext changes to solve bug #7124

Hello,

Here is a third version of the gettext changes, that include the comments made by Thomas DS on the manual (PATCH 3/3).

Since they actually fix a runtime issue with ecryptfs-utils, reported as bug #7124, I'd like them to be considered for 2014.08.

Basically, the core of the issue is that the numerous ecryptfs-utils shell scripts use the "gettext" program on the target to query translated strings. However, with glibc toolchains, we do not allow the selection of the gettext package, because the gettext *functions* are already part of the C library.

However, this totally overlooks the fact that gettext provides more than a library, it also provides utilities, which in the case of ecryptfs-utils, are needed on the target.

Moreover, the gettext configure script is smart enough to *not* generate libintl.so when the C library already has the gettext function. It therefore has the right behavior depending on the C
library: for glibc, only the gettext "utilities" are installed, for uClibc, both libintl and the gettext utilities are installed.

These three patches are just a new version rebased on top of master, and re-tested.

Long term, maybe we should rename BR2_NEEDS_GETTEXT and BR2_NEEDS_GETTEXT_IF_LOCALE to BR2_NEEDS_LIBINTL and BR2_NEEDS_LIBINTL_IF_LOCALE, because this is really what those config knobs mean.

Thanks,

Thomas

Thomas Petazzoni (3):
gettext: allow building when BR2_NEEDS_GETTEXT is not selected
ecryptfs-utils: select gettext, needed for command line utilities docs/manual: update documentation about gettext handling

 docs/manual/adding-packages-gettext.txt | 29 ++++++++++++++++++++++-------
 package/ecryptfs-utils/Config.in        |  8 ++++++--
 package/gettext/Config.in               |  1 -
 3 files changed, 28 insertions(+), 10 deletions(-)
Signature · 1 line
2.0.0
#1 lore raw

PATCH v3 1/3 gettext: allow building when BR2_NEEDS_GETTEXT is not selected

Until now, we thought that gettext was only needed for the target for uClibc toolchains, to provide the gettext functions that are normally provided directly by glibc.

However, the gettext runtime actually does more than providing the equivalent of those C library functions: it also provides certain command line tools, like 'gettext' to get translated strings from the shell. This tool is for example used by certain ecryptfs-utils scripts to get translated strings. It is therefore necessary to be able to build the gettext package even for glibc toolchains.

---
 package/gettext/Config.in | 1 -
 1 file changed, 1 deletion(-)
package/gettext/Config.in +0 -1
index 158b14e..7871a48 100644
@@ -1,6 +1,5 @@
 config BR2_PACKAGE_GETTEXT
 	bool "gettext"
-	depends on BR2_NEEDS_GETTEXT
 	depends on BR2_USE_WCHAR
 	help
 	  The GNU `gettext' utilities are a set of tools that provide a
Signature · 1 line
2.0.0
#2 lore raw

PATCH v3 2/3 ecryptfs-utils: select gettext, needed for command line utilities

In reply to Thomas Petazzoni

The ecryptfs-utils package requires the 'gettext' program, which is provided by the gettext package, to get translated strings. This is needed regardless of whether the toolchain uses glibc or uClibc.

This issue was reported by 'ausjke' on IRC.

---
 package/ecryptfs-utils/Config.in | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
package/ecryptfs-utils/Config.in +6 -2
index 076e1d4..7999ea5 100644
@@ -2,6 +2,10 @@ config BR2_PACKAGE_ECRYPTFS_UTILS
 	bool "ecryptfs-utils"
 	select BR2_PACKAGE_KEYUTILS
 	select BR2_PACKAGE_LIBNSS
+	# runtime dependency only, some scripts are using the
+	# 'gettext' program to get translations
+	select BR2_PACKAGE_GETTEXT
+	depends on BR2_USE_WCHAR # gettext
 	depends on BR2_USE_MMU # keyutils
 	depends on !BR2_avr32 && !BR2_microblaze # keyutils
 	depends on BR2_LARGEFILE # libnss
@@ -23,8 +27,8 @@ config BR2_PACKAGE_ECRYPTFS_UTILS
 
 	  http://ecryptfs.org
 
-comment "ecryptfs-utils needs a toolchain w/ largefile, threads"
+comment "ecryptfs-utils needs a toolchain w/ largefile, threads, wchar"
 	depends on !BR2_avr32 && !BR2_microblaze
 	depends on BR2_PACKAGE_LIBNSPR_ARCH_SUPPORT
 	depends on BR2_USE_MMU
-	depends on !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_LARGEFILE || !BR2_TOOLCHAIN_HAS_THREADS || !BR2_USE_WCHAR
Signature · 1 line
2.0.0
#3 lore raw

PATCH v3 3/3 docs/manual: update documentation about gettext handling

In reply to Thomas Petazzoni

This commit updates the Buildroot manual regarding how gettext related issues are handled, now that we have cases where the gettext package should be selected even with glibc toolchains.

---
 docs/manual/adding-packages-gettext.txt | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)
docs/manual/adding-packages-gettext.txt +22 -7
index d265607..14b8a96 100644
@@ -8,15 +8,22 @@ library. Dependencies for this library are fairly complicated and
 therefore, deserve some explanation.
 
 The 'uClibc' C library doesn't implement gettext functionality;
-therefore with this C library, a separate gettext must be compiled. On
-the other hand, the 'glibc' C library does integrate its own gettext,
-and in this case the separate gettext library should not be compiled,
-because it creates various kinds of build failures.
+therefore with this C library, a separate gettext must be compiled,
+which is provided by the additional +libintl+ library, part of the
++gettext+ package.
+
+On the other hand, the 'glibc' C library does integrate its own
+gettext library functions, so it is not necessary to build a separate
++libintl+ library.
+
+However, certain packages need some gettext utilities on the target,
+such as the +gettext+ program itself, which allows to retrieve
+translated strings, from the command line,
 
 Additionally, some packages (such as +libglib2+) do require gettext
-unconditionally, while other packages (those who support
-+--disable-nls+ in general) only require gettext when locale support
-is enabled.
+functions unconditionally, while other packages (those who support
++--disable-nls+ in general) only require gettext functions when locale
+support is enabled.
 
 Therefore, Buildroot defines two configuration options:
 
@@ -44,3 +51,11 @@ should:
 * use +$(if $(BR2_NEEDS_GETTEXT),gettext)+ in the package
   +DEPENDENCIES+ variable in the +.mk+ file.
 
+Packages that need the +gettext+ utilities on the target (should be
+rare) should:
+
+* use +select BR2_PACKAGE_GETTEXT+ in their +Config.in+ file,
+  indicating in a comment above that it's a runtime dependency only.
+
+* not add any +gettext+ dependency in the +DEPENDENCIES+ variable of
+  their +.mk+ file.
Signature · 1 line
2.0.0
#4 lore raw

PATCH v3 3/3 docs/manual: update documentation about gettext handling

Thomas Petazzoni <[email protected]> schreef:

Quoted 22 lines

This commit updates the Buildroot manual regarding how gettext related issues are handled, now that we have cases where the gettext package should be selected even with glibc toolchains.

---
docs/manual/adding-packages-gettext.txt | 29 ++++++++++++++++++++++-------

1 file changed, 22 insertions(+), 7 deletions(-)
docs/manual/adding-packages-gettext.txt +0 -0
index d265607..14b8a96 100644
@@ -8,15 +8,22 @@ library. Dependencies for this library are fairly complicated and

therefore, deserve some explanation.

The 'uClibc' C library doesn't implement gettext functionality;

docs/manual/adding-packages-gettext.txt +1 -4
-therefore with this C library, a separate gettext must be compiled. On
-the other hand, the 'glibc' C library does integrate its own gettext,
-and in this case the separate gettext library should not be compiled,
-because it creates various kinds of build failures.
+therefore with this C library, a separate gettext must be compiled,

docs/manual/adding-packages-gettext.txt library. Dependencies for this library are fairly complicated and · line 21

Quoted 10 lines
docs/manual/adding-packages-gettext.txt +10 -0
+which is provided by the additional +libintl+ library, part of the
++gettext+ package.
+
+On the other hand, the 'glibc' C library does integrate its own
+gettext library functions, so it is not necessary to build a separate
++libintl+ library.
+
+However, certain packages need some gettext utilities on the target,
+such as the +gettext+ program itself, which allows to retrieve
+translated strings, from the command line,

This should end in a dot, not a comma.

docs/manual/adding-packages-gettext.txt library. Dependencies for this library are fairly complicated and · line 26

Quoted 8 lines

Additionally, some packages (such as +libglib2+) do require gettext

docs/manual/adding-packages-gettext.txt +3 -3
-unconditionally, while other packages (those who support
-+--disable-nls+ in general) only require gettext when locale support
-is enabled.
+functions unconditionally, while other packages (those who support
++--disable-nls+ in general) only require gettext functions when locale
+support is enabled.

Reading this again, and assuming you mean that packages that support this flag typically only require
gettext functions when locale support is enabled, I think the 'in general' should better be placed in the beginning
of the sentence, thus:
(in general, those who support...)

Quoted 5 lines

Therefore, Buildroot defines two configuration options:

docs/manual/adding-packages-gettext.txt +0 -0
@@ -44,3 +51,11 @@ should:
 * use +$(if $(BR2_NEEDS_GETTEXT),gettext)+ in the package

docs/manual/adding-packages-gettext.txt should: · line 61

Quoted 10 lines
docs/manual/adding-packages-gettext.txt +8 -0
  +DEPENDENCIES+ variable in the +.mk+ file.
 
+Packages that need the +gettext+ utilities on the target (should be
+rare) should:
+
+* use +select BR2_PACKAGE_GETTEXT+ in their +Config.in+ file,
+  indicating in a comment above that it's a runtime dependency only.
+
+* not add any +gettext+ dependency in the +DEPENDENCIES+ variable of
+  their +.mk+ file.

Best regards,
Thomas