Hi all, > Le 13 avr. 2019 à 15:28, Akim Demaille <[email protected]> a écrit : > > So far Bison is still hosting the translation of > gnulib's file, because I failed to have the gnulib-po module > work properly with Bison. > > Maybe I do something wrong, but after bootstrap, compile, install, > Bison is no longer internationalized: nothing is translated (not > gnulib's messages, nor Bison's ones).
I have found the problem: gnulib.mk contains AM_CPPFLAGS += -DDEFAULT_TEXT_DOMAIN=\"bison-gnulib\" and Bison's build system uses a single Makefile.in. As a consequence Bison's textdomain() call is useless, and translations are lost. Actually it seems that prefix-gnulib-mk has not been updated since quite a while, I spotted another issue that needed to be addressed. With the following commit, Bison happily works with gnulib's po, and translators' time will be saved! Cheers! commit 03dad082c4de5a7551374eeb8b58a69ab95f78a9 Author: Akim Demaille <[email protected]> Date: Sun Apr 21 18:17:14 2019 +0200 prefix-gnulib-mk: fix the support for gnulib-po * build-aux/prefix-gnulib-mk (prefix_assignment): Remove useless $res. Don't touch HAVE_* variables. Map AM_CPPFLAGS and AM_CPPFLAGS to the library's corresponding variables. diff --git a/ChangeLog b/ChangeLog index e87ff2389..2da5a7d59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2019-04-21 Akim Demaille <[email protected]> + + prefix-gnulib-mk: fix the support for gnulib-po + * build-aux/prefix-gnulib-mk (prefix_assignment): Remove useless $res. + Don't touch HAVE_* variables. + Map AM_CPPFLAGS and AM_CPPFLAGS to the library's corresponding variables. + 2019-03-22 Akim Demaille <[email protected]> _Noreturn: beware of C's _Noreturn in C++ pre C++11. diff --git a/build-aux/prefix-gnulib-mk b/build-aux/prefix-gnulib-mk index 544654f74..706b077b8 100755 --- a/build-aux/prefix-gnulib-mk +++ b/build-aux/prefix-gnulib-mk @@ -87,7 +87,6 @@ sub prefix_words ($) sub prefix_assignment ($$) { my ($lhs_and_assign_op, $rhs) = @_; - my $res; # Some variables are initialized by gnulib.mk, and we don't want # that. Change '=' to '+='. @@ -95,21 +94,35 @@ sub prefix_assignment ($$) { # Do not change the RHS, which specifies the GPERF program. } + # Don't change variables such as HAVE_INCLUDE_NEXT. + elsif ($lhs_and_assign_op =~ /^HAVE_/) + { + } elsif ($lhs_and_assign_op =~ /^(SUBDIRS|EXTRA_DIST|BUILT_SOURCES|SUFFIXES|MOSTLYCLEANFILES - |CLEANFILES|DISTCLEANFILES|MAINTAINERCLEANFILES|AM_CFLAGS - |AM_CPPFLAGS|AM_GNU_GETTEXT)\ =/x) + |CLEANFILES|DISTCLEANFILES|MAINTAINERCLEANFILES + |AM_GNU_GETTEXT)\ =/x) { $lhs_and_assign_op =~ s/=/+=/; } + # We don't want things such as AM_CPPFLAGS += + # -DDEFAULT_TEXT_DOMAIN=\"bison-gnulib\" to apply to the whole + # Makefile.in: scope it to the library: libbison_a_CPPFLAGS = + # $(AM_CPPFLAGS) -DDEFAULT_TEXT_DOMAIN=\"bison-gnulib\". + elsif ($lhs_and_assign_op =~ + /^(AM_CFLAGS|AM_CPPFLAGS)\ \+?=/x) + { + $lhs_and_assign_op =~ s/^AM_(\w+)\ \+?=/${lib_name}_$1 =/; + $rhs = " \$(AM_$1)$rhs"; + } # We don't want to inherit gnulib's AUTOMAKE_OPTIONS, comment them. elsif ($lhs_and_assign_op =~ /^AUTOMAKE_OPTIONS =/) { $lhs_and_assign_op =~ s/^/# /; } + # Elide any SUFFIXES assignment or concatenation. elsif ($lhs_and_assign_op =~ /^SUFFIXES /) { - # Elide any SUFFIXES assignment or concatenation. $lhs_and_assign_op =~ s/^/# /; } # The words are (probably) paths to files in lib/: prefix them. @@ -118,11 +131,11 @@ sub prefix_assignment ($$) $rhs = prefix_words($rhs) } - # Variables which name depend on the location: libbison_a_SOURCES => + # Variables whose name depend on the location: libbison_a_SOURCES => # lib_libbison_a_SOURCES. $lhs_and_assign_op =~ s/($lib_name)/lib_$1/g; - return $lhs_and_assign_op . $rhs; + $lhs_and_assign_op . $rhs; } # prefix $CONTENTS
