diff mbox series

[04/15] package/pkg-autotools: add FOO_AUTOPOINT flag

Message ID 20230221172205.2450111-4-vfazio@xes-inc.com
State Accepted
Headers show
Series [01/15] package/pkg-autotools: drop FOO_GETTEXTIZE_OPTS support | expand

Commit Message

Vincent Fazio Feb. 21, 2023, 5:21 p.m. UTC
From: Vincent Fazio <vfazio@gmail.com>

Add a new variable to run autopoint during autoreconf.

This variable depends on FOO_AUTORECONF = YES. It is mutually exclusive
to FOO_GETTEXTIZE. If both are set, FOO_AUTOPOINT is ignored to preserve
previous behavior.

This support is being added per a previous discussion [1].

The usage of gettextize needs to be removed cuz mama says so [2].
  ... is not part of the GNU build system, in the sense that it should
  not be invoked automatically, and not be invoked by someone who doesn’t
  assume the responsibilities of a package maintainer. For the latter
  purpose, a separate tool is provided, see Invoking the autopoint Program [3]

Using gettextize has the unintended consequence of updating the package
based on the version of host-gettext vs what was chosen by the upstream
maintainer. As mama said above, we should use autopoint. Do as she says
to avoid further scolding (gettextize shoehorning and package patching).

[1] https://patchwork.ozlabs.org/project/buildroot/patch/20170827110920.15579-1-aleksander@aleksander.es/
[2] https://www.gnu.org/software/gettext/manual/html_node/gettextize-Invocation.html
[3] https://www.gnu.org/software/gettext/manual/html_node/autopoint-Invocation.html

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
---
 package/pkg-autotools.mk | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk
index 418cd10945..48485567d7 100644
--- a/package/pkg-autotools.mk
+++ b/package/pkg-autotools.mk
@@ -152,6 +152,15 @@  ifndef $(2)_GETTEXTIZE
  endif
 endif
 
+ifndef $(2)_AUTOPOINT
+ ifdef $(3)_AUTOPOINT
+  $(2)_AUTOPOINT = $$($(3)_AUTOPOINT)
+ else
+  $(2)_AUTOPOINT ?= NO
+ endif
+endif
+
+
 ifeq ($(4),host)
  $(2)_AUTORECONF_OPTS ?= $$($(3)_AUTORECONF_OPTS)
 endif
@@ -240,8 +249,14 @@  ifeq ($$($(2)_AUTORECONF),YES)
 ifeq ($$($(2)_GETTEXTIZE),YES)
 $(2)_PRE_CONFIGURE_HOOKS += GETTEXTIZE_HOOK
 $(2)_DEPENDENCIES += host-gettext
-endif
 $(2)_AUTORECONF_ENV += AUTOPOINT=/bin/true
+# autopoint is provided by gettext
+else ifeq ($$($(2)_AUTOPOINT),YES)
+$(2)_DEPENDENCIES += host-gettext
+$(2)_AUTORECONF_ENV += AUTOPOINT=$$(HOST_DIR)/bin/autopoint
+else
+$(2)_AUTORECONF_ENV += AUTOPOINT=/bin/true
+endif
 $(2)_PRE_CONFIGURE_HOOKS += AUTORECONF_HOOK
 # default values are not evaluated yet, so don't rely on this defaulting to YES
 ifneq ($$($(2)_LIBTOOL_PATCH),NO)