Skip to contentSkip to conversation

Add gettext-tiny package

PATCH New Vadim Kochan 3 participants 12 messages Dec 23, 2018 – Jan 4, 2019 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

cover Add gettext-tiny package

Add lightweight alternative for the GNU gettext package - gettext-tiny. The sources are used from sabotage-linux project. Some files were copied from the original gettext like po/* and gettextize files.

The original gettext package is renamed to gettext-gnu because now gettext is a virtual package and gettext-gnu and gettext-tiny became as gettext providers.

Vadim Kochan (2):
package/gettext: Turn into virtual package
package/gettext-tiny: Add new package

 DEVELOPERS                                         |    3 +
 .../0001-error_print_progname.patch                |    0
 .../0002-Update-after-gnulib-changed.patch         |    0
 .../gettext.hash => gettext-gnu/gettext-gnu.hash}  |    0
 package/gettext-gnu/gettext-gnu.mk                 |  103 ++
 ...-format-not-a-string-literal-error-for-gc.patch |   51 +
 ...l-Use-gettext-wrappers-if-NLS-is-disabled.patch |   26 +
 package/gettext-tiny/files/ABOUT-NLS               | 1379 ++++++++++++++++++++
 package/gettext-tiny/files/gettextize              | 1346 +++++++++++++++++++
 package/gettext-tiny/files/po/Makefile.in.in       |  483 +++++++
 package/gettext-tiny/files/po/Makevars.template    |   78 ++
 package/gettext-tiny/files/po/Rules-quot           |   58 +
 package/gettext-tiny/files/po/boldquot.sed         |   10 +
 package/gettext-tiny/files/po/en at boldquot.header   |   25 +
 package/gettext-tiny/files/po/en at quot.header       |   22 +
 package/gettext-tiny/files/po/insert-header.sin    |   23 +
 package/gettext-tiny/files/po/quot.sed             |    6 +
 package/gettext-tiny/files/po/remove-potcdate.sin  |   19 +
 package/gettext-tiny/gettext-tiny.hash             |    2 +
 package/gettext-tiny/gettext-tiny.mk               |   84 ++
 package/gettext/Config.in                          |   44 +-
 package/gettext/gettext.mk                         |   96 +-
 22 files changed, 3758 insertions(+), 100 deletions(-)
 rename package/{gettext => gettext-gnu}/0001-error_print_progname.patch (100%)
 rename package/{gettext => gettext-gnu}/0002-Update-after-gnulib-changed.patch (100%)
 rename package/{gettext/gettext.hash => gettext-gnu/gettext-gnu.hash} (100%)
 create mode 100644 package/gettext-gnu/gettext-gnu.mk
 create mode 100644 package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch
 create mode 100644 package/gettext-tiny/0002-libintl-Use-gettext-wrappers-if-NLS-is-disabled.patch
 create mode 100644 package/gettext-tiny/files/ABOUT-NLS
 create mode 100644 package/gettext-tiny/files/gettextize
 create mode 100644 package/gettext-tiny/files/po/Makefile.in.in
 create mode 100644 package/gettext-tiny/files/po/Makevars.template
 create mode 100644 package/gettext-tiny/files/po/Rules-quot
 create mode 100644 package/gettext-tiny/files/po/boldquot.sed
 create mode 100644 package/gettext-tiny/files/po/en at boldquot.header
 create mode 100644 package/gettext-tiny/files/po/en at quot.header
 create mode 100644 package/gettext-tiny/files/po/insert-header.sin
 create mode 100644 package/gettext-tiny/files/po/quot.sed
 create mode 100644 package/gettext-tiny/files/po/remove-potcdate.sin
 create mode 100644 package/gettext-tiny/gettext-tiny.hash
 create mode 100644 package/gettext-tiny/gettext-tiny.mk
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/2 package/gettext: Turn into virtual package

Re-work gettext to be a virtual package which may allow to use different gettext's providers, and rename the original one into gettext-gnu package.

---
 .../0001-error_print_progname.patch                |   0
 .../0002-Update-after-gnulib-changed.patch         |   0
 .../gettext.hash => gettext-gnu/gettext-gnu.hash}  |   0
 package/gettext-gnu/gettext-gnu.mk                 | 103 +++++++++++++++++++++
 package/gettext/Config.in                          |  26 +++++-
 package/gettext/gettext.mk                         |  96 +------------------
 6 files changed, 126 insertions(+), 99 deletions(-)
 rename package/{gettext => gettext-gnu}/0001-error_print_progname.patch (100%)
 rename package/{gettext => gettext-gnu}/0002-Update-after-gnulib-changed.patch (100%)
 rename package/{gettext/gettext.hash => gettext-gnu/gettext-gnu.hash} (100%)
 create mode 100644 package/gettext-gnu/gettext-gnu.mk
package/gettext-gnu/0001-error_print_progname.patch renamed from package/gettext/0001-error_print_progname.patch +0 -0
similarity index 100%
rename from package/gettext/0001-error_print_progname.patch
rename to package/gettext-gnu/0001-error_print_progname.patch
package/gettext-gnu/0002-Update-after-gnulib-changed.patch renamed from package/gettext/0002-Update-after-gnulib-changed.patch +0 -0
similarity index 100%
rename from package/gettext/0002-Update-after-gnulib-changed.patch
rename to package/gettext-gnu/0002-Update-after-gnulib-changed.patch
package/gettext-gnu/gettext-gnu.hash renamed from package/gettext/gettext.hash +0 -0
similarity index 100%
rename from package/gettext/gettext.hash
rename to package/gettext-gnu/gettext-gnu.hash
package/gettext-gnu/gettext-gnu.mk new file +103 -0

103 lines not on this page · raw message

package/gettext/Config.in +21 -5
index e55663b1d7..9546468571 100644
@@ -1,5 +1,12 @@
-config BR2_PACKAGE_GETTEXT
+menuconfig BR2_PACKAGE_GETTEXT
 	bool "gettext"
+	select BR2_PACKAGE_HAS_GETTEXT
+
+if BR2_PACKAGE_GETTEXT
+
+config BR2_PACKAGE_GETTEXT_GNU
+	bool "gettext-gnu"
+	default y
 	depends on BR2_USE_WCHAR
 	help
 	  The GNU `gettext' utilities are a set of tools that provide a
@@ -12,14 +19,23 @@ config BR2_PACKAGE_GETTEXT
 
 	  http://www.gnu.org/software/gettext/
 
-if BR2_PACKAGE_GETTEXT
+comment "gettext-gnu needs a toolchain w/ wchar"
+	depends on !BR2_USE_WCHAR
 
 config BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL
 	bool
 	default y if BR2_SYSTEM_ENABLE_NLS
 	depends on !BR2_TOOLCHAIN_HAS_FULL_GETTEXT
 
-endif
+config BR2_PACKAGE_PROVIDES_GETTEXT
+	string
+	default "gettext-gnu" if BR2_PACKAGE_GETTEXT_GNU
 
-comment "gettext needs a toolchain w/ wchar"
-	depends on !BR2_USE_WCHAR
+config BR2_PACKAGE_HAS_GETTEXT
+	bool
+
+config BR2_PACKAGE_PROVIDES_HOST_GETTEXT
+	string
+	default "host-gettext-gnu"
+
+endif
package/gettext/gettext.mk +2 -94

99 lines not on this page · raw message

Signature · 1 line
2.14.1
#2 lore raw

PATCH 1/2 package/gettext: Turn into virtual package

Vadim, All,

On 2018-12-23 17:04 +0200, Vadim Kochan spake thusly:

Quoted 5 lines

Re-work gettext to be a virtual package which may allow to use different gettext's providers, and rename the original one into gettext-gnu package.

Regards,
Yann E. MORIN.

Quoted 291 lines
---
 .../0001-error_print_progname.patch                |   0
 .../0002-Update-after-gnulib-changed.patch         |   0
 .../gettext.hash => gettext-gnu/gettext-gnu.hash}  |   0
 package/gettext-gnu/gettext-gnu.mk                 | 103 +++++++++++++++++++++
 package/gettext/Config.in                          |  26 +++++-
 package/gettext/gettext.mk                         |  96 +------------------
 6 files changed, 126 insertions(+), 99 deletions(-)
 rename package/{gettext => gettext-gnu}/0001-error_print_progname.patch (100%)
 rename package/{gettext => gettext-gnu}/0002-Update-after-gnulib-changed.patch (100%)
 rename package/{gettext/gettext.hash => gettext-gnu/gettext-gnu.hash} (100%)
 create mode 100644 package/gettext-gnu/gettext-gnu.mk
package/gettext-gnu/0001-error_print_progname.patch renamed from package/gettext/0001-error_print_progname.patch +0 -0
similarity index 100%
rename from package/gettext/0001-error_print_progname.patch
rename to package/gettext-gnu/0001-error_print_progname.patch
package/gettext-gnu/0002-Update-after-gnulib-changed.patch renamed from package/gettext/0002-Update-after-gnulib-changed.patch +0 -0
similarity index 100%
rename from package/gettext/0002-Update-after-gnulib-changed.patch
rename to package/gettext-gnu/0002-Update-after-gnulib-changed.patch
package/gettext-gnu/gettext-gnu.hash renamed from package/gettext/gettext.hash +0 -0
similarity index 100%
rename from package/gettext/gettext.hash
rename to package/gettext-gnu/gettext-gnu.hash
package/gettext-gnu/gettext-gnu.mk new file +103 -0
new file mode 100644
index 0000000000..61adf72738
@@ -0,0 +1,103 @@
+################################################################################
+#
+# gettext-gnu
+#
+################################################################################
+
+GETTEXT_GNU_VERSION = 0.19.8.1
+GETTEXT_GNU_SITE = $(BR2_GNU_MIRROR)/gettext
+GETTEXT_GNU_SOURCE = gettext-$(GETTEXT_GNU_VERSION).tar.xz
+GETTEXT_GNU_INSTALL_STAGING = YES
+GETTEXT_GNU_LICENSE = LGPL-2.1+ (libintl), GPL-3.0+ (the rest)
+GETTEXT_GNU_LICENSE_FILES = COPYING gettext-runtime/intl/COPYING.LIB
+# 0002-Update-after-gnulib-changed.patch
+GETTEXT_GNU_AUTORECONF = YES
+GETTEXT_GNU_PROVIDES = gettext
+GETTEXT_GNU_DEPENDENCIES = $(if $(BR2_PACKAGE_LIBICONV),libiconv)
+
+# Avoid using the bundled subset of libxml2
+HOST_GETTEXT_GNU_DEPENDENCIES = host-libxml2
+
+GETTEXT_GNU_CONF_OPTS += \
+	--disable-libasprintf \
+	--disable-acl \
+	--disable-openmp \
+	--disable-rpath \
+	--disable-java \
+	--disable-native-java \
+	--disable-csharp \
+	--disable-relocatable \
+	--without-emacs
+
+HOST_GETTEXT_GNU_CONF_OPTS = \
+	--disable-libasprintf \
+	--disable-acl \
+	--disable-openmp \
+	--disable-rpath \
+	--disable-java \
+	--disable-native-java \
+	--disable-csharp \
+	--disable-relocatable \
+	--without-emacs
+
+# Force the build of libintl, even if the C library provides a stub
+# gettext implementation
+ifeq ($(BR2_PACKAGE_GETTEXT_GNU_PROVIDES_LIBINTL),y)
+GETTEXT_GNU_CONF_OPTS += --with-included-gettext
+else
+GETTEXT_GNU_CONF_OPTS += --without-included-gettext
+endif
+
+# For the target version, we only need the runtime, and for the host
+# version, we only need the tools.
+GETTEXT_GNU_SUBDIR = gettext-runtime
+HOST_GETTEXT_GNU_SUBDIR = gettext-tools
+
+# Disable the build of documentation and examples of gettext-tools,
+# and the build of documentation and tests of gettext-runtime.
+define HOST_GETTEXT_GNU_DISABLE_UNNEEDED
+	$(SED) '/^SUBDIRS/s/ doc //;/^SUBDIRS/s/examples$$//' $(@D)/gettext-tools/Makefile.in
+	$(SED) '/^SUBDIRS/s/ doc //;/^SUBDIRS/s/tests$$//' $(@D)/gettext-runtime/Makefile.in
+endef
+
+GETTEXT_GNU_POST_PATCH_HOOKS += HOST_GETTEXT_GNU_DISABLE_UNNEEDED
+HOST_GETTEXT_GNU_POST_PATCH_HOOKS += HOST_GETTEXT_GNU_DISABLE_UNNEEDED
+
+define GETTEXT_GNU_REMOVE_UNNEEDED
+	$(RM) -rf $(TARGET_DIR)/usr/share/gettext/ABOUT-NLS
+	rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share/gettext
+endef
+
+GETTEXT_GNU_POST_INSTALL_TARGET_HOOKS += GETTEXT_GNU_REMOVE_UNNEEDED
+
+# Force build with NLS support, otherwise libintl is not built
+# This is needed because some packages (eg. libglib2) requires
+# locales, but do not properly depend on BR2_ENABLE_LOCALE, and
+# instead select BR2_PACKAGE_GETTEXT_GNU. Those packages need to be
+# fixed before we can remove the following 3 lines... :-(
+ifeq ($(BR2_ENABLE_LOCALE),)
+GETTEXT_GNU_CONF_OPTS += --enable-nls
+endif
+
+# Disable interactive confirmation in host gettextize for package fixups
+define HOST_GETTEXT_GNU_GETTEXTIZE_CONFIRMATION
+	$(SED) '/read dummy/d' $(HOST_DIR)/bin/gettextize
+endef
+HOST_GETTEXT_GNU_POST_INSTALL_HOOKS += HOST_GETTEXT_GNU_GETTEXTIZE_CONFIRMATION
+
+# autoreconf expects gettextize to install ABOUT-NLS, but it only gets
+# installed by gettext-runtime which we don't build/install for the
+# host, so do it manually
+define HOST_GETTEXT_GNU_ADD_ABOUT_NLS
+	$(INSTALL) -m 0644 $(@D)/$(HOST_GETTEXT_GNU_SUBDIR)/ABOUT-NLS \
+		$(HOST_DIR)/share/gettext/ABOUT-NLS
+endef
+
+HOST_GETTEXT_GNU_POST_INSTALL_HOOKS += HOST_GETTEXT_GNU_ADD_ABOUT_NLS
+
+ifeq ($(BR2_PACKAGE_GETTEXT_GNU),y)
+GETTEXTIZE = $(HOST_CONFIGURE_OPTS) AUTOM4TE=$(HOST_DIR)/bin/autom4te $(HOST_DIR)/bin/gettextize -f
+endif
+
+$(eval $(autotools-package))
+$(eval $(host-autotools-package))
package/gettext/Config.in +21 -5
index e55663b1d7..9546468571 100644
@@ -1,5 +1,12 @@
-config BR2_PACKAGE_GETTEXT
+menuconfig BR2_PACKAGE_GETTEXT
 	bool "gettext"
+	select BR2_PACKAGE_HAS_GETTEXT
+
+if BR2_PACKAGE_GETTEXT
+
+config BR2_PACKAGE_GETTEXT_GNU
+	bool "gettext-gnu"
+	default y
 	depends on BR2_USE_WCHAR
 	help
 	  The GNU `gettext' utilities are a set of tools that provide a
@@ -12,14 +19,23 @@ config BR2_PACKAGE_GETTEXT
 
 	  http://www.gnu.org/software/gettext/
 
-if BR2_PACKAGE_GETTEXT
+comment "gettext-gnu needs a toolchain w/ wchar"
+	depends on !BR2_USE_WCHAR
 
 config BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL
 	bool
 	default y if BR2_SYSTEM_ENABLE_NLS
 	depends on !BR2_TOOLCHAIN_HAS_FULL_GETTEXT
 
-endif
+config BR2_PACKAGE_PROVIDES_GETTEXT
+	string
+	default "gettext-gnu" if BR2_PACKAGE_GETTEXT_GNU
 
-comment "gettext needs a toolchain w/ wchar"
-	depends on !BR2_USE_WCHAR
+config BR2_PACKAGE_HAS_GETTEXT
+	bool
+
+config BR2_PACKAGE_PROVIDES_HOST_GETTEXT
+	string
+	default "host-gettext-gnu"
+
+endif
package/gettext/gettext.mk +2 -94
index ec9588f8ad..a86e26f69e 100644
@@ -4,97 +4,5 @@
 #
 ################################################################################
 
-GETTEXT_VERSION = 0.19.8.1
-GETTEXT_SITE = $(BR2_GNU_MIRROR)/gettext
-GETTEXT_SOURCE = gettext-$(GETTEXT_VERSION).tar.xz
-GETTEXT_INSTALL_STAGING = YES
-GETTEXT_LICENSE = LGPL-2.1+ (libintl), GPL-3.0+ (the rest)
-GETTEXT_LICENSE_FILES = COPYING gettext-runtime/intl/COPYING.LIB
-# 0002-Update-after-gnulib-changed.patch
-GETTEXT_AUTORECONF = YES
-GETTEXT_DEPENDENCIES = $(if $(BR2_PACKAGE_LIBICONV),libiconv)
-
-# Avoid using the bundled subset of libxml2
-HOST_GETTEXT_DEPENDENCIES = host-libxml2
-
-GETTEXT_CONF_OPTS += \
-	--disable-libasprintf \
-	--disable-acl \
-	--disable-openmp \
-	--disable-rpath \
-	--disable-java \
-	--disable-native-java \
-	--disable-csharp \
-	--disable-relocatable \
-	--without-emacs
-
-HOST_GETTEXT_CONF_OPTS = \
-	--disable-libasprintf \
-	--disable-acl \
-	--disable-openmp \
-	--disable-rpath \
-	--disable-java \
-	--disable-native-java \
-	--disable-csharp \
-	--disable-relocatable \
-	--without-emacs
-
-# Force the build of libintl, even if the C library provides a stub
-# gettext implementation
-ifeq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y)
-GETTEXT_CONF_OPTS += --with-included-gettext
-else
-GETTEXT_CONF_OPTS += --without-included-gettext
-endif
-
-# For the target version, we only need the runtime, and for the host
-# version, we only need the tools.
-GETTEXT_SUBDIR = gettext-runtime
-HOST_GETTEXT_SUBDIR = gettext-tools
-
-# Disable the build of documentation and examples of gettext-tools,
-# and the build of documentation and tests of gettext-runtime.
-define HOST_GETTEXT_DISABLE_UNNEEDED
-	$(SED) '/^SUBDIRS/s/ doc //;/^SUBDIRS/s/examples$$//' $(@D)/gettext-tools/Makefile.in
-	$(SED) '/^SUBDIRS/s/ doc //;/^SUBDIRS/s/tests$$//' $(@D)/gettext-runtime/Makefile.in
-endef
-
-GETTEXT_POST_PATCH_HOOKS += HOST_GETTEXT_DISABLE_UNNEEDED
-HOST_GETTEXT_POST_PATCH_HOOKS += HOST_GETTEXT_DISABLE_UNNEEDED
-
-define GETTEXT_REMOVE_UNNEEDED
-	$(RM) -rf $(TARGET_DIR)/usr/share/gettext/ABOUT-NLS
-	rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share/gettext
-endef
-
-GETTEXT_POST_INSTALL_TARGET_HOOKS += GETTEXT_REMOVE_UNNEEDED
-
-# Force build with NLS support, otherwise libintl is not built
-# This is needed because some packages (eg. libglib2) requires
-# locales, but do not properly depend on BR2_ENABLE_LOCALE, and
-# instead select BR2_PACKAGE_GETTEXT. Those packages need to be
-# fixed before we can remove the following 3 lines... :-(
-ifeq ($(BR2_ENABLE_LOCALE),)
-GETTEXT_CONF_OPTS += --enable-nls
-endif
-
-# Disable interactive confirmation in host gettextize for package fixups
-define HOST_GETTEXT_GETTEXTIZE_CONFIRMATION
-	$(SED) '/read dummy/d' $(HOST_DIR)/bin/gettextize
-endef
-HOST_GETTEXT_POST_INSTALL_HOOKS += HOST_GETTEXT_GETTEXTIZE_CONFIRMATION
-
-# autoreconf expects gettextize to install ABOUT-NLS, but it only gets
-# installed by gettext-runtime which we don't build/install for the
-# host, so do it manually
-define HOST_GETTEXT_ADD_ABOUT_NLS
-	$(INSTALL) -m 0644 $(@D)/$(HOST_GETTEXT_SUBDIR)/ABOUT-NLS \
-		$(HOST_DIR)/share/gettext/ABOUT-NLS
-endef
-
-HOST_GETTEXT_POST_INSTALL_HOOKS += HOST_GETTEXT_ADD_ABOUT_NLS
-
-GETTEXTIZE = $(HOST_CONFIGURE_OPTS) AUTOM4TE=$(HOST_DIR)/bin/autom4te $(HOST_DIR)/bin/gettextize -f
-
-$(eval $(autotools-package))
-$(eval $(host-autotools-package))
+$(eval $(virtual-package))
+$(eval $(host-virtual-package))
Signature · 6 lines
2.14.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/2 package/gettext: Turn into virtual package

In reply to Vadim Kochan

Hello Vadim,

First of all, thanks a *lot* for pursuing this work, it is really nice to see some progress in this area. Every time host-gettext is building on my machine, I'm really annoyed, and remember about the need to have gettext-tiny support. See below for some comment.

Quoted 36 lines · Vadim Kochan
package/gettext/Config.in +13 -3
index e55663b1d7..9546468571 100644
@@ -1,5 +1,12 @@
-config BR2_PACKAGE_GETTEXT
+menuconfig BR2_PACKAGE_GETTEXT
 	bool "gettext"
+	select BR2_PACKAGE_HAS_GETTEXT
+
+if BR2_PACKAGE_GETTEXT
+
+config BR2_PACKAGE_GETTEXT_GNU
+	bool "gettext-gnu"
+	default y
 	depends on BR2_USE_WCHAR
 	help
 	  The GNU `gettext' utilities are a set of tools that provide a
@@ -12,14 +19,23 @@ config BR2_PACKAGE_GETTEXT
 
 	  http://www.gnu.org/software/gettext/
 
-if BR2_PACKAGE_GETTEXT
+comment "gettext-gnu needs a toolchain w/ wchar"
+	depends on !BR2_USE_WCHAR
 
 config BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL
 	bool
 	default y if BR2_SYSTEM_ENABLE_NLS
 	depends on !BR2_TOOLCHAIN_HAS_FULL_GETTEXT
 
-endif
+config BR2_PACKAGE_PROVIDES_GETTEXT
+	string
+	default "gettext-gnu" if BR2_PACKAGE_GETTEXT_GNU
 

package/gettext/Config.in config BR2_PACKAGE_GETTEXT · line 41

Quoted 10 lines
package/gettext/Config.in +8 -2
-comment "gettext needs a toolchain w/ wchar"
-	depends on !BR2_USE_WCHAR
+config BR2_PACKAGE_HAS_GETTEXT
+	bool
+
+config BR2_PACKAGE_PROVIDES_HOST_GETTEXT
+	string
+	default "host-gettext-gnu"
+
+endif

I'm not convinced by how this virtual package is handled in Config.in. In fact, if you apply both of your patches, it's broken, you have:

config BR2_PACKAGE_PROVIDES_HOST_GETTEXT
string
default "host-gettext-gnu" if BR2_PACKAGE_GETTEXT_GNU default "host-gettext-tiny" if BR2_PACKAGE_GETTEXT_TINY

which means that when the target package is not selected, the host-gettext virtual package doesn't "point" to anything. And indeed:
do a simple build with nothing enable, and run "make host-flex". It will fail with:

make[1]: *** No rule to make target 'host-', needed by '/home/thomas/projets/buildroot/output/build/host-gettext/.stamp_configured'. Stop.
make: *** [Makefile:84: _all] Error 2

Because the host-gettext virtual package has no provider.

So let's analyze this in detail.

First, for the *target* gettext virtual package, what do we want. I guess what we want is simply:

- To use the full gettext when BR2_TARGET_ENABLE_NLS=y

- To use gettext-tiny when BR2_TARGET_ENABLE_NLS is disabled

I don't see any meaningful use case for full gettext with BR2_TARGET_ENABLE_NLS disabled, or for gettext-tiny with BR2_TARGET_ENABLE_NLS=y.

To me, this means that for the target package, package/gettext/Config.in shouldn't offer a choice between full and
tiny: it should automatically use full or tiny depending on the BR2_TARGET_ENABLE_NLS value.

Now, there is the question of what to do with the host-gettext virtual package, i.e in which case it should use the full host gettext or host gettext-tiny.

So, we need host-gettext for two things:

- Some packages explicitly need it.

- Some packages need it through TARGET_NLS_DEPENDENCIES

- Some packages need it through <pkg>_GETTEXTIZE = YES

So we need to understand if the rule is as simple as: full host gettext when BR2_TARGET_ENABLE_NLS=y and tiny host gettext when BR2_TARGET_ENABLE_NLS is disabled, or whether it is possible to use gettext tiny for host gettext when BR2_TARGET_ENABLE_NLS=y.

Do you have some ideas about this ?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 1/2 package/gettext: Turn into virtual package

Hi Thomas, All

Quoted 60 lines · Thomas Petazzoni

Hello Vadim,

First of all, thanks a *lot* for pursuing this work, it is really nice to see some progress in this area. Every time host-gettext is building on my machine, I'm really annoyed, and remember about the need to have gettext-tiny support. See below for some comment.

Quoted 36 lines · Vadim Kochan
package/gettext/Config.in +13 -3
index e55663b1d7..9546468571 100644
@@ -1,5 +1,12 @@
-config BR2_PACKAGE_GETTEXT
+menuconfig BR2_PACKAGE_GETTEXT
      bool "gettext"
+     select BR2_PACKAGE_HAS_GETTEXT
+
+if BR2_PACKAGE_GETTEXT
+
+config BR2_PACKAGE_GETTEXT_GNU
+     bool "gettext-gnu"
+     default y
      depends on BR2_USE_WCHAR
      help
        The GNU `gettext' utilities are a set of tools that provide a
@@ -12,14 +19,23 @@ config BR2_PACKAGE_GETTEXT
 
        http://www.gnu.org/software/gettext/
 
-if BR2_PACKAGE_GETTEXT
+comment "gettext-gnu needs a toolchain w/ wchar"
+     depends on !BR2_USE_WCHAR
 
 config BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL
      bool
      default y if BR2_SYSTEM_ENABLE_NLS
      depends on !BR2_TOOLCHAIN_HAS_FULL_GETTEXT
 
-endif
+config BR2_PACKAGE_PROVIDES_GETTEXT
+     string
+     default "gettext-gnu" if BR2_PACKAGE_GETTEXT_GNU
 

package/gettext/Config.in config BR2_PACKAGE_GETTEXT · line 41

Quoted 10 lines
package/gettext/Config.in +8 -2
-comment "gettext needs a toolchain w/ wchar"
-     depends on !BR2_USE_WCHAR
+config BR2_PACKAGE_HAS_GETTEXT
+     bool
+
+config BR2_PACKAGE_PROVIDES_HOST_GETTEXT
+     string
+     default "host-gettext-gnu"
+
+endif

I'm not convinced by how this virtual package is handled in Config.in. In fact, if you apply both of your patches, it's broken, you have:

Quoted 5 lines

config BR2_PACKAGE_PROVIDES_HOST_GETTEXT
string
default "host-gettext-gnu" if BR2_PACKAGE_GETTEXT_GNU default "host-gettext-tiny" if BR2_PACKAGE_GETTEXT_TINY

So looks like it needs to be enabled by default "host-gettext-gnu" but should allow to set "host-gettext-tiny" if BR2_PACKAGE_GETTEXT_TINY was forced by the user ?

Quoted 38 lines

which means that when the target package is not selected, the host-gettext virtual package doesn't "point" to anything. And indeed:
do a simple build with nothing enable, and run "make host-flex". It will fail with:

make[1]: *** No rule to make target 'host-', needed by '/home/thomas/projets/buildroot/output/build/host-gettext/.stamp_configured'. Stop.
make: *** [Makefile:84: _all] Error 2

Because the host-gettext virtual package has no provider.

So let's analyze this in detail.

First, for the *target* gettext virtual package, what do we want. I guess what we want is simply:

- To use the full gettext when BR2_TARGET_ENABLE_NLS=y

- To use gettext-tiny when BR2_TARGET_ENABLE_NLS is disabled

I don't see any meaningful use case for full gettext with BR2_TARGET_ENABLE_NLS disabled, or for gettext-tiny with BR2_TARGET_ENABLE_NLS=y.

To me, this means that for the target package, package/gettext/Config.in shouldn't offer a choice between full and
tiny: it should automatically use full or tiny depending on the BR2_TARGET_ENABLE_NLS value.

Now, there is the question of what to do with the host-gettext virtual package, i.e in which case it should use the full host gettext or host gettext-tiny.

So, we need host-gettext for two things:

- Some packages explicitly need it.

- Some packages need it through TARGET_NLS_DEPENDENCIES

Quoted 9 lines

- Some packages need it through <pkg>_GETTEXTIZE = YES

So we need to understand if the rule is as simple as: full host gettext when BR2_TARGET_ENABLE_NLS=y and tiny host gettext when BR2_TARGET_ENABLE_NLS is disabled, or whether it is possible to use gettext tiny for host gettext when BR2_TARGET_ENABLE_NLS=y.

Do you have some ideas about this ?

May be I don;t have a view of a whole picture, but for me it looks simple - by default gettext-gnu is selected when ENABLE_NLS is set, but gettext-tiny should
be selected by force choosing the BR2_PACKAGE_GETTEXT_TINY. For the "host" case - the similar case with the only difference that "tiny" might be selected if NLS is disabled.
May be I missed something ))

Quoted 5 lines

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Regards,
Vadim Kochan

#5 lore raw

PATCH 1/2 package/gettext: Turn into virtual package

Hello Vadim,

Quoted 11 lines · Vadim Kochan
Quoted 8 lines

I'm not convinced by how this virtual package is handled in Config.in. In fact, if you apply both of your patches, it's broken, you have:

config BR2_PACKAGE_PROVIDES_HOST_GETTEXT
string
default "host-gettext-gnu" if BR2_PACKAGE_GETTEXT_GNU default "host-gettext-tiny" if BR2_PACKAGE_GETTEXT_TINY

So looks like it needs to be enabled by default "host-gettext-gnu" but should allow to set "host-gettext-tiny" if BR2_PACKAGE_GETTEXT_TINY was forced by the user ?

No, I don't think that's what we want. Is there any reason to use host-gettext-gnu, unless BR2_SYSTEM_ENABLE_NLS is enabled ?

If not, then I think we should:

default "host-gettext-gnu" if BR2_SYSTEM_ENABLE_NLS default "host-gettext-tiny" if !BR2_SYSTEM_ENABLE_NLS

Quoted 4 lines

May be I don;t have a view of a whole picture, but for me it looks simple - by default gettext-gnu is selected when ENABLE_NLS is set, but gettext-tiny should
be selected by force choosing the BR2_PACKAGE_GETTEXT_TINY

We don't need BR2_PACKAGE_GETTEXT_TINY at all. Just make the virtual package behave properly, using gettext-gnu as the provider when BR2_SYSTEM_ENABLE_NLS=y, and using gettext-tiny as the provider when BR2_SYSTEM_ENABLE_NLS is not enabled.

Quoted 3 lines

. For the "host"
case - the similar case with the only difference that "tiny" might be selected if NLS is disabled.

Why would one want to use the full gettext when NLS is disabled ? When NLS is disabled, you don't care about message translations, so the dummy implementation provided by gettext-tiny should be enough.

However: this is a massive change in Buildroot. Most people are building with BR2_SYSTEM_ENABLE_NLS disabled (that's our default), so such a change will mean that everybody will switch from one day to the other from gettext-gnu to gettext-tiny.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw

PATCH 1/2 package/gettext: Turn into virtual package

Hi Thomas, All

Quoted 48 lines · Thomas Petazzoni

Hello Vadim,

Quoted 11 lines · Vadim Kochan
Quoted 8 lines

I'm not convinced by how this virtual package is handled in Config.in. In fact, if you apply both of your patches, it's broken, you have:

config BR2_PACKAGE_PROVIDES_HOST_GETTEXT
string
default "host-gettext-gnu" if BR2_PACKAGE_GETTEXT_GNU default "host-gettext-tiny" if BR2_PACKAGE_GETTEXT_TINY

So looks like it needs to be enabled by default "host-gettext-gnu" but should allow to set "host-gettext-tiny" if BR2_PACKAGE_GETTEXT_TINY was forced by the user ?

No, I don't think that's what we want. Is there any reason to use host-gettext-gnu, unless BR2_SYSTEM_ENABLE_NLS is enabled ?

If not, then I think we should:

default "host-gettext-gnu" if BR2_SYSTEM_ENABLE_NLS default "host-gettext-tiny" if !BR2_SYSTEM_ENABLE_NLS

Quoted 4 lines

May be I don;t have a view of a whole picture, but for me it looks simple - by default gettext-gnu is selected when ENABLE_NLS is set, but gettext-tiny should
be selected by force choosing the BR2_PACKAGE_GETTEXT_TINY

We don't need BR2_PACKAGE_GETTEXT_TINY at all. Just make the virtual package behave properly, using gettext-gnu as the provider when BR2_SYSTEM_ENABLE_NLS=y, and using gettext-tiny as the provider when BR2_SYSTEM_ENABLE_NLS is not enabled.

Quoted 3 lines

. For the "host"
case - the similar case with the only difference that "tiny" might be selected if NLS is disabled.

Why would one want to use the full gettext when NLS is disabled ? When NLS is disabled, you don't care about message translations, so the dummy implementation provided by gettext-tiny should be enough.

However: this is a massive change in Buildroot. Most people are building with BR2_SYSTEM_ENABLE_NLS disabled (that's our default), so such a change will mean that everybody will switch from one day to the other from gettext-gnu to gettext-tiny.

Quoted 7 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Why do we need default host-gettext dependencies for such packages like wine, flex
if they builds successfully (I tried uclibc, musl) if to manually remove such dependency
from their *.mk files ?

Regards,
Vadim Kochan

#7 lore raw

PATCH 1/2 package/gettext: Turn into virtual package

Hello Vadim,

Quoted 5 lines · Vadim Kochan

Why do we need default host-gettext dependencies for such packages like wine, flex
if they builds successfully (I tried uclibc, musl) if to manually remove such dependency
from their *.mk files ?

Do you have gettext installed on your system ? If you do, then the build of wine for example may succeed by using the "gettext" command of your build machine. But Buildroot is not supposed to depend on the gettext available on the build machine.

Note: this is speculation, I have not re-tested. If you want a confirmation, I can do a proper test.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

A message that is not in the archive (sent off-list or not yet received): CAMw6YJ+xU9GiZ809dCQTmPEgtpu3iCOErT5w7fqoee09R-hpaQ@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): CAMw6YJLvioTwKbgAdYvtZqbVg1W-RAADT_umZkGMaw9MnVpHMw@mail.gmail.com

#10 lore raw

PATCH 1/2 package/gettext: Turn into virtual package

Hello,

Please keep the mailing list in Cc, i.e use "Reply All" when replying to mailing list e-mails. Thanks!

I'm also adding Andr? and Yann in Cc, since they are involved in the host-gettext dependency in wine.

Quoted 5 lines · Vadim Kochan

So the wine builds OK w/o host-gettext (tested with dockerfile), but this libgettextpo is required by (optionally)
'tools/wrc' which allows to convert window's resources into *.po files
(https://linux.die.net/man/1/wrc). And
looks like it might be needed on the host only if NLS=y.

The dependency on host-gettext was added in commit 164ac197fef763dfa61154ad41588b6701baca86, which says:

""
wine: Add gettext dependency for host-wine

Mostly based on a comment by Yann E. MORIN
""

I am not sure what "comment" Yann made about this, and especially if the dependency really needs to be mandatory.

Andr?, Yann, do you remember ? Could you give more details about the host-gettext dependency in wine ?

Do we need it unconditionally, or only when BR2_SYSTEM_ENABLE_NLS=y ?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#11 lore raw

PATCH 2/2 package/gettext-tiny: Add new package

In reply to Vadim Kochan

Add gettext-tiny package from the sabotage-linux project:

gettext-tiny provides lightweight replacements for tools typically used from the GNU gettext suite, which is incredibly bloated and takes a lot of time to build (in the order of an hour on slow devices). the most notable component is msgfmt which is used to create binary translation files in the .mo format out of textual input files in .po format. this is the most important tool for building software from source, because it is used from the build processes of many software packages.

Some files were taken from built gettext gnu (po/* and gettextize) to make possible perform gettextizing of packages. They will be removed once they will be added to the gettext-tiny project.

Allow to select it to be as gettext gnu alternative for the host & target builds.

---
 DEVELOPERS                                         |    3 +
 ...-format-not-a-string-literal-error-for-gc.patch |   51 +
 ...l-Use-gettext-wrappers-if-NLS-is-disabled.patch |   26 +
 package/gettext-tiny/files/ABOUT-NLS               | 1379 ++++++++++++++++++++
 package/gettext-tiny/files/gettextize              | 1346 +++++++++++++++++++
 package/gettext-tiny/files/po/Makefile.in.in       |  483 +++++++
 package/gettext-tiny/files/po/Makevars.template    |   78 ++
 package/gettext-tiny/files/po/Rules-quot           |   58 +
 package/gettext-tiny/files/po/boldquot.sed         |   10 +
 package/gettext-tiny/files/po/en at boldquot.header   |   25 +
 package/gettext-tiny/files/po/en at quot.header       |   22 +
 package/gettext-tiny/files/po/insert-header.sin    |   23 +
 package/gettext-tiny/files/po/quot.sed             |    6 +
 package/gettext-tiny/files/po/remove-potcdate.sin  |   19 +
 package/gettext-tiny/gettext-tiny.hash             |    2 +
 package/gettext-tiny/gettext-tiny.mk               |   84 ++
 package/gettext/Config.in                          |   20 +-
 17 files changed, 3633 insertions(+), 2 deletions(-)
 create mode 100644 package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch
 create mode 100644 package/gettext-tiny/0002-libintl-Use-gettext-wrappers-if-NLS-is-disabled.patch
 create mode 100644 package/gettext-tiny/files/ABOUT-NLS
 create mode 100644 package/gettext-tiny/files/gettextize
 create mode 100644 package/gettext-tiny/files/po/Makefile.in.in
 create mode 100644 package/gettext-tiny/files/po/Makevars.template
 create mode 100644 package/gettext-tiny/files/po/Rules-quot
 create mode 100644 package/gettext-tiny/files/po/boldquot.sed
 create mode 100644 package/gettext-tiny/files/po/en at boldquot.header
 create mode 100644 package/gettext-tiny/files/po/en at quot.header
 create mode 100644 package/gettext-tiny/files/po/insert-header.sin
 create mode 100644 package/gettext-tiny/files/po/quot.sed
 create mode 100644 package/gettext-tiny/files/po/remove-potcdate.sin
 create mode 100644 package/gettext-tiny/gettext-tiny.hash
 create mode 100644 package/gettext-tiny/gettext-tiny.mk
DEVELOPERS +3 -0
index 2d58ea9014..282844bab4 100644
@@ -2141,6 +2141,9 @@ N:	Tzu-Jung Lee <[email protected]>
 F:	package/dropwatch/
 F:	package/tstools/
 
+N:	Vadim Kochan <[email protected]>
+F:	package/gettext-tiny/
+
 N:	Valentin Korenblit <[email protected]>
 F:	package/clang/
 F:	package/clinfo/
package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch new file +51 -0

51 lines not on this page · raw message

package/gettext-tiny/0002-libintl-Use-gettext-wrappers-if-NLS-is-disabled.patch new file +26 -0
new file mode 100644
index 0000000000..a6a4fcb892
@@ -0,0 +1,26 @@
+From 8d6897b7b9df3dc8228fcdab42bcb9a915b64cef Mon Sep 17 00:00:00 2001
+From: Vadim Kochan <[email protected]>
+Date: Sun, 21 Oct 2018 19:00:03 +0300
+Subject: [PATCH] libintl: Use gettext wrappers if NLS is disabled
+
+Signed-off-by: Vadim Kochan <[email protected]>
+---
+ include/libintl.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/libintl.h b/include/libintl.h
+index 173b3f3..73384fa 100644
+--- a/include/libintl.h
++++ b/include/libintl.h
+@@ -30,7 +30,7 @@ char *bindtextdomain(const char *domainname, const char *dirname);
+ #undef gettext_noop
+ #define gettext_noop(X) X
+ 
+-#ifndef LIBINTL_NO_MACROS
++#if !ENABLE_NLS
+ /* if these macros are defined, configure checks will detect libintl as
+  * built into the libc because test programs will work without -lintl.
+  * for example:
+-- 
+2.14.1
+
package/gettext-tiny/files/ABOUT-NLS new file +1379 -0

1,379 lines not on this page · raw message

package/gettext-tiny/files/gettextize new file +1346 -0

1,346 lines not on this page · raw message

package/gettext-tiny/files/po/Makefile.in.in new file +483 -0

189 lines not on this page · raw message

package/gettext-tiny/files/po/Makevars.template new file +78 -0

78 lines not on this page · raw message

package/gettext-tiny/files/po/Rules-quot new file +58 -0

58 lines not on this page · raw message

package/gettext-tiny/files/po/boldquot.sed new file +10 -0
new file mode 100644
index 0000000000..4b937aa517

Lines of this file are not shown. View the raw message.

package/gettext-tiny/files/po/en at boldquot.header new file +25 -0
new file mode 100644
index 0000000000..fedb6a06d1

Lines of this file are not shown. View the raw message.

package/gettext-tiny/files/po/en at quot.header new file +22 -0
new file mode 100644
index 0000000000..a9647fc35c

Lines of this file are not shown. View the raw message.

package/gettext-tiny/files/po/insert-header.sin new file +23 -0
new file mode 100644
index 0000000000..b26de01f6c

Lines of this file are not shown. View the raw message.

package/gettext-tiny/files/po/quot.sed new file +6 -0
new file mode 100644
index 0000000000..0122c46318

Lines of this file are not shown. View the raw message.

package/gettext-tiny/files/po/remove-potcdate.sin new file +19 -0
new file mode 100644
index 0000000000..2436c49e78

Lines of this file are not shown. View the raw message.

package/gettext-tiny/gettext-tiny.hash new file +2 -0
new file mode 100644
index 0000000000..3b0b73d047

Lines of this file are not shown. View the raw message.

package/gettext-tiny/gettext-tiny.mk new file +84 -0

84 lines not on this page · raw message

package/gettext/Config.in +18 -2
index 9546468571..176c771161 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.14.1

Part of the diff is not shown here. View the raw message.

#12 lore raw

PATCH 2/2 package/gettext-tiny: Add new package

Vadim, All,

On 2018-12-23 17:04 +0200, Vadim Kochan spake thusly:

Quoted 9 lines

Add gettext-tiny package from the sabotage-linux project:

gettext-tiny provides lightweight replacements for tools typically used from the GNU gettext suite, which is incredibly bloated and takes a lot of time to build (in the order of an hour on slow devices). the most notable component is msgfmt which is used to create binary translation files in the .mo format out of textual input files in .po format. this is the most important tool for building software from source, because it is used from the build processes of many software packages.

I know you copy-pasted this part from upstream's README, but that is not the important thing we want to see in a commit log.

A commit log should explain the tricks and treats of a change: why it is needed, how it was made to work, why we have specific stuff that is not obvious.

For example...

Quoted 3 lines

Some files were taken from built gettext gnu (po/* and gettextize) to make possible perform gettextizing of packages. They will be removed once they will be added to the gettext-tiny project.

... why do we need to carry those files at all?

Her's what you could have said about ABOUT-NLS:

ABOUT-NLS only exists because, when a package uses gettect, autoreconf expects that file to exist, which is usually done by gettextize.

However ABOUT-NLS is *huge*, and I dobt autoreconf really requires that exact file. We could provide just a stub, that is created at build time, like so:

    define HOST_GETTEXT_TINY_ABOUT_NLS
        $(Q)mkdir -p $(HOST_DIR)/share/gettext-tiny
        $(Q)touch $(HOST_DIR)/share/gettext-tiny/ABOUT-NLS
    endef
    HOST_GETTEXT_TINY_POST_INSTALL_HOOKS += HOST_GETTEXT_TINY_ABOUT_NLS

That would cut out about 1/3rd of that big patch. ;-)

For gettextize itself, I guess there is not much we can do about... I was thinking we could maybe use:

GETTEXT_TINY_EXTRA_DOWNLOADS = https://git.savannah.gnu.org/cgit/gettext.git/tree/gettext-tools/misc/gettextize.in?h=v0.19.8.1

and then sed the place holders, but that's not so nice, and anyway there are a bunch of other files to handle as well... It's just that gettextize is so huge too... :-/

But we could maybe do something like:

    GETTEXT_TINY_GRAB_GETTEXT_FILES_URI = https://git.savannah.gnu.org/cgit/gettext.git/tree
    GETTEXT_TINY_GRAB_GETTEXT_FILES_VERSION = v0.19.8.1
    GETTEXT_TINY_GRAB_GETTEXT_FILES = \
        gettext-runtime/po/Makefile.in.in \
        gettext-tools/misc/gettextize.in \
        gettext-tools/po/Makevars.template \
        [...]

    GETTEXT_TINY_EXTRA_DOWNLOADS = \
        $(patsubst %,\
            $(GETTEXT_TINY_GRAB_GETTEXT_FILES_URI)/%?h=$(GETTEXT_TINY_GRAB_GETTEXT_FILES_VERSION),\
            $(GETTEXT_TINY_GRAB_GETTEXT_FILES))

    define HOST_GETTEXT_TINY_COPY_FILE
        $(foreach f,$(GETTEXT_TINY_GRAB_GETTEXT_FILES),\
            cp $(GETTEXT_TINY_DL_DIR)/$(notdir $(f)) $(@D)/$(notdir $(f))
        )
    endef
    HOST_GETTEXT_TINY_POST_EXTRACT_HOOKS += HOST_GETTEXT_TINY_COPY_FILE

    define HOST_GETTEXT_TINY_BUILD_CMDS
        cp $(@D)/gettetize.in $(@D)/gettextize
        $(SED) 's, at prefix@,$(HOST_DIR,; [...]' $(@D)/gettextize
    endef

    define HOST_GETTEXT_TINY_INSTALL_CMDS
        $(INSTALL) -m 0755 -D $(@D)/gettextize $(HOST_DIR)/bin/gettextize
    endef

(and so on for extra files. Untested, use with caution; may contain nuts.)

Quoted 5 lines

Allow to select it to be as gettext gnu alternative for the host & target builds.

---

[--SNIP--]

package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch line 4

Quoted 10 lines
package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch new file +4 -0
new file mode 100644
index 0000000000..57a7f3dd53
@@ -0,0 +1,51 @@
+From 9483ad60f8a39d2e8173add070ecb9839a54d140 Mon Sep 17 00:00:00 2001
+From: Vadim Kochan <[email protected]>
+Date: Sun, 21 Oct 2018 11:16:14 +0300
+Subject: [PATCH] libintl: Add 'format_arg' attribute

You need to give a little bit more details here, because it is not a trivial patch, and it is not obvious what's going on.

Also the filename doest not match the title:
0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch
vs.
libintl: Add 'format_arg' attribute

Also, did you try to submit this patch upstream? (you should.)

Quoted 17 lines
package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch new file +17 -0
+Signed-off-by: Vadim Kochan <[email protected]>
+---
+ include/libintl.h | 27 +++++++++++++++++++++------
+ 1 file changed, 21 insertions(+), 6 deletions(-)
+
+diff --git a/include/libintl.h b/include/libintl.h
+index b7123a9..173b3f3 100644
+--- a/include/libintl.h
++++ b/include/libintl.h
+@@ -1,12 +1,27 @@
+ #ifndef LIBINTL_H
+ #define LIBINTL_H
+ 
+-char *gettext(const char *msgid);
+-char *dgettext(const char *domainname, const char *msgid);
+-char *dcgettext(const char *domainname, const char *msgid, int category);
+-char *ngettext(const char *msgid1, const char *msgid2, unsigned long n);

package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch line 32

Quoted 10 lines
package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch new file +10 -0
+-char *dngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n);
+-char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n, int category);
++/* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return
++ *    its n-th argument literally.  This enables GCC to warn for example about
++ *       printf (gettext ("foo %y")).  */
++#if defined __GNUC__ && __GNUC__ >= 3 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1 && defined __cplusplus)
++# define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n)))
++#else
++# define _INTL_MAY_RETURN_STRING_ARG(n)
++#endif

It looks like you took the code verbatime from GNU gettext, but that code is LGPLv2.1-or-later, while gettext-tiny is MIT. Both licenses are compatible, but then you have to update the licensing terms in gettext-tiny.mk.

Alternatively, I would prefer if code of your own were to be used, without copying the coe from GNU gettext. Can you try to provide something? Hint: we don;t need the Apple stuff because we're only ever on Linux, and the oldest gcc version we support is 4.3.

Quoted 24 lines
package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch new file +18 -0
++char *gettext(const char *msgid)
++	_INTL_MAY_RETURN_STRING_ARG(1);
++char *dgettext(const char *domainname, const char *msgid)
++	_INTL_MAY_RETURN_STRING_ARG(2);
++char *dcgettext(const char *domainname, const char *msgid, int category)
++	_INTL_MAY_RETURN_STRING_ARG(2);
++char *ngettext(const char *msgid1, const char *msgid2, unsigned long n)
++	_INTL_MAY_RETURN_STRING_ARG(1) _INTL_MAY_RETURN_STRING_ARG(2);
++char *dngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n)
++	_INTL_MAY_RETURN_STRING_ARG(2) _INTL_MAY_RETURN_STRING_ARG(3);
++char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n, int category)
++	_INTL_MAY_RETURN_STRING_ARG(2) _INTL_MAY_RETURN_STRING_ARG(3);
+ 
+ char *textdomain(const char *domainname);
+ char *bind_textdomain_codeset(const char *domainname, const char *codeset);
+-- 
+2.14.1
+
package/gettext-tiny/0002-libintl-Use-gettext-wrappers-if-NLS-is-disabled.patch new file +0 -0
new file mode 100644
index 0000000000..a6a4fcb892

package/gettext-tiny/0002-libintl-Use-gettext-wrappers-if-NLS-is-disabled.patch line 4

Quoted 4 lines
package/gettext-tiny/0002-libintl-Use-gettext-wrappers-if-NLS-is-disabled.patch new file +4 -0
@@ -0,0 +1,26 @@
+From 8d6897b7b9df3dc8228fcdab42bcb9a915b64cef Mon Sep 17 00:00:00 2001
+From: Vadim Kochan <[email protected]>
+Date: Sun, 21 Oct 2018 19:00:03 +0300
+Subject: [PATCH] libintl: Use gettext wrappers if NLS is disabled

Ditto, you need to provide a bit more explanations here.

However, can't we just include -LIBINTL_NO_MACROS=1 in our CPPFLAGS, instead? E.g.:

    diff --git a/package/Makefile.in b/package/Makefile.in
    index 44761b79c5..95b6825aa3 100644
    --- a/package/Makefile.in
    +++ b/package/Makefile.in
    @@ -159,6 +159,7 @@ TARGET_HARDENED += -D_FORTIFY_SOURCE=2
     endif
     
     TARGET_CPPFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
    +TARGET_CPPFLAGS += $(if $(BR2_PACKAGE_GETTEXT_TINY),-DLIBINTL_NO_MACROS=1)
     TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_HARDENED)
     TARGET_CXXFLAGS = $(TARGET_CFLAGS)
     TARGET_FCFLAGS = $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)

[--SNIP--]

package/gettext-tiny/gettext-tiny.hash line 2

Quoted 8 lines
package/gettext-tiny/gettext-tiny.hash new file +2 -0
new file mode 100644
index 0000000000..3b0b73d047
@@ -0,0 +1,2 @@
+# Locally Computed:
+sha256 40a003e850ae8c29b8e6e6321925596c3a57d7ae8296d880dc1e88a07aebcd93  gettext-tiny-f733dd3fdd7be973f523a464165aae827a17d838.tar.gz

Here, you'll need to add a hash file for each file in EXTRA_DOWNLOADS.

package/gettext-tiny/gettext-tiny.mk line 7

Quoted 13 lines
package/gettext-tiny/gettext-tiny.mk new file +7 -0
new file mode 100644
index 0000000000..cd4fdc9005
@@ -0,0 +1,84 @@
+################################################################################
+#
+# gettext-tiny
+#
+################################################################################
+
+GETTEXT_TINY_VERSION = f733dd3fdd7be973f523a464165aae827a17d838

Why don't you use a version? 0.3.1 has just been released, although it needs a backport:

    https://github.com/sabotage-linux/gettext-tiny/releases/tag/v0.3.1
    https://github.com/sabotage-linux/gettext-tiny/commit/58187329ad9f00eb8c39379e7ee0b608dd14bab8

I think I prefer if we were to use a released version and carry a baclported patch, rather than point to an arbitrary git commit...

package/gettext-tiny/gettext-tiny.mk line 20

Quoted 13 lines
package/gettext-tiny/gettext-tiny.mk new file +13 -0
+GETTEXT_TINY_SITE = $(call github,sabotage-linux,gettext-tiny,$(GETTEXT_TINY_VERSION))
+GETTEXT_TINY_LICENSE = MIT
+GETTEXT_TINY_INSTALL_STAGING = YES
+GETTEXT_TINY_LICENSE_FILES = LICENSE
+GETTEXT_TINY_PROVIDES = gettext
+
+ifneq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y)
+GETTEXT_TINY_OPTS = LIBINTL=NONE
+endif
+
+ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
+GETTEXT_TINY_OPTS = LIBINTL=MUSL
+endif

These two conditions do not seem to be mutually exclusive on first sight, and they are not: BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL is 'y' only for glibc, so under musl the first condition is true, and the second is true too, so we end up with GETTEXT_TINY_OPTS = LIBINTL=MUSL

I don't know if this is what we want, but it looks like it (given the explanations in their README).

However, when using uClibc-ng, we end up with the first definition, GETTEXT_TINY_OPTS = LIBINTL=NONE.

For that last one, I am a bit more skeptical. I still think we should provide aminimalist libintl, and thus we should use LIBINTL=NOOP

Quoted 17 lines
package/gettext-tiny/gettext-tiny.mk new file +17 -0
+ifeq ($(BR2_ENABLE_LOCALE),)
+GETTEXT_TINY_DEPENDENCIES = libiconv
+endif
+
+define GETTEXT_TINY_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		$(TARGET_CONFIGURE_OPTS) \
+		$(GETTEXT_TINY_OPTS)
+endef
+
+define HOST_GETTEXT_TINY_BUILD_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) -C $(@D) \
+		$(HOST_CONFIGURE_OPTS) \
+		$(GETTEXT_TINY_OPTS)
+endef
+
+define HOST_GETTEXT_TINY_INSTALL_CMDS

package/gettext-tiny/gettext-tiny.mk line 48

Quoted 10 lines
package/gettext-tiny/gettext-tiny.mk new file +10 -0
+	$(HOST_MAKE_ENV) $(MAKE) -C $(@D) \
+		$(HOST_CONFIGURE_OPTS) \
+		prefix=$(HOST_DIR) install
+
+	$(INSTALL) -D -m 0755 $(GETTEXT_TINY_PKGDIR)/files/gettextize \
+		$(HOST_DIR)/bin
+	$(SED) "s:@prefix@:$(HOST_DIR):" $(HOST_DIR)/bin/gettextize
+
+	cp -r $(GETTEXT_TINY_PKGDIR)/files/po \
+		$(HOST_DIR)/share/gettext-tiny

This is not going to work if $(HOST_DIR)/share does not already exist, so you need to create it first.

Also, if $(HOST_DIR)/share/gettext-tiny already exists, it will create a sub-directory po/ in it.

Usually, we do something like:

    mkdir -p $(HOST_DIR)/share/gettext-tiny
    cp -a $(GETTEXT_TINY_PKGDIR)/files/po/* \
        $(HOST_DIR)/share/gettext-tiny/

However, given my suggestion, earlier, you may have to adapt the new location of files. ;-)

Quoted 8 lines
package/gettext-tiny/gettext-tiny.mk new file +8 -0
+endef
+
+define GETTEXT_TINY_INSTALL_STAGING_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+		$(TARGET_CONFIGURE_OPTS) \
+		DESTDIR=$(STAGING_DIR) prefix=/usr install
+endef
+

package/gettext-tiny/gettext-tiny.mk line 66

Quoted 10 lines
package/gettext-tiny/gettext-tiny.mk new file +10 -0
+define GETTEXT_TINY_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
+		DESTDIR=$(TARGET_DIR) prefix=/usr install
+endef
+
+define GETTEXT_TINY_REMOVE_UNNEEDED
+	rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share/gettext-tiny
+endef
+
+GETTEXT_TINY_POST_INSTALL_TARGET_HOOKS += GETTEXT_TINY_REMOVE_UNNEEDED

Since this is a generic package, it is not really necessary to define post-install hooks. Just include that in GETTEXT_TINY_INSTALL_TARGET_CMDS:

    define GETTEXT_TINY_INSTALL_TARGET_CMDS
        $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
            DESTDIR=$(TARGET_DIR) prefix=/usr install
        rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share/gettext-tiny
    endef

package/gettext-tiny/gettext-tiny.mk line 74

Quoted 7 lines
package/gettext-tiny/gettext-tiny.mk new file +7 -0
+# autoreconf expects gettextize to install ABOUT-NLS
+define HOST_GETTEXT_TINY_ADD_ABOUT_NLS
+	$(INSTALL) -m 0644 $(GETTEXT_TINY_PKGDIR)/files/ABOUT-NLS \
+		$(HOST_DIR)/share/gettext-tiny/ABOUT-NLS
+endef
+
+HOST_GETTEXT_TINY_POST_INSTALL_HOOKS += HOST_GETTEXT_TINY_ADD_ABOUT_NLS

Ditto, include that directly in HOST_GETTEXT_TINY_INSTALL_CMDS

Quoted 14 lines
package/gettext-tiny/gettext-tiny.mk new file +9 -0
+ifeq ($(BR2_PACKAGE_GETTEXT_TINY),y)
+GETTEXTIZE = $(HOST_CONFIGURE_OPTS) \
+	     AUTOM4TE=$(HOST_DIR)/bin/autom4te \
+	     gettext_datadir=$(HOST_DIR)/usr/share/gettext-tiny \
+	     $(HOST_DIR)/bin/gettextize -f
+endif
+
+$(eval $(generic-package))
+$(eval $(host-generic-package))
package/gettext/Config.in +0 -0
index 9546468571..176c771161 100644

package/gettext/Config.in if BR2_PACKAGE_GETTEXT · line 10

Quoted 5 lines
package/gettext/Config.in +1 -1
@@ -7,7 +7,7 @@ if BR2_PACKAGE_GETTEXT
 config BR2_PACKAGE_GETTEXT_GNU
 	bool "gettext-gnu"
 	default y
-	depends on BR2_USE_WCHAR
+	depends on BR2_USE_WCHAR && !BR2_PACKAGE_GETTEXT_TINY

I think here we need to use a choice, as is done for example for the jpeg libraries, in package/jpeg/Config.in.

Quoted 28 lines
package/gettext/Config.in +14 -0
 	help
 	  The GNU `gettext' utilities are a set of tools that provide a
 	  framework to help other GNU packages produce multi-lingual
@@ -22,6 +22,20 @@ config BR2_PACKAGE_GETTEXT_GNU
 comment "gettext-gnu needs a toolchain w/ wchar"
 	depends on !BR2_USE_WCHAR
 
+comment "gettext-gnu can't be enabled with gettext-tiny"
+	depends on BR2_PACKAGE_GETTEXT_TINY
+
+config BR2_PACKAGE_GETTEXT_TINY
+	bool "gettext-tiny"
+	select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
+	help
+	  gettext-tiny provides lightweight replacements for tools typically
+	  used from the GNU gettext suite, which is incredibly bloated and
+	  takes a lot of time to build (in the order of an hour on slow
+	  devices).
+
+	  https://github.com/sabotage-linux/gettext-tiny
+
 config BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL
 	bool
 	default y if BR2_SYSTEM_ENABLE_NLS
@@ -30,12 +44,14 @@ config BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL
 config BR2_PACKAGE_PROVIDES_GETTEXT
 	string
 	default "gettext-gnu" if BR2_PACKAGE_GETTEXT_GNU

package/gettext/Config.in config BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL · line 55

Quoted 10 lines
package/gettext/Config.in +3 -1
+	default "gettext-tiny" if BR2_PACKAGE_GETTEXT_TINY
 
 config BR2_PACKAGE_HAS_GETTEXT
 	bool
 
 config BR2_PACKAGE_PROVIDES_HOST_GETTEXT
 	string
-	default "host-gettext-gnu"
+	default "host-gettext-gnu" if BR2_PACKAGE_GETTEXT_GNU
+	default "host-gettext-tiny" if BR2_PACKAGE_GETTEXT_TINY

It does not sound logical that the host variant depends on the target variant.

However, it makes sense: if one chooses the full-fledged GNU gettext for the target, they really want to have treu localisation, so they need the full gettext tools at build time too. However, if one chooses the lightweight gettext-tiny on the target, they do not care about localisation, so they don;t need the full tool suite at build either.

If my reasoning stands, then this should be explained in the commit log.

Thanks for working on this hard topic! :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#13 lore raw

PATCH 2/2 package/gettext-tiny: Add new package

Morin,

Quoted 423 lines · Yann E. MORIN

Vadim, All,

On 2018-12-23 17:04 +0200, Vadim Kochan spake thusly:

Quoted 9 lines

Add gettext-tiny package from the sabotage-linux project:

gettext-tiny provides lightweight replacements for tools typically used from the GNU gettext suite, which is incredibly bloated and takes a lot of time to build (in the order of an hour on slow devices). the most notable component is msgfmt which is used to create binary translation files in the .mo format out of textual input files in .po format. this is the most important tool for building software from source, because it is used from the build processes of many software packages.

I know you copy-pasted this part from upstream's README, but that is not the important thing we want to see in a commit log.

A commit log should explain the tricks and treats of a change: why it is needed, how it was made to work, why we have specific stuff that is not obvious.

For example...

Quoted 3 lines

Some files were taken from built gettext gnu (po/* and gettextize) to make possible perform gettextizing of packages. They will be removed once they will be added to the gettext-tiny project.

... why do we need to carry those files at all?

Her's what you could have said about ABOUT-NLS:

ABOUT-NLS only exists because, when a package uses gettect, autoreconf expects that file to exist, which is usually done by gettextize.

However ABOUT-NLS is *huge*, and I dobt autoreconf really requires that exact file. We could provide just a stub, that is created at build time, like so:

    define HOST_GETTEXT_TINY_ABOUT_NLS
        $(Q)mkdir -p $(HOST_DIR)/share/gettext-tiny
        $(Q)touch $(HOST_DIR)/share/gettext-tiny/ABOUT-NLS
    endef
    HOST_GETTEXT_TINY_POST_INSTALL_HOOKS += HOST_GETTEXT_TINY_ABOUT_NLS

That would cut out about 1/3rd of that big patch. ;-)

For gettextize itself, I guess there is not much we can do about... I was thinking we could maybe use:

GETTEXT_TINY_EXTRA_DOWNLOADS = https://git.savannah.gnu.org/cgit/gettext.git/tree/gettext-tools/misc/gettextize.in?h=v0.19.8.1

and then sed the place holders, but that's not so nice, and anyway there are a bunch of other files to handle as well... It's just that gettextize is so huge too... :-/

But we could maybe do something like:

    GETTEXT_TINY_GRAB_GETTEXT_FILES_URI = https://git.savannah.gnu.org/cgit/gettext.git/tree
    GETTEXT_TINY_GRAB_GETTEXT_FILES_VERSION = v0.19.8.1
    GETTEXT_TINY_GRAB_GETTEXT_FILES = \
        gettext-runtime/po/Makefile.in.in \
        gettext-tools/misc/gettextize.in \
        gettext-tools/po/Makevars.template \
        [...]

    GETTEXT_TINY_EXTRA_DOWNLOADS = \
        $(patsubst %,\
            $(GETTEXT_TINY_GRAB_GETTEXT_FILES_URI)/%?h=$(GETTEXT_TINY_GRAB_GETTEXT_FILES_VERSION),\
            $(GETTEXT_TINY_GRAB_GETTEXT_FILES))

    define HOST_GETTEXT_TINY_COPY_FILE
        $(foreach f,$(GETTEXT_TINY_GRAB_GETTEXT_FILES),\
            cp $(GETTEXT_TINY_DL_DIR)/$(notdir $(f)) $(@D)/$(notdir $(f))
        )
    endef
    HOST_GETTEXT_TINY_POST_EXTRACT_HOOKS += HOST_GETTEXT_TINY_COPY_FILE

    define HOST_GETTEXT_TINY_BUILD_CMDS
        cp $(@D)/gettetize.in $(@D)/gettextize
        $(SED) 's, at prefix@,$(HOST_DIR,; [...]' $(@D)/gettextize
    endef

    define HOST_GETTEXT_TINY_INSTALL_CMDS
        $(INSTALL) -m 0755 -D $(@D)/gettextize $(HOST_DIR)/bin/gettextize
    endef

(and so on for extra files. Untested, use with caution; may contain nuts.)

Quoted 5 lines

Allow to select it to be as gettext gnu alternative for the host & target builds.

---

[--SNIP--]

package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch line 4

Quoted 10 lines
package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch new file +4 -0
new file mode 100644
index 0000000000..57a7f3dd53
@@ -0,0 +1,51 @@
+From 9483ad60f8a39d2e8173add070ecb9839a54d140 Mon Sep 17 00:00:00 2001
+From: Vadim Kochan <[email protected]>
+Date: Sun, 21 Oct 2018 11:16:14 +0300
+Subject: [PATCH] libintl: Add 'format_arg' attribute

You need to give a little bit more details here, because it is not a trivial patch, and it is not obvious what's going on.

Also the filename doest not match the title:
0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch
vs.
libintl: Add 'format_arg' attribute

Also, did you try to submit this patch upstream? (you should.)

Quoted 17 lines
package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch new file +17 -0
+Signed-off-by: Vadim Kochan <[email protected]>
+---
+ include/libintl.h | 27 +++++++++++++++++++++------
+ 1 file changed, 21 insertions(+), 6 deletions(-)
+
+diff --git a/include/libintl.h b/include/libintl.h
+index b7123a9..173b3f3 100644
+--- a/include/libintl.h
++++ b/include/libintl.h
+@@ -1,12 +1,27 @@
+ #ifndef LIBINTL_H
+ #define LIBINTL_H
+
+-char *gettext(const char *msgid);
+-char *dgettext(const char *domainname, const char *msgid);
+-char *dcgettext(const char *domainname, const char *msgid, int category);
+-char *ngettext(const char *msgid1, const char *msgid2, unsigned long n);

package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch line 32

Quoted 10 lines
package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch new file +10 -0
+-char *dngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n);
+-char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n, int category);
++/* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return
++ *    its n-th argument literally.  This enables GCC to warn for example about
++ *       printf (gettext ("foo %y")).  */
++#if defined __GNUC__ && __GNUC__ >= 3 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1 && defined __cplusplus)
++# define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n)))
++#else
++# define _INTL_MAY_RETURN_STRING_ARG(n)
++#endif

It looks like you took the code verbatime from GNU gettext, but that code is LGPLv2.1-or-later, while gettext-tiny is MIT. Both licenses are compatible, but then you have to update the licensing terms in gettext-tiny.mk.

Alternatively, I would prefer if code of your own were to be used, without copying the coe from GNU gettext. Can you try to provide something? Hint: we don;t need the Apple stuff because we're only ever on Linux, and the oldest gcc version we support is 4.3.

Quoted 24 lines
package/gettext-tiny/0001-libintl-Fix-format-not-a-string-literal-error-for-gc.patch new file +18 -0
++char *gettext(const char *msgid)
++    _INTL_MAY_RETURN_STRING_ARG(1);
++char *dgettext(const char *domainname, const char *msgid)
++    _INTL_MAY_RETURN_STRING_ARG(2);
++char *dcgettext(const char *domainname, const char *msgid, int category)
++    _INTL_MAY_RETURN_STRING_ARG(2);
++char *ngettext(const char *msgid1, const char *msgid2, unsigned long n)
++    _INTL_MAY_RETURN_STRING_ARG(1) _INTL_MAY_RETURN_STRING_ARG(2);
++char *dngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n)
++    _INTL_MAY_RETURN_STRING_ARG(2) _INTL_MAY_RETURN_STRING_ARG(3);
++char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n, int category)
++    _INTL_MAY_RETURN_STRING_ARG(2) _INTL_MAY_RETURN_STRING_ARG(3);
+
+ char *textdomain(const char *domainname);
+ char *bind_textdomain_codeset(const char *domainname, const char *codeset);
+--
+2.14.1
+
package/gettext-tiny/0002-libintl-Use-gettext-wrappers-if-NLS-is-disabled.patch new file +0 -0
new file mode 100644
index 0000000000..a6a4fcb892

package/gettext-tiny/0002-libintl-Use-gettext-wrappers-if-NLS-is-disabled.patch line 4

Quoted 4 lines
package/gettext-tiny/0002-libintl-Use-gettext-wrappers-if-NLS-is-disabled.patch new file +4 -0
@@ -0,0 +1,26 @@
+From 8d6897b7b9df3dc8228fcdab42bcb9a915b64cef Mon Sep 17 00:00:00 2001
+From: Vadim Kochan <[email protected]>
+Date: Sun, 21 Oct 2018 19:00:03 +0300
+Subject: [PATCH] libintl: Use gettext wrappers if NLS is disabled

Ditto, you need to provide a bit more explanations here.

However, can't we just include -LIBINTL_NO_MACROS=1 in our CPPFLAGS, instead? E.g.:

    diff --git a/package/Makefile.in b/package/Makefile.in
    index 44761b79c5..95b6825aa3 100644
    --- a/package/Makefile.in
    +++ b/package/Makefile.in
    @@ -159,6 +159,7 @@ TARGET_HARDENED += -D_FORTIFY_SOURCE=2
     endif

     TARGET_CPPFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
    +TARGET_CPPFLAGS += $(if $(BR2_PACKAGE_GETTEXT_TINY),-DLIBINTL_NO_MACROS=1)
     TARGET_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING) $(TARGET_HARDENED)
     TARGET_CXXFLAGS = $(TARGET_CFLAGS)
     TARGET_FCFLAGS = $(TARGET_ABI) $(TARGET_OPTIMIZATION) $(TARGET_DEBUGGING)

[--SNIP--]

package/gettext-tiny/gettext-tiny.hash line 2

Quoted 8 lines
package/gettext-tiny/gettext-tiny.hash new file +2 -0
new file mode 100644
index 0000000000..3b0b73d047
@@ -0,0 +1,2 @@
+# Locally Computed:
+sha256 40a003e850ae8c29b8e6e6321925596c3a57d7ae8296d880dc1e88a07aebcd93  gettext-tiny-f733dd3fdd7be973f523a464165aae827a17d838.tar.gz

Here, you'll need to add a hash file for each file in EXTRA_DOWNLOADS.

package/gettext-tiny/gettext-tiny.mk line 7

Quoted 13 lines
package/gettext-tiny/gettext-tiny.mk new file +7 -0
new file mode 100644
index 0000000000..cd4fdc9005
@@ -0,0 +1,84 @@
+################################################################################
+#
+# gettext-tiny
+#
+################################################################################
+
+GETTEXT_TINY_VERSION = f733dd3fdd7be973f523a464165aae827a17d838

Why don't you use a version? 0.3.1 has just been released, although it needs a backport:

    https://github.com/sabotage-linux/gettext-tiny/releases/tag/v0.3.1
    https://github.com/sabotage-linux/gettext-tiny/commit/58187329ad9f00eb8c39379e7ee0b608dd14bab8

I think I prefer if we were to use a released version and carry a baclported patch, rather than point to an arbitrary git commit...

package/gettext-tiny/gettext-tiny.mk line 20

Quoted 13 lines
package/gettext-tiny/gettext-tiny.mk new file +13 -0
+GETTEXT_TINY_SITE = $(call github,sabotage-linux,gettext-tiny,$(GETTEXT_TINY_VERSION))
+GETTEXT_TINY_LICENSE = MIT
+GETTEXT_TINY_INSTALL_STAGING = YES
+GETTEXT_TINY_LICENSE_FILES = LICENSE
+GETTEXT_TINY_PROVIDES = gettext
+
+ifneq ($(BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL),y)
+GETTEXT_TINY_OPTS = LIBINTL=NONE
+endif
+
+ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
+GETTEXT_TINY_OPTS = LIBINTL=MUSL
+endif

These two conditions do not seem to be mutually exclusive on first sight, and they are not: BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL is 'y' only for glibc, so under musl the first condition is true, and the second is true too, so we end up with GETTEXT_TINY_OPTS = LIBINTL=MUSL

I don't know if this is what we want, but it looks like it (given the explanations in their README).

However, when using uClibc-ng, we end up with the first definition, GETTEXT_TINY_OPTS = LIBINTL=NONE.

For that last one, I am a bit more skeptical. I still think we should provide aminimalist libintl, and thus we should use LIBINTL=NOOP

Quoted 17 lines
package/gettext-tiny/gettext-tiny.mk new file +17 -0
+ifeq ($(BR2_ENABLE_LOCALE),)
+GETTEXT_TINY_DEPENDENCIES = libiconv
+endif
+
+define GETTEXT_TINY_BUILD_CMDS
+     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+             $(TARGET_CONFIGURE_OPTS) \
+             $(GETTEXT_TINY_OPTS)
+endef
+
+define HOST_GETTEXT_TINY_BUILD_CMDS
+     $(HOST_MAKE_ENV) $(MAKE) -C $(@D) \
+             $(HOST_CONFIGURE_OPTS) \
+             $(GETTEXT_TINY_OPTS)
+endef
+
+define HOST_GETTEXT_TINY_INSTALL_CMDS

package/gettext-tiny/gettext-tiny.mk line 48

Quoted 10 lines
package/gettext-tiny/gettext-tiny.mk new file +10 -0
+     $(HOST_MAKE_ENV) $(MAKE) -C $(@D) \
+             $(HOST_CONFIGURE_OPTS) \
+             prefix=$(HOST_DIR) install
+
+     $(INSTALL) -D -m 0755 $(GETTEXT_TINY_PKGDIR)/files/gettextize \
+             $(HOST_DIR)/bin
+     $(SED) "s:@prefix@:$(HOST_DIR):" $(HOST_DIR)/bin/gettextize
+
+     cp -r $(GETTEXT_TINY_PKGDIR)/files/po \
+             $(HOST_DIR)/share/gettext-tiny

This is not going to work if $(HOST_DIR)/share does not already exist, so you need to create it first.

Also, if $(HOST_DIR)/share/gettext-tiny already exists, it will create a sub-directory po/ in it.

Usually, we do something like:

    mkdir -p $(HOST_DIR)/share/gettext-tiny
    cp -a $(GETTEXT_TINY_PKGDIR)/files/po/* \
        $(HOST_DIR)/share/gettext-tiny/

However, given my suggestion, earlier, you may have to adapt the new location of files. ;-)

Quoted 8 lines
package/gettext-tiny/gettext-tiny.mk new file +8 -0
+endef
+
+define GETTEXT_TINY_INSTALL_STAGING_CMDS
+     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
+             $(TARGET_CONFIGURE_OPTS) \
+             DESTDIR=$(STAGING_DIR) prefix=/usr install
+endef
+

package/gettext-tiny/gettext-tiny.mk line 66

Quoted 10 lines
package/gettext-tiny/gettext-tiny.mk new file +10 -0
+define GETTEXT_TINY_INSTALL_TARGET_CMDS
+     $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
+             DESTDIR=$(TARGET_DIR) prefix=/usr install
+endef
+
+define GETTEXT_TINY_REMOVE_UNNEEDED
+     rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share/gettext-tiny
+endef
+
+GETTEXT_TINY_POST_INSTALL_TARGET_HOOKS += GETTEXT_TINY_REMOVE_UNNEEDED

Since this is a generic package, it is not really necessary to define post-install hooks. Just include that in GETTEXT_TINY_INSTALL_TARGET_CMDS:

    define GETTEXT_TINY_INSTALL_TARGET_CMDS
        $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
            DESTDIR=$(TARGET_DIR) prefix=/usr install
        rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/share/gettext-tiny
    endef

package/gettext-tiny/gettext-tiny.mk line 74

Quoted 7 lines
package/gettext-tiny/gettext-tiny.mk new file +7 -0
+# autoreconf expects gettextize to install ABOUT-NLS
+define HOST_GETTEXT_TINY_ADD_ABOUT_NLS
+     $(INSTALL) -m 0644 $(GETTEXT_TINY_PKGDIR)/files/ABOUT-NLS \
+             $(HOST_DIR)/share/gettext-tiny/ABOUT-NLS
+endef
+
+HOST_GETTEXT_TINY_POST_INSTALL_HOOKS += HOST_GETTEXT_TINY_ADD_ABOUT_NLS

Ditto, include that directly in HOST_GETTEXT_TINY_INSTALL_CMDS

Quoted 14 lines
package/gettext-tiny/gettext-tiny.mk new file +9 -0
+ifeq ($(BR2_PACKAGE_GETTEXT_TINY),y)
+GETTEXTIZE = $(HOST_CONFIGURE_OPTS) \
+          AUTOM4TE=$(HOST_DIR)/bin/autom4te \
+          gettext_datadir=$(HOST_DIR)/usr/share/gettext-tiny \
+          $(HOST_DIR)/bin/gettextize -f
+endif
+
+$(eval $(generic-package))
+$(eval $(host-generic-package))
package/gettext/Config.in +0 -0
index 9546468571..176c771161 100644

package/gettext/Config.in if BR2_PACKAGE_GETTEXT · line 10

Quoted 5 lines
package/gettext/Config.in +1 -1
@@ -7,7 +7,7 @@ if BR2_PACKAGE_GETTEXT
 config BR2_PACKAGE_GETTEXT_GNU
      bool "gettext-gnu"
      default y
-     depends on BR2_USE_WCHAR
+     depends on BR2_USE_WCHAR && !BR2_PACKAGE_GETTEXT_TINY

I think here we need to use a choice, as is done for example for the jpeg libraries, in package/jpeg/Config.in.

Quoted 28 lines
package/gettext/Config.in +14 -0
      help
        The GNU `gettext' utilities are a set of tools that provide a
        framework to help other GNU packages produce multi-lingual
@@ -22,6 +22,20 @@ config BR2_PACKAGE_GETTEXT_GNU
 comment "gettext-gnu needs a toolchain w/ wchar"
      depends on !BR2_USE_WCHAR
 
+comment "gettext-gnu can't be enabled with gettext-tiny"
+     depends on BR2_PACKAGE_GETTEXT_TINY
+
+config BR2_PACKAGE_GETTEXT_TINY
+     bool "gettext-tiny"
+     select BR2_PACKAGE_LIBICONV if !BR2_ENABLE_LOCALE
+     help
+       gettext-tiny provides lightweight replacements for tools typically
+       used from the GNU gettext suite, which is incredibly bloated and
+       takes a lot of time to build (in the order of an hour on slow
+       devices).
+
+       https://github.com/sabotage-linux/gettext-tiny
+
 config BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL
      bool
      default y if BR2_SYSTEM_ENABLE_NLS
@@ -30,12 +44,14 @@ config BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL
 config BR2_PACKAGE_PROVIDES_GETTEXT
      string
      default "gettext-gnu" if BR2_PACKAGE_GETTEXT_GNU

package/gettext/Config.in config BR2_PACKAGE_GETTEXT_PROVIDES_LIBINTL · line 55

Quoted 10 lines
package/gettext/Config.in +3 -1
+     default "gettext-tiny" if BR2_PACKAGE_GETTEXT_TINY
 
 config BR2_PACKAGE_HAS_GETTEXT
      bool
 
 config BR2_PACKAGE_PROVIDES_HOST_GETTEXT
      string
-     default "host-gettext-gnu"
+     default "host-gettext-gnu" if BR2_PACKAGE_GETTEXT_GNU
+     default "host-gettext-tiny" if BR2_PACKAGE_GETTEXT_TINY

It does not sound logical that the host variant depends on the target variant.

However, it makes sense: if one chooses the full-fledged GNU gettext for the target, they really want to have treu localisation, so they need the full gettext tools at build time too. However, if one chooses the lightweight gettext-tiny on the target, they do not care about localisation, so they don;t need the full tool suite at build either.

If my reasoning stands, then this should be explained in the commit log.

Thanks for working on this hard topic! :-)

Regards,
Yann E. MORIN.

Quoted 7 lines

--
.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |

'------------------------------^-------^------------------^--------------------'

Thank you a lot! It was very-very helpful! I almost done with version which grabs files from gettext-gnu
repo and installs them to the host instead of keeping them inside the gettext-tiny/files folder.

Regards,
Vadim Kochan