All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Restore patches to po/Makefile.in.in
@ 2020-03-01 17:59 Colin Watson
  2020-03-03 13:53 ` Daniel Kiper
  0 siblings, 1 reply; 2+ messages in thread
From: Colin Watson @ 2020-03-01 17:59 UTC (permalink / raw)
  To: grub-devel

These were inadvertently lost during the conversion to Gnulib.  The
files in po/gettext-patches/ can be imported using "git am" on top of
the gettext tag corresponding to AM_GNU_GETTEXT_VERSION in configure.ac
(currently 0.18.3).  They handle translation of messages in shell files,
make msgfmt output in little-endian format, and arrange to use @SHELL@
rather than /bin/sh.

There were some changes solely for the purpose of distributing extra
files; for ease of maintenance, I've added these to
conf/Makefile.extra-dist instead.

Fixes: https://savannah.gnu.org/bugs/?57298
Signed-off-by: Colin Watson <cjwatson@ubuntu.com>
---
 bootstrap.conf                                |  8 +++
 conf/Makefile.extra-dist                      | 15 ++++++
 docs/grub-dev.texi                            |  3 ++
 .../0001-Support-POTFILES-shell.patch         | 54 +++++++++++++++++++
 ...Handle-gettext_printf-shell-function.patch | 46 ++++++++++++++++
 ...-Make-msgfmt-output-in-little-endian.patch | 34 ++++++++++++
 .../0004-Use-SHELL-rather-than-bin-sh.patch   | 26 +++++++++
 7 files changed, 186 insertions(+)
 create mode 100644 po/gettext-patches/0001-Support-POTFILES-shell.patch
 create mode 100644 po/gettext-patches/0002-Handle-gettext_printf-shell-function.patch
 create mode 100644 po/gettext-patches/0003-Make-msgfmt-output-in-little-endian.patch
 create mode 100644 po/gettext-patches/0004-Use-SHELL-rather-than-bin-sh.patch

diff --git a/bootstrap.conf b/bootstrap.conf
index 22b908f36..6d383240e 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -83,6 +83,14 @@ bootstrap_post_import_hook () {
     patch -d grub-core/lib/gnulib -p2 \
       < "grub-core/lib/gnulib-patches/$patchname.patch"
   done
+  for patchname in \
+      0001-Support-POTFILES-shell \
+      0002-Handle-gettext_printf-shell-function \
+      0003-Make-msgfmt-output-in-little-endian \
+      0004-Use-SHELL-rather-than-bin-sh; do
+    patch -d po -p3 \
+      < "po/gettext-patches/$patchname.patch"
+  done
   FROM_BOOTSTRAP=1 ./autogen.sh
   set +e  # bootstrap expects this
 }
diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist
index 32b217853..37dc3aa10 100644
--- a/conf/Makefile.extra-dist
+++ b/conf/Makefile.extra-dist
@@ -111,6 +111,21 @@ EXTRA_DIST += grub-core/osdep/windows/password.c
 EXTRA_DIST += grub-core/osdep/windows/random.c
 EXTRA_DIST += grub-core/osdep/windows/sleep.c
 
+EXTRA_DIST += po/gettext-patches/0001-Support-POTFILES-shell.patch
+EXTRA_DIST += po/gettext-patches/0002-Handle-gettext_printf-shell-function.patch
+EXTRA_DIST += po/gettext-patches/0003-Make-msgfmt-output-in-little-endian.patch
+EXTRA_DIST += po/gettext-patches/0004-Use-SHELL-rather-than-bin-sh.patch
+
+EXTRA_DIST += po/POTFILES-shell.in
+EXTRA_DIST += po/README
+EXTRA_DIST += po/Rules-translit
+EXTRA_DIST += po/Rules-windowsdir
+EXTRA_DIST += po/arabic.sed
+EXTRA_DIST += po/cyrillic.sed
+EXTRA_DIST += po/greek.sed
+EXTRA_DIST += po/grub.d.sed
+EXTRA_DIST += po/hebrew.sed
+
 EXTRA_DIST += tests/dfly-mbr-mbexample.mbr.img.gz
 EXTRA_DIST += tests/dfly-mbr-mbexample.dfly.img.gz
 
diff --git a/docs/grub-dev.texi b/docs/grub-dev.texi
index 837873094..24d17b8ec 100644
--- a/docs/grub-dev.texi
+++ b/docs/grub-dev.texi
@@ -547,6 +547,9 @@ AC_SYS_LARGEFILE
 
 @end example
 
+It will also be necessary to adjust the patches in
+@file{po/gettext-patches/} to apply to an older version of gettext.
+
 @node jsmn
 @section jsmn
 
diff --git a/po/gettext-patches/0001-Support-POTFILES-shell.patch b/po/gettext-patches/0001-Support-POTFILES-shell.patch
new file mode 100644
index 000000000..5a5d1ec00
--- /dev/null
+++ b/po/gettext-patches/0001-Support-POTFILES-shell.patch
@@ -0,0 +1,54 @@
+From d5bbd8f60aacb0f73ea5a0bde999152c467d0e78 Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Sun, 1 Mar 2020 11:57:58 +0000
+Subject: [PATCH 1/4] Support POTFILES-shell
+
+---
+ gettext-runtime/po/Makefile.in.in | 24 ++++++++++++++++++++++--
+ 1 file changed, 22 insertions(+), 2 deletions(-)
+
+diff --git a/gettext-runtime/po/Makefile.in.in b/gettext-runtime/po/Makefile.in.in
+index fabdc76c9..32e9323d3 100644
+--- a/gettext-runtime/po/Makefile.in.in
++++ b/gettext-runtime/po/Makefile.in.in
+@@ -142,7 +142,7 @@ stamp-po: $(srcdir)/$(DOMAIN).pot
+ # The determination of whether the package xyz is a GNU one is based on the
+ # heuristic whether some file in the top level directory mentions "GNU xyz".
+ # If GNU 'find' is available, we avoid grepping through monster files.
+-$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
++$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in $(srcdir)/POTFILES-shell.in remove-potcdate.sed
+ 	if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
+ 	       LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f -size -10000000c -exec grep 'GNU @PACKAGE@' /dev/null '{}' ';' 2>/dev/null; \
+ 	     else \
+@@ -175,7 +175,27 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
+ 	      --package-version='@VERSION@' \
+ 	      --msgid-bugs-address="$$msgid_bugs_address" \
+ 	    ;; \
+-	esac
++	esac; \
++	case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
++	  '' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
++	    $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
++	      --add-comments=TRANSLATORS: @XGETTEXT_EXTRA_OPTIONS@ \
++	      --files-from=$(srcdir)/POTFILES-shell.in \
++	      --copyright-holder='$(COPYRIGHT_HOLDER)' \
++	      --msgid-bugs-address="$$msgid_bugs_address" \
++	      --join-existing --language=Shell --keyword=gettext_quoted \
++	    ;; \
++	  *) \
++	    $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
++	      --add-comments=TRANSLATORS: @XGETTEXT_EXTRA_OPTIONS@ \
++	      --files-from=$(srcdir)/POTFILES-shell.in \
++	      --copyright-holder='$(COPYRIGHT_HOLDER)' \
++	      --package-name="$${package_gnu}@PACKAGE@" \
++	      --package-version='@VERSION@' \
++	      --msgid-bugs-address="$$msgid_bugs_address" \
++	      --join-existing --language=Shell --keyword=gettext_quoted \
++	    ;; \
++	esac; \
+ 	test ! -f $(DOMAIN).po || { \
+ 	  if test -f $(srcdir)/$(DOMAIN).pot; then \
+ 	    sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
+-- 
+2.17.1
+
diff --git a/po/gettext-patches/0002-Handle-gettext_printf-shell-function.patch b/po/gettext-patches/0002-Handle-gettext_printf-shell-function.patch
new file mode 100644
index 000000000..2767ed65e
--- /dev/null
+++ b/po/gettext-patches/0002-Handle-gettext_printf-shell-function.patch
@@ -0,0 +1,46 @@
+From fd17c51f2e6c87427679fbdfb5f6224ff48795db Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Sun, 1 Mar 2020 12:00:41 +0000
+Subject: [PATCH 2/4] Handle gettext_printf shell function
+
+Extract gettext_printf arguments.
+
+Run grub.d.sed over strings extracted from util/grub.d/, in order to set
+c-format flags (xgettext refuses to include these itself for strings it
+extracted from a shell file, but these really are c-format).
+---
+ gettext-runtime/po/Makefile.in.in | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/gettext-runtime/po/Makefile.in.in b/gettext-runtime/po/Makefile.in.in
+index 32e9323d3..32e0c99a2 100644
+--- a/gettext-runtime/po/Makefile.in.in
++++ b/gettext-runtime/po/Makefile.in.in
+@@ -183,7 +183,8 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in $(srcdir)/POTFILES-shell
+ 	      --files-from=$(srcdir)/POTFILES-shell.in \
+ 	      --copyright-holder='$(COPYRIGHT_HOLDER)' \
+ 	      --msgid-bugs-address="$$msgid_bugs_address" \
+-	      --join-existing --language=Shell --keyword=gettext_quoted \
++	      --join-existing --language=Shell \
++	      --keyword=gettext_quoted --keyword=gettext_printf \
+ 	    ;; \
+ 	  *) \
+ 	    $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
+@@ -193,10 +194,13 @@ $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in $(srcdir)/POTFILES-shell
+ 	      --package-name="$${package_gnu}@PACKAGE@" \
+ 	      --package-version='@VERSION@' \
+ 	      --msgid-bugs-address="$$msgid_bugs_address" \
+-	      --join-existing --language=Shell --keyword=gettext_quoted \
++	      --join-existing --language=Shell \
++	      --keyword=gettext_quoted --keyword=gettext_printf \
+ 	    ;; \
+ 	esac; \
+ 	test ! -f $(DOMAIN).po || { \
++	  sed -f grub.d.sed < $(DOMAIN).po > $(DOMAIN).1po && \
++	  mv $(DOMAIN).1po $(DOMAIN).po; \
+ 	  if test -f $(srcdir)/$(DOMAIN).pot; then \
+ 	    sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
+ 	    sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
+-- 
+2.17.1
+
diff --git a/po/gettext-patches/0003-Make-msgfmt-output-in-little-endian.patch b/po/gettext-patches/0003-Make-msgfmt-output-in-little-endian.patch
new file mode 100644
index 000000000..414161133
--- /dev/null
+++ b/po/gettext-patches/0003-Make-msgfmt-output-in-little-endian.patch
@@ -0,0 +1,34 @@
+From 156c523e2945c9b43c5500fb93988b0dd2f08d75 Mon Sep 17 00:00:00 2001
+From: Vladimir Serbinenko <phcoder@gmail.com>
+Date: Sun, 1 Mar 2020 12:09:25 +0000
+Subject: [PATCH 3/4] Make msgfmt output in little-endian
+
+GRUB expects this.
+---
+ gettext-runtime/po/Makefile.in.in | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/gettext-runtime/po/Makefile.in.in b/gettext-runtime/po/Makefile.in.in
+index 32e0c99a2..f3ef54c39 100644
+--- a/gettext-runtime/po/Makefile.in.in
++++ b/gettext-runtime/po/Makefile.in.in
+@@ -84,13 +84,13 @@ CATALOGS = @CATALOGS@
+ 
+ .po.mo:
+ 	@echo "$(MSGFMT) -c -o $@ $<"; \
+-	$(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
++	$(MSGFMT) --endianness=little -c -o t-$@ $< && mv t-$@ $@
+ 
+ .po.gmo:
+ 	@lang=`echo $* | sed -e 's,.*/,,'`; \
+ 	test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
+-	echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
+-	cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
++	echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) --endianness=little -c --statistics --verbose -o $${lang}.gmo $${lang}.po"; \
++	cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) --endianness=little -c --statistics --verbose -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
+ 
+ .sin.sed:
+ 	sed -e '/^#/d' $< > t-$@
+-- 
+2.17.1
+
diff --git a/po/gettext-patches/0004-Use-SHELL-rather-than-bin-sh.patch b/po/gettext-patches/0004-Use-SHELL-rather-than-bin-sh.patch
new file mode 100644
index 000000000..790521d3f
--- /dev/null
+++ b/po/gettext-patches/0004-Use-SHELL-rather-than-bin-sh.patch
@@ -0,0 +1,26 @@
+From f36f12e77798223ee7ee882c0d09e0e63db11454 Mon Sep 17 00:00:00 2001
+From: Colin Watson <cjwatson@debian.org>
+Date: Sun, 1 Mar 2020 12:14:07 +0000
+Subject: [PATCH 4/4] Use @SHELL rather than /bin/sh
+
+/bin/sh might not exist.
+---
+ gettext-runtime/po/Makefile.in.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/gettext-runtime/po/Makefile.in.in b/gettext-runtime/po/Makefile.in.in
+index f3ef54c39..285a55a9d 100644
+--- a/gettext-runtime/po/Makefile.in.in
++++ b/gettext-runtime/po/Makefile.in.in
+@@ -16,7 +16,7 @@ VERSION = @VERSION@
+ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+ 
+ SED = @SED@
+-SHELL = /bin/sh
++SHELL = @SHELL@
+ @SET_MAKE@
+ 
+ srcdir = @srcdir@
+-- 
+2.17.1
+
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Restore patches to po/Makefile.in.in
  2020-03-01 17:59 [PATCH] Restore patches to po/Makefile.in.in Colin Watson
@ 2020-03-03 13:53 ` Daniel Kiper
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Kiper @ 2020-03-03 13:53 UTC (permalink / raw)
  To: Colin Watson; +Cc: grub-devel

On Sun, Mar 01, 2020 at 05:59:04PM +0000, Colin Watson wrote:
> These were inadvertently lost during the conversion to Gnulib.  The
> files in po/gettext-patches/ can be imported using "git am" on top of
> the gettext tag corresponding to AM_GNU_GETTEXT_VERSION in configure.ac
> (currently 0.18.3).  They handle translation of messages in shell files,
> make msgfmt output in little-endian format, and arrange to use @SHELL@
> rather than /bin/sh.
>
> There were some changes solely for the purpose of distributing extra
> files; for ease of maintenance, I've added these to
> conf/Makefile.extra-dist instead.
>
> Fixes: https://savannah.gnu.org/bugs/?57298
> Signed-off-by: Colin Watson <cjwatson@ubuntu.com>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-03 13:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-01 17:59 [PATCH] Restore patches to po/Makefile.in.in Colin Watson
2020-03-03 13:53 ` Daniel Kiper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.