bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] package: fix distcheck


From: Akim Demaille
Subject: [PATCH 3/3] package: fix distcheck
Date: Wed, 29 Apr 2020 08:01:07 +0200

Bison emits strings to translate in the generated code, for builtin
tokens.  So they appear only in generated parsers, which are not
shipped, so they are not in the src tree, so we cannot use them in our
POTFILE.

Except src/parse-gram.c, which is in the source tree.  And even in the
git repo.  But to avoid useless diffs in the repo, we do not keep the
src/parse-gram.c _with_ the #lines.  This is done in a dist-hook which
regenerates src/parse-gram.c when we run "make dist".

Unfortunately, then, update-po traverses the whole tree and sees that
the location of the strings to translate in src/parse-gram.c have
changed, so the bison.pot is to be updated.  And that is not possible
in the "make dist" which is run within "make distcheck"
(not the one preparing the dist for distcheck, the one run by
distcheck to check that a distributed tarball can build a tarball)
because then the src tree is read-only.

So let's not put src/parse-gram.c in the POTFILE, and expose these
strings to gettextize by hand.

* src/i18n-strings.c: New.
* po/POTFILES.in: Add it, and remove src/parse-gram.c.
---
 po/POTFILES.in     |  2 +-
 src/i18n-strings.c | 34 ++++++++++++++++++++++++++++++++++
 src/local.mk       |  1 +
 3 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 src/i18n-strings.c

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 1eca4cdd..4f256b2c 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -6,10 +6,10 @@ src/fixits.c
 src/getargs.c
 src/gram.c
 src/graphviz.c
+src/i18n-strings.c
 src/location.c
 src/main.c
 src/muscle-tab.c
-src/parse-gram.c
 src/parse-gram.y
 src/print-graph.c
 src/print.c
diff --git a/src/i18n-strings.c b/src/i18n-strings.c
new file mode 100644
index 00000000..ddf17063
--- /dev/null
+++ b/src/i18n-strings.c
@@ -0,0 +1,34 @@
+/* This file is not compiled in, it is used only to expose more
+   strings to gettextize.
+
+   Why is this needed?
+
+   Bison emits strings to translate in the generated code, for builtin
+   tokens.  So they appear only in generated parsers, which are not
+   shipped, so they are not in the src tree, so we cannot use them in
+   our POTFILE.
+
+   Except src/parse-gram.c, which is in the source tree.  And even in
+   the git repo.  But to avoid useless diffs in the repo, we do not
+   keep the #line directives in the src tree.  Yet, for the user, we
+   ship a src/parse-gram.c _with_ the #lines.  This is done in a
+   dist-hook which regenerates src/parse-gram.c when we run "make
+   dist".
+
+   Unfortunately, then, update-po traverses the whole tree and sees
+   that the location of the strings to translate in src/parse-gram.c
+   have changed, so the bison.pot is to be updated.  And that is not
+   possible in the "make dist" which is run within "make distcheck"
+   (not the one preparing the dist for distcheck, the one run by
+   distcheck to check that a distributed tarball can build a tarball)
+   because then the src tree is read-only.
+
+   So let's not put src/parse-gram.c in the POTFILE, and expose these
+   strings to gettextize by hand.
+  */
+
+static const char *const msgid[] =
+  {
+    N_("end of file"),
+    N_("invalid token")
+  }
diff --git a/src/local.mk b/src/local.mk
index 61dc5737..08737f88 100644
--- a/src/local.mk
+++ b/src/local.mk
@@ -130,6 +130,7 @@ src_bison_LDADD =                               \
   lib/libbison.a
 
 
+EXTRA_DIST += %D%/i18n-strings.c
 
 
 ## ------ ##
-- 
2.26.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]