{"thread":{"id":"56428","subject":"[PATCH] makefile: teach git about NO_MSGFMT (as supported in GUI and gitk)","startedAt":"2021-09-02T08:55:16Z","lastAt":"2021-09-03T02:33:09Z","messageCount":6,"participants":["Carlo Marcelo Arenas Belón","Ævar Arnfjörð Bjarmason","Johannes Schindelin","Carlo Arenas"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"434494","messageId":"20210902085438.54121-1-carenas@gmail.com","threadId":"56428","inReplyTo":null,"subject":"[PATCH] makefile: teach git about NO_MSGFMT (as supported in GUI and gitk)","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2021-09-02T08:54:38Z","receivedAt":"2021-09-02T08:55:16Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"NO_MSGFMT can be used to indicate there is no msgfmt available, so\nmake git recognize that and avoid failing to build while trying to\ngenerate i18n files.\n\nwhile at it, refactor the change introduced in 4348824059\n(artifacts-tar: respect NO_GETTEXT, 2021-07-04) with something as\nfunctional but shorter.\n\nSigned-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n---\n Makefile | 9 +++++----\n 1 file changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 9573190f1d..9f09a75801 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -86,6 +86,8 @@ all::\n # Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't\n # need -lintl when linking.\n #\n+# Define NO_MSGFMT if you don't have msgfmt\n+#\n # Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt\n # doesn't support GNU extensions like --check and --statistics\n #\n@@ -2691,10 +2693,8 @@ po/git.pot: $(GENERATED_H) FORCE\n .PHONY: pot\n pot: po/git.pot\n \n-ifdef NO_GETTEXT\n-POFILES :=\n-MOFILES :=\n-else\n+ifndef NO_MSGFMT\n+ifndef NO_GETTEXT\n POFILES := $(wildcard po/*.po)\n MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))\n \n@@ -2703,6 +2703,7 @@ endif\n \n po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n+endif\n \n LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n-- \n2.33.0.481.g26d3bed244\n\n"},{"id":"434511","messageId":"87ilzjuv2t.fsf@evledraar.gmail.com","threadId":"56428","inReplyTo":"20210902085438.54121-1-carenas@gmail.com","subject":"Re: [PATCH] makefile: teach git about NO_MSGFMT (as supported in GUI and gitk)","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-02T10:27:56Z","receivedAt":"2021-09-02T10:32:21Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Sep 02 2021, Carlo Marcelo Arenas Belón wrote:\n\n> NO_MSGFMT can be used to indicate there is no msgfmt available, so\n> make git recognize that and avoid failing to build while trying to\n> generate i18n files.\n\nWhy would we want to avoid failing the build if we don't have msgfmt?\n\nI understand why you'd want NO_GETTEXT in that case, but what's the\npoint of building with NO_GETTEXT= NO_MSGFMT=Y?\n\nIf we can't build the *.mo files we'll have a completely broken\ninstallation that can't do anything useful with gettext, so why not just\nbuild without gettext at that point?\n\nWhen this patch is applied a lot of things related to gettext in our\ntests fail if you build with NO_GETTEXT= NO_MSGFMT=Y, because those\nthings are assuming that if NO_GETTEXT isn't defined we'll have the *.mo\nfiles, po/build etc.\n\n> while at it, refactor the change introduced in 4348824059\n> (artifacts-tar: respect NO_GETTEXT, 2021-07-04) with something as\n> functional but shorter.\n>\n> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n> ---\n>  Makefile | 9 +++++----\n>  1 file changed, 5 insertions(+), 4 deletions(-)\n>\n> diff --git a/Makefile b/Makefile\n> index 9573190f1d..9f09a75801 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -86,6 +86,8 @@ all::\n>  # Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't\n>  # need -lintl when linking.\n>  #\n> +# Define NO_MSGFMT if you don't have msgfmt\n> +#\n>  # Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt\n>  # doesn't support GNU extensions like --check and --statistics\n>  #\n> @@ -2691,10 +2693,8 @@ po/git.pot: $(GENERATED_H) FORCE\n>  .PHONY: pot\n>  pot: po/git.pot\n>  \n> -ifdef NO_GETTEXT\n> -POFILES :=\n> -MOFILES :=\n> -else\n> +ifndef NO_MSGFMT\n> +ifndef NO_GETTEXT\n>  POFILES := $(wildcard po/*.po)\n>  MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))\n>  \n> @@ -2703,6 +2703,7 @@ endif\n>  \n>  po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n>  \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n> +endif\n>  \n>  LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n>  LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n\n"},{"id":"434512","messageId":"87fsunuulu.fsf@evledraar.gmail.com","threadId":"56428","inReplyTo":"87ilzjuv2t.fsf@evledraar.gmail.com","subject":"Re: [PATCH] makefile: teach git about NO_MSGFMT (as supported in GUI and gitk)","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-09-02T10:38:52Z","receivedAt":"2021-09-02T10:42:30Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Sep 02 2021, Ævar Arnfjörð Bjarmason wrote:\n\n> On Thu, Sep 02 2021, Carlo Marcelo Arenas Belón wrote:\n>\n>> NO_MSGFMT can be used to indicate there is no msgfmt available, so\n>> make git recognize that and avoid failing to build while trying to\n>> generate i18n files.\n>\n> Why would we want to avoid failing the build if we don't have msgfmt?\n>\n> I understand why you'd want NO_GETTEXT in that case, but what's the\n> point of building with NO_GETTEXT= NO_MSGFMT=Y?\n>\n> If we can't build the *.mo files we'll have a completely broken\n> installation that can't do anything useful with gettext, so why not just\n> build without gettext at that point?\n>\n> When this patch is applied a lot of things related to gettext in our\n> tests fail if you build with NO_GETTEXT= NO_MSGFMT=Y, because those\n> things are assuming that if NO_GETTEXT isn't defined we'll have the *.mo\n> files, po/build etc.\n\nSome further digging reveals that we've got in-tree git-gui/po/po2msg.sh\nand gitk-git/po/po2msg.sh (copy/pasted, but slightly different) that\nsupports some subset of \"msgfmt --tcl\".\n\nI.e. those programs with NO_MSGFMT still ends up with locae files they\ncan use, whereas in this patch we don't end up with anything at all...\n"},{"id":"434575","messageId":"nycvar.QRO.7.76.6.2109021730040.55@tvgsbejvaqbjf.bet","threadId":"56428","inReplyTo":"20210902085438.54121-1-carenas@gmail.com","subject":"Re: [PATCH] makefile: teach git about NO_MSGFMT (as supported in GUI and gitk)","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2021-09-02T15:32:40Z","receivedAt":"2021-09-02T15:32:39Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Carlo,\n\nOn Thu, 2 Sep 2021, Carlo Marcelo Arenas Belón wrote:\n\n> NO_MSGFMT can be used to indicate there is no msgfmt available, so\n> make git recognize that and avoid failing to build while trying to\n> generate i18n files.\n>\n> while at it, refactor the change introduced in 4348824059\n> (artifacts-tar: respect NO_GETTEXT, 2021-07-04) with something as\n> functional but shorter.\n\nTo me, this commit message is not really related to the diff, which\nessentially only adds a code comment and then has the only functional\nchange that _prevents_ `POFILES` and `MOFILES` from being set to empty\nvalues when `NO_MSGFMT` is set.\n\nI am therefore quite puzzled how that diff is supposed to achieve anything\nthat is described in the commit message (how does this \"make git recognize\nthat\"?).\n\nCould you maybe clarify that?\n\nThanks,\nDscho\n\n>\n> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n> ---\n>  Makefile | 9 +++++----\n>  1 file changed, 5 insertions(+), 4 deletions(-)\n>\n> diff --git a/Makefile b/Makefile\n> index 9573190f1d..9f09a75801 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -86,6 +86,8 @@ all::\n>  # Define LIBC_CONTAINS_LIBINTL if your gettext implementation doesn't\n>  # need -lintl when linking.\n>  #\n> +# Define NO_MSGFMT if you don't have msgfmt\n> +#\n>  # Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt\n>  # doesn't support GNU extensions like --check and --statistics\n>  #\n> @@ -2691,10 +2693,8 @@ po/git.pot: $(GENERATED_H) FORCE\n>  .PHONY: pot\n>  pot: po/git.pot\n>\n> -ifdef NO_GETTEXT\n> -POFILES :=\n> -MOFILES :=\n> -else\n> +ifndef NO_MSGFMT\n> +ifndef NO_GETTEXT\n>  POFILES := $(wildcard po/*.po)\n>  MOFILES := $(patsubst po/%.po,po/build/locale/%/LC_MESSAGES/git.mo,$(POFILES))\n>\n> @@ -2703,6 +2703,7 @@ endif\n>\n>  po/build/locale/%/LC_MESSAGES/git.mo: po/%.po\n>  \t$(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $<\n> +endif\n>\n>  LIB_PERL := $(wildcard perl/Git.pm perl/Git/*.pm perl/Git/*/*.pm perl/Git/*/*/*.pm)\n>  LIB_PERL_GEN := $(patsubst perl/%.pm,perl/build/lib/%.pm,$(LIB_PERL))\n> --\n> 2.33.0.481.g26d3bed244\n>\n>\n"},{"id":"434616","messageId":"CAPUEspj8gwpBNZRqJWgoUG8ouxnMd=SMtoH=z+8AR12+f+j5_g@mail.gmail.com","threadId":"56428","inReplyTo":"nycvar.QRO.7.76.6.2109021730040.55@tvgsbejvaqbjf.bet","subject":"Re: [PATCH] makefile: teach git about NO_MSGFMT (as supported in GUI and gitk)","fromName":"Carlo Arenas","fromEmail":"carenas@gmail.com","sentAt":"2021-09-03T01:54:25Z","receivedAt":"2021-09-03T01:54:38Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"On Thu, Sep 2, 2021 at 8:32 AM Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> On Thu, 2 Sep 2021, Carlo Marcelo Arenas Belón wrote:\n>\n> > NO_MSGFMT can be used to indicate there is no msgfmt available, so\n> > make git recognize that and avoid failing to build while trying to\n> > generate i18n files.\n> >\n> > while at it, refactor the change introduced in 4348824059\n> > (artifacts-tar: respect NO_GETTEXT, 2021-07-04) with something as\n> > functional but shorter.\n>\n> To me, this commit message is not really related to the diff, which\n> essentially only adds a code comment and then has the only functional\n> change that _prevents_ `POFILES` and `MOFILES` from being set to empty\n> values when `NO_MSGFMT` is set.\n\ncorrect, except that they should be empty already since nothing has\nset them and therefore the end result is the same.\nI should have mentioned I tracked back the conversation for this and\neven the github issue about it (that I can't find anymore) to make\nsure it wouldn't introduce a regression.\n\n< I am therefore quite puzzled how that diff is supposed to achieve anything\n> that is described in the commit message (how does this \"make git recognize\n> that\"?).\n\nIt does not, which is on the (on an unrelated but touching the same\nlines issue), which I am starting to suspect I shouldn't use anymore;\napologies for the noise.\n\nCarlo\n"},{"id":"434618","messageId":"CAPUEspi28JrPUa4jTACzuuco4mmMmDxjzTbCz5wigHORXQBUXw@mail.gmail.com","threadId":"56428","inReplyTo":"87fsunuulu.fsf@evledraar.gmail.com","subject":"Re: [PATCH] makefile: teach git about NO_MSGFMT (as supported in GUI and gitk)","fromName":"Carlo Arenas","fromEmail":"carenas@gmail.com","sentAt":"2021-09-03T02:32:56Z","receivedAt":"2021-09-03T02:33:09Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"OnThu, Sep 2, 2021 at 3:42 AM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n> On Thu, Sep 02 2021, Ævar Arnfjörð Bjarmason wrote:\n> > On Thu, Sep 02 2021, Carlo Marcelo Arenas Belón wrote:\n> >> NO_MSGFMT can be used to indicate there is no msgfmt available, so\n> >> make git recognize that and avoid failing to build while trying to\n> >> generate i18n files.\n> >\n> > Why would we want to avoid failing the build if we don't have msgfmt?\n\nOK, I have to admit, this is mainly because gettext and msgfmt come\nfrom different packages in OpenBSD, and I keep forgetting to install\nthe latter.\nIt makes sense too, if you only care about a quick build and your\nbinary won't use the message files (ex: a git part of a build\ncontainer or a portable minimal package); you are correct I usually do\nNO_GETTEXT=1 as well in that case, which is why I didn't saw the tests\nbreaking.\n\n> > I understand why you'd want NO_GETTEXT in that case, but what's the\n> > point of building with NO_GETTEXT= NO_MSGFMT=Y?\n\nI think they are conceptually different, one instructs the build\nsystem that we want to build international support in the binary,\nwhile the other only says \"I have this tool and want the catalogs\ngenerated with it\"\n\n> > If we can't build the *.mo files we'll have a completely broken\n> > installation that can't do anything useful with gettext, so why not just\n> > build without gettext at that point?\n\nthe gettext() calls fail cleanly if there are no catalogs to use, so I\nwouldn't agree it is broken\nand more importantly, will start using them if they are provided and\nthe binary is pointed to them, they don't need to be freshly generated\nor even match the version of the binary they are queried from.\n\n> > When this patch is applied a lot of things related to gettext in our\n> > tests fail if you build with NO_GETTEXT= NO_MSGFMT=Y, because those\n> > things are assuming that if NO_GETTEXT isn't defined we'll have the *.mo\n> > files, po/build etc.\n\napologies, thanks for checking, that was sloppy of me.\n\n> Some further digging reveals that we've got in-tree git-gui/po/po2msg.sh\n> and gitk-git/po/po2msg.sh (copy/pasted, but slightly different) that\n> supports some subset of \"msgfmt --tcl\".\n>\n> I.e. those programs with NO_MSGFMT still end up with locale files they\n> can use, whereas in this patch we don't end up with anything at all...\n\nI have to admit I found odd we had those as I was expecting they\nshould behave like git in this case and don't generate any mo files.\n\nFWIW Git for Windows seems to go to great extents to NOT include those\nin the release.\n\nCarlo\n"}]}