Skip to contentSkip to conversation

pkg-autotools: introduce infra to gettextize packages (branch yem/gettext)

RFC PATCH Superseded Yann E. MORIN 3 participants 12 messages Jul 15, 2014 – Jul 16, 2014

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover pkg-autotools: introduce infra to gettextize packages (branch yem/gettext)

Hello All!

This small series introduces the gettextize of a package as an optional sequence in the autotools package infra.

It has been only slightly tested, so is still in RFC stage.

Three packages have been converted: wget (the historical offender), coreutils and parted. Others may need gettextizing, too, but the autobuilders (or users) will catch them eventually.

Changes RFCv1 -> RFCv2:
- only getttextize with autoreconf (Gustavo)

Regards,
Yann E. MORIN.

The following changes since commit 201adefb6e17e30d8e66b3d673c58cfd17ac1b5a:

Makefile: do not purge locale-archive from target (2014-07-15 22:56:23 +0200)

are available in the git repository at:

git://ymorin.is-a-geek.org/buildroot yem/gettext

for you to fetch changes up to 2cf9afdee12730d0d550b2847f620e8011b6852e:

package/parted: gettextize to match the new gettext version (2014-07-16 00:23:15 +0200)

----------------------------------------------------------------
Yann E. MORIN (5):
pkg-autotools: add support to gettextize a package
manual: add gettextize explanations in the manual package/wget: use the new gettextize infra package/coreutils: gettextize to match the new gettext version package/parted: gettextize to match the new gettext version

 docs/manual/adding-packages-autotools.txt | 12 +++++++++++
 package/coreutils/coreutils.mk            |  1 +
 package/parted/parted.mk                  |  1 +
 package/pkg-autotools.mk                  | 33 +++++++++++++++++++++++++++++--
 package/wget/wget.mk                      |  6 +-----
 5 files changed, 46 insertions(+), 7 deletions(-)
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.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH v2 1/5 pkg-autotools: add support to gettextize a package

In case a package comes with a gettext infra which is different from the one Buildroot provides, we'd get autoreconf errors, like:

    http://autobuild.buildroot.net/results/c0f/c0f7c801f61fdc310cde64342060b00a70155431/

To avoid that, we need to gettextize the package prior to running autoreconf.

Provide the necessary infrastructure in the autotools infrastructure, so we can do it consistently across packages.

Cc Gustavo Zacarias <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Baruch Siach <[email protected]>

---
Changes v1 -> v2:
- only gettextize with autoreconf (Gustavo)
- add host-gettext to the filter-out (Gustavo)

---
 package/pkg-autotools.mk | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)
package/pkg-autotools.mk +31 -2
index ddff9bf..866bf6a 100644
@@ -87,6 +87,22 @@ ifndef $(2)_AUTORECONF
  endif
 endif
 
+ifndef $(2)_GETTEXTIZE
+ ifdef $(3)_GETTEXTIZE
+  $(2)_GETTEXTIZE = $($(3)_GETTEXTIZE)
+ else
+  $(2)_GETTEXTIZE ?= NO
+ endif
+endif
+
+ifndef $(2)_GETTEXTIZE_OPT
+ ifdef $(3)_GETTEXTIZE_OPT
+  $(2)_GETTEXTIZE_OPT = $($(3)_GETTEXTIZE)
+ else
+  $(2)_GETTEXTIZE_OPT ?= -f
+ endif
+endif
+
 ifeq ($(4),host)
  $(2)_AUTORECONF_OPT ?= $$($(3)_AUTORECONF_OPT)
 endif
@@ -200,6 +216,14 @@ $(2)_POST_PATCH_HOOKS += LIBTOOL_PATCH_HOOK
 endif
 
 #
+# Hook to gettextize the package if needed
+#
+define GETTEXTIZE_HOOK
+	@$$(call MESSAGE,"Gettextizing")
+	$(Q)cd $$($$(PKG)_SRCDIR) && $(HOST_DIR)/usr/bin/gettextize $$($$(PKG)_GETTEXTIZE_OPT)
+endef
+
+#
 # Hook to autoreconf the package if needed
 #
 define AUTORECONF_HOOK
@@ -222,14 +246,19 @@ endef
 
 # This must be repeated from inner-generic-package, otherwise we get an empty
 # _DEPENDENCIES if _AUTORECONF is YES.  Also filter the result of _AUTORECONF
-# away from the non-host rule
+# and _GETTEXTIZE away from the non-host rule
 ifeq ($(4),host)
 $(2)_DEPENDENCIES ?= $$(filter-out host-automake host-autoconf host-libtool \
-				host-toolchain $(1),\
+				host-gettext host-toolchain $(1),\
     $$(patsubst host-host-%,host-%,$$(addprefix host-,$$($(3)_DEPENDENCIES))))
 endif
 
 ifeq ($$($(2)_AUTORECONF),YES)
+# This has to come before autoreconf
+ifeq ($$($(2)_GETTEXTIZE),YES)
+$(2)_PRE_CONFIGURE_HOOK += GETTEXTIZE_HOOK
+$(2)_DEPENDENCIES += host-gettext
+endif
 $(2)_PRE_CONFIGURE_HOOKS += AUTORECONF_HOOK
 $(2)_DEPENDENCIES += host-automake host-autoconf host-libtool
 endif
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 1/5 pkg-autotools: add support to gettextize a package

On 07/15/2014 07:37 PM, Yann E. MORIN wrote:

Hi, a couple of late-night fixes:

package/pkg-autotools.mk ifndef $(2)_AUTORECONF · line 92

Quoted 3 lines
package/pkg-autotools.mk +3 -0
+ifndef $(2)_GETTEXTIZE
+ ifdef $(3)_GETTEXTIZE
+  $(2)_GETTEXTIZE = $($(3)_GETTEXTIZE)

$(2)_GETTEXTIZE = $$($(3)_GETTEXTIZE)

package/pkg-autotools.mk ifndef $(2)_AUTORECONF · line 100

Quoted 3 lines
package/pkg-autotools.mk +3 -0
+ifndef $(2)_GETTEXTIZE_OPT
+ ifdef $(3)_GETTEXTIZE_OPT
+  $(2)_GETTEXTIZE_OPT = $($(3)_GETTEXTIZE)

$(2)_GETTEXTIZE_OPT = $$($(3)_GETTEXTIZE_OPT)

package/pkg-autotools.mk endef · line 259

Quoted 4 lines

ifeq ($$($(2)_AUTORECONF),YES)

package/pkg-autotools.mk +3 -0
+# This has to come before autoreconf
+ifeq ($$($(2)_GETTEXTIZE),YES)
+$(2)_PRE_CONFIGURE_HOOK += GETTEXTIZE_HOOK

$(2)_PRE_CONFIGURE_HOOKS += GETTEXTIZE_HOOK

Regards.

#3 lore raw

PATCH v2 2/5 manual: add gettextize explanations in the manual

In reply to Yann E. MORIN
Cc Gustavo Zacarias <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Baruch Siach <[email protected]>

---
Changes v1 -> v2:
- gettextize is only valid if autoreconf=yes (Gustavo)

---
 docs/manual/adding-packages-autotools.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)
docs/manual/adding-packages-autotools.txt +12 -0
index c7e797f..a58ebf1 100644
@@ -125,6 +125,18 @@ cases, typical packages will therefore only use a few of them.
   passed to the 'autoreconf' program if
   +LIBFOO_AUTORECONF=YES+. By default, empty.
 
+* +LIBFOO_GETTEXTIZE+, tells whether the package should be
+  gettextized or not (i.e. if the pacakge uses an different gettext
+  version than Buildroot provides, and it is needed to run
+  'gettextize'.) Only valid when +LIBFOO_AUTORECONF=YES+. Valid
+  values are +YES+ and +NO+. The default is +NO+.
+
+* +LIBFOO_GETTEXTIZE_OPT+, to specify additional options passed to
+  the 'gettextize' program, if +LIBFOO_GETTEXTIZE=YES+. You may
+  use that if, for example, the +.po+ files are not located in the
+  standard place (i.e. in +po/+ at the root of the package.) By
+  default, '-f'.
+
 * +LIBFOO_LIBTOOL_PATCH+ tells whether the Buildroot
   patch to fix libtool cross-compilation issues should be applied or
   not. Valid values are +YES+ and +NO+. By
Signature · 1 line
1.9.1
#4 lore raw

PATCH v2 2/5 manual: add gettextize explanations in the manual

On 07/15/2014 07:37 PM, Yann E. MORIN wrote:

Minor nitpicking here...

docs/manual/adding-packages-autotools.txt cases, typical packages will therefore only use a few of them. · line 129

Quoted 2 lines
docs/manual/adding-packages-autotools.txt +2 -0
+* +LIBFOO_GETTEXTIZE+, tells whether the package should be
+  gettextized or not (i.e. if the pacakge uses an different gettext

s/ an / a /
Otherwise great, thanks.
Regards.

#5 lore raw

PATCH v2 3/5 package/wget: use the new gettextize infra

In reply to Yann E. MORIN

Use the new gettextize infra we just added gettextize wget.

Cc Gustavo Zacarias <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Baruch Siach <[email protected]>
---
 package/wget/wget.mk | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
package/wget/wget.mk +1 -5
index 56ccfb5..b6a22b1 100644
@@ -15,11 +15,7 @@ WGET_AUTORECONF = YES
 
 # Ugly kludge to fix autoreconf with old gettext infra
 # We need to gettextize before autoreconf to upgrade
-WGET_DEPENDENCIES += host-gettext
-define WGET_GETTEXTIZE
-	cd $(@D) ; $(HOST_DIR)/usr/bin/gettextize -f
-endef
-WGET_PRE_CONFIGURE_HOOKS += WGET_GETTEXTIZE
+WGET_GETTEXTIZE = YES
 
 # Prefer full-blown wget over busybox
 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
Signature · 1 line
1.9.1
#7 lore raw

PATCH v2 3/5 package/wget: use the new gettextize infra

In reply to Yann E. MORIN

Hi Yann,

Quoted 15 lines · Yann E. MORIN

Use the new gettextize infra we just added gettextize wget.

Cc Gustavo Zacarias <[email protected]>
Cc Thomas Petazzoni <[email protected]>
Cc Baruch Siach <[email protected]>
---
 package/wget/wget.mk | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
package/wget/wget.mk +0 -0
index 56ccfb5..b6a22b1 100644

package/wget/wget.mk WGET_AUTORECONF = YES · line 17

Quoted 3 lines
package/wget/wget.mk +0 -0
@@ -15,11 +15,7 @@ WGET_AUTORECONF = YES
 
 # Ugly kludge to fix autoreconf with old gettext infra
 # We need to gettextize before autoreconf to upgrade

This comment can also be removed now, I believe.

baruch

Quoted 9 lines
package/wget/wget.mk +1 -5
-WGET_DEPENDENCIES += host-gettext
-define WGET_GETTEXTIZE
-	cd $(@D) ; $(HOST_DIR)/usr/bin/gettextize -f
-endef
-WGET_PRE_CONFIGURE_HOOKS += WGET_GETTEXTIZE
+WGET_GETTEXTIZE = YES
 
 # Prefer full-blown wget over busybox
 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#8 lore raw

PATCH v2 4/5 package/coreutils: gettextize to match the new gettext version

In reply to Yann E. MORIN

The gettext macros in the package are from a gettext version older than the one we have in Buildroot, so autoreconf fails.

Run gettextize prior to running autoreconf, like we do in wget.

Fixes:

    http://autobuild.buildroot.net/results/228/228224668be4376844fe924d0a5b346af0414460/
    http://autobuild.buildroot.net/results/ac4/ac4dbb1342e9c9f1de5412e0b71fe4422ef744ef/
    http://autobuild.buildroot.net/results/a0c/a0c25faf149de9d51768eed8ff5a2274282cd797/
    ...
Cc Gustavo Zacarias <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 package/coreutils/coreutils.mk | 1 +
 1 file changed, 1 insertion(+)
package/coreutils/coreutils.mk +1 -0
index c90396d..af202b4 100644
@@ -12,6 +12,7 @@ COREUTILS_LICENSE_FILES = COPYING
 
 # patching gnulib .m4 file
 COREUTILS_AUTORECONF = YES
+COREUTILS_GETTEXTIZE = YES
 
 # If both coreutils and busybox are selected, make certain coreutils
 # wins the fight over who gets to have their utils actually installed.
Signature · 1 line
1.9.1
#9 lore raw

PATCH v2 4/5 package/coreutils: gettextize to match the new gettext version

Quoted 6 lines · Yann E. MORIN

The gettext macros in the package are from a gettext version older than the one we have in Buildroot, so autoreconf fails.

Run gettextize prior to running autoreconf, like we do in wget.

Fixes:

Quoted 8 lines
    http://autobuild.buildroot.net/results/228/228224668be4376844fe924d0a5b346af0414460/
    http://autobuild.buildroot.net/results/ac4/ac4dbb1342e9c9f1de5412e0b71fe4422ef744ef/
    http://autobuild.buildroot.net/results/a0c/a0c25faf149de9d51768eed8ff5a2274282cd797/
    ...
Cc Gustavo Zacarias <[email protected]>
Cc Thomas Petazzoni <[email protected]>
#10 lore raw

PATCH v2 5/5 package/parted: gettextize to match the new gettext version

In reply to Yann E. MORIN

The gettext macros in the package are from a gettext version older than the one we have in Buildroot, so autoreconf fails.

Run gettextize prior to running autoreconf, like we do in wget.

Fixes:

    http://autobuild.buildroot.net/results/ee2/ee20455ead785200847f50e463c32c55821f8925/
    http://autobuild.buildroot.net/results/3fe/3fe46e1a6ef10645e46a2e9efdf651f60f05dea8/
    http://autobuild.buildroot.net/results/ecd/ecdacafb3245afa1cce4f587eff9bdfe5c162f81/
    ...
Cc Gustavo Zacarias <[email protected]>
Cc Thomas Petazzoni <[email protected]>
---
 package/parted/parted.mk | 1 +
 1 file changed, 1 insertion(+)
package/parted/parted.mk +1 -0
index fd82684..75537a7 100644
@@ -11,6 +11,7 @@ PARTED_DEPENDENCIES = util-linux
 PARTED_INSTALL_STAGING = YES
 # For uclinux patch
 PARTED_AUTORECONF = YES
+PARTED_GETTEXTIZE = YES
 PARTED_LICENSE = GPLv3+
 PARTED_LICENSE_FILES = COPYING
 
Signature · 1 line
1.9.1
#11 lore raw

PATCH v2 5/5 package/parted: gettextize to match the new gettext version

Quoted 6 lines · Yann E. MORIN

The gettext macros in the package are from a gettext version older than the one we have in Buildroot, so autoreconf fails.

Run gettextize prior to running autoreconf, like we do in wget.

Fixes:

Quoted 8 lines
    http://autobuild.buildroot.net/results/ee2/ee20455ead785200847f50e463c32c55821f8925/
    http://autobuild.buildroot.net/results/3fe/3fe46e1a6ef10645e46a2e9efdf651f60f05dea8/
    http://autobuild.buildroot.net/results/ecd/ecdacafb3245afa1cce4f587eff9bdfe5c162f81/
    ...
Cc Gustavo Zacarias <[email protected]>
Cc Thomas Petazzoni <[email protected]>