git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] gitk: Fallback to po2msg if msgfmt is not available

From
Shawn O. Pearce <spearce@spearce.org>
Date
Mar 5, 2008, 07:17 UTC
Message-ID
<20080305071738.GA23079@spearce.org>

If msgfmt is not in our PATH, or it is but it does not seem to honor the --tcl command line option then we need to fallback to po2msg. This is rather common on Mac OS X systems, but also can show up on a Linux OS if GNU gettext is not installed on the system.

This particular block of code was copied from git-gui's Makefile, where we have already (reasonably) vetted this fallback system.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 Makefile |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index ae2b80b..49a9209 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,14 @@ ifdef NO_MSGFMT
 	MSGFMT ?= $(TCL_PATH) po/po2msg.sh
 else
 	MSGFMT ?= msgfmt
+	ifeq ($(shell $(MSGFMT) >/dev/null 2>&1 || echo $$?),127)
+		MSGFMT := $(TCL_PATH) po/po2msg.sh
+	endif
+	ifeq (msgfmt,$(MSGFMT))
+	ifeq ($(shell $(MSGFMT) --tcl -l C -d . /dev/null 2>/dev/null || echo $?),1)
+		MSGFMT := $(TCL_PATH) po/po2msg.sh
+	endif
+	endif
 endif
 
 PO_TEMPLATE = po/gitk.pot
-- 
1.5.4.3.529.gb25fb
Message 1 of 1 in “gitk: Fallback to po2msg if msgfmt is not available”
  1. gitk: Fallback to po2msg if msgfmt is not availableShawn O. Pearce, Mar 5, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.