All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpupower: add checks for xgettext and msgfmt
@ 2024-10-15 16:38 Siddharth Menon
  2024-10-15 17:49 ` John B. Wyatt IV
  0 siblings, 1 reply; 4+ messages in thread
From: Siddharth Menon @ 2024-10-15 16:38 UTC (permalink / raw)
  To: shuah, trenn, jwyatt, jkacur; +Cc: Siddharth Menon, linux-pm

Check whether xgettext and msgfmt are available on the system before
attempting to generate the .pot and .gmo files and generate.
In case of missing dependency, generate error message directing user
to install the necessary package.

Signed-off-by: Siddharth Menon <simeddon@gmail.com>
---
 tools/power/cpupower/Makefile | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
index 6c02f401069e..38e7daacecf4 100644
--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -220,12 +220,20 @@ endif
 
 $(OUTPUT)po/$(PACKAGE).pot: $(UTIL_SRC)
 	$(ECHO) "  GETTEXT " $@
-	$(QUIET) xgettext --default-domain=$(PACKAGE) --add-comments \
-		--keyword=_ --keyword=N_ $(UTIL_SRC) -p $(@D) -o $(@F)
+	$(QUIET) if ! command -v xgettext > /dev/null; then \
+		echo "Error: gettext not found. Please install gettext."; \
+	else \
+		xgettext --default-domain=$(PACKAGE) --add-comments \
+		--keyword=_ --keyword=N_ $(UTIL_SRC) -p $(@D) -o $(@F); \
+	fi
 
 $(OUTPUT)po/%.gmo: po/%.po
 	$(ECHO) "  MSGFMT  " $@
-	$(QUIET) msgfmt -o $@ po/$*.po
+	$(QUIET) if ! command -v msgfmt > /dev/null; then \
+		echo "Error: msgfmt not found. Make sure gettext is set up correctly."; \
+	else \
+		msgfmt -o $@ po/$*.po; \
+	fi
 
 create-gmo: ${GMO_FILES}
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-15 22:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15 16:38 [PATCH] cpupower: add checks for xgettext and msgfmt Siddharth Menon
2024-10-15 17:49 ` John B. Wyatt IV
2024-10-15 21:55   ` Sid
2024-10-15 22:16     ` Shuah Khan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.