From c28231ca7f98f9d1061f59d1b8f9d13490d03bae Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Mon, 20 Nov 2023 22:57:23 -0500 Subject: [PATCH] gettext.mk: Fix installation rules with some shells. The following syntax is not portable to certain shells: for f in ; do stuff; done When no translations are installed, a command just like this is generated in the installation rules. Instead of doing nothing as desired, HP-UX 11 /bin/sh, heirloom-sh, and presumably also old Solaris /bin/sh will exit with an error. To work around this problem, we can stuff the list into a shell variable and then use that in the for loop. --- snippet/gettext.mk | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/snippet/gettext.mk b/snippet/gettext.mk index 3800114..8f6865b 100644 --- a/snippet/gettext.mk +++ b/snippet/gettext.mk @@ -1,4 +1,4 @@ -# Copyright © 2011-2012 Nick Bowler +# Copyright © 2011-2012, 2023 Nick Bowler # # Automake fragment to distribute and install gettext .po/.mo files, intended # for use in a non-recursive build setup. This does not include rules to @@ -25,33 +25,31 @@ MAINTAINERCLEANFILES += $(ALL_MOFILES) install-data-local: install-mofiles install-mofiles: $(MOFILES) - for mo in $?; do \ - lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \ - test x"$$lang" = x"" && exit 1; \ - inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \ - (set -x; $(MKDIR_P) "$$inst") \ - || exit $$?; \ - (set -x; $(INSTALL_DATA) "$$mo" "$$inst/$(PACKAGE).mo") \ - || exit $$?; \ + mos='$?'; for mo in $$mos; do \ + lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \ + test x"$$lang" = x"" && exit 1; \ + inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \ + (set -x; $(MKDIR_P) "$$inst") || exit; \ + (set -x; $(INSTALL_DATA) "$$mo" "$$inst/$(PACKAGE).mo") || exit; \ done .PHONY: install-mofiles installdirs-local: installdirs-mofiles installdirs-mofiles: - for mo in $(MOFILES); do \ - lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \ - test x"$$lang" = x"" && exit 1; \ - inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \ - (set -x; $(MKDIR_P) "$$inst") || exit $$?; \ + mos='$(MOFILES)'; for mo in $$mos; do \ + lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \ + test x"$$lang" = x"" && exit 1; \ + inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \ + (set -x; $(MKDIR_P) "$$inst") || exit; \ done .PHONY: installdirs-mofiles uninstall-local: uninstall-mofiles uninstall-mofiles: - for mo in $(ALL_MOFILES); do \ - lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \ - test x"$$lang" = x"" && exit 1; \ - inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \ - (set -x; cd "$$inst" && rm -f '$(PACKAGE).mo'); \ + mos='$(ALL_MOFILES)'; for mo in $$mos; do \ + lang=`expr "$$mo" : '.*/\(.*\)\.mo' \| "$$mo" : '\(.*\)\.mo'`; \ + test x"$$lang" = x"" && exit 1; \ + inst="$(DESTDIR)$(localedir)/$$lang/LC_MESSAGES"; \ + (set -x; cd "$$inst" && rm -f '$(PACKAGE).mo'); \ done .PHONY: uninstall-mofiles -- 2.43.2