* [PATCH v4] cpupower: add checks for xgettext and msgfmt
@ 2024-10-18 4:52 Siddharth Menon
0 siblings, 0 replies; only message in thread
From: Siddharth Menon @ 2024-10-18 4:52 UTC (permalink / raw)
To: shuah, trenn, jwyatt, jkacur
Cc: Siddharth Menon, John B . Wyatt IV, Shuah Khan, linux-pm
Check whether xgettext and msgfmt are available on the system before
attempting to generate GNU gettext Language Translations.
In case of missing dependency, generate error message directing user
to install the necessary package.
Tested-by: John B. Wyatt IV <jwyatt@redhat.com>
Tested-by: John B. Wyatt IV <sageofredondo@gmail.com>
Suggested-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Siddharth Menon <simeddon@gmail.com>
---
v1->v2:
As suggested by Shuah:
- Checks for gettext tools outside the target definitions instead
of inline
- Replace command with which
v2->v3:
- Update commit message
- Removed the unwanted space under msgmerge introduced in v2
v3->v4:
- Added suggested-by and tested-by tags
- Updated changelog to be more descriptive
tools/power/cpupower/Makefile | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
index 6c02f401069e..84987f91d11f 100644
--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -218,17 +218,28 @@ else
endif
$(QUIET) $(STRIPCMD) $@
+ifeq (, $(shell which xgettext))
+$(warning "Install xgettext to extract translatable strings.")
+else
$(OUTPUT)po/$(PACKAGE).pot: $(UTIL_SRC)
$(ECHO) " GETTEXT " $@
$(QUIET) xgettext --default-domain=$(PACKAGE) --add-comments \
--keyword=_ --keyword=N_ $(UTIL_SRC) -p $(@D) -o $(@F)
+endif
+ifeq (, $(shell which msgfmt))
+$(warning "Install msgfmt to generate binary message catalogs.")
+else
$(OUTPUT)po/%.gmo: po/%.po
$(ECHO) " MSGFMT " $@
$(QUIET) msgfmt -o $@ po/$*.po
+endif
create-gmo: ${GMO_FILES}
+ifeq (, $(shell which msgmerge))
+$(warning "Install msgmerge to merge translations.")
+else
update-po: $(OUTPUT)po/$(PACKAGE).pot
$(ECHO) " MSGMRG " $@
$(QUIET) @for HLANG in $(LANGUAGES); do \
@@ -241,6 +252,7 @@ update-po: $(OUTPUT)po/$(PACKAGE).pot
rm -f $(OUTPUT)po/$$HLANG.new.po; \
fi; \
done;
+endif
compile-bench: $(OUTPUT)libcpupower.so.$(LIB_MAJ)
@V=$(V) confdir=$(confdir) $(MAKE) -C bench O=$(OUTPUT)
--
2.39.5
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2024-10-18 4:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-18 4:52 [PATCH v4] cpupower: add checks for xgettext and msgfmt Siddharth Menon
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.