Hi,
On Sun, 20 Jan 2008, Shawn O. Pearce wrote:
Johannes Schindelin [off-list ref] wrote:
quoted
[PATCH] Fall back to po2msg when msgfmt is unavailable
diff --git a/git-gui/Makefile b/git-gui/Makefile
index c109eab..c7921e7 100644
--- a/git-gui/Makefile
+++ b/git-gui/Makefile
@@ -210,7 +211,8 @@ $(PO_TEMPLATE): $(SCRIPT_SH) $(ALL_LIBFILES)
update-po:: $(PO_TEMPLATE)
$(foreach p, $(ALL_POFILES), echo Updating $p ; msgmerge -U $p $(PO_TEMPLATE) ; )
$(ALL_MSGFILES): %.msg : %.po
- $(QUIET_MSGFMT0)$(MSGFMT) --statistics --tcl -l $(basename $(notdir $<)) -d $(dir $@) $< $(QUIET_MSGFMT1)
+ $(QUIET_MSGFMT0)$(MSGFMT) --statistics --tcl -l $(basename $(notdir $<)) -d $(dir $@) $< $(QUIET_MSGFMT1) || \
+ $(QUIET_MSGFMT0)$(PO2MSG) --statistics --tcl -l $(basename $(notdir $<)) -d $(dir $@) $< $(QUIET_MSGFMT1)
That will cause the QUIET_MSGFMT0 script to echo twice; once when we try
to run msgfmt and again when we fallback to po2msg.
That messes with the user's display and won't look very nice coming out
of a supposedly quiet make.
In other words this is probably better:
+ $(QUIET_MSGFMT0)($(MSGFMT) --statistics --tcl -l $(basename $(notdir $<)) -d $(dir $@) $< || \
+ $(PO2MSG) --statistics --tcl -l $(basename $(notdir $<)) -d $(dir $@) $< )$(QUIET_MSGFMT1)
But it is a lot uglier to read, and I tend to not like subshells.
It was exactly this ugliness which made me not do it.
Note: There might be yet a better way. Instead of trying each and every
time, we could detect the presence of msgfmt with something like this:
+ifeq $(shell msgfmt2 2>/dev/null >/dev/null; echo $?) = 127
+ MSGFMT = $(TCL_PATH) po/po2msg.sh
+endif
This is not tested, yet, tough,
Ciao,
Dscho