Skip to content

Commit 47d7650

Browse files
BiscuitBobbyshuahkh
authored andcommitted
cpupower: add checks for xgettext and msgfmt
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> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent b78abc2 commit 47d7650

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tools/power/cpupower/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,17 +218,28 @@ else
218218
endif
219219
$(QUIET) $(STRIPCMD) $@
220220

221+
ifeq (, $(shell which xgettext))
222+
$(warning "Install xgettext to extract translatable strings.")
223+
else
221224
$(OUTPUT)po/$(PACKAGE).pot: $(UTIL_SRC)
222225
$(ECHO) " GETTEXT " $@
223226
$(QUIET) xgettext --default-domain=$(PACKAGE) --add-comments \
224227
--keyword=_ --keyword=N_ $(UTIL_SRC) -p $(@D) -o $(@F)
228+
endif
225229

230+
ifeq (, $(shell which msgfmt))
231+
$(warning "Install msgfmt to generate binary message catalogs.")
232+
else
226233
$(OUTPUT)po/%.gmo: po/%.po
227234
$(ECHO) " MSGFMT " $@
228235
$(QUIET) msgfmt -o $@ po/$*.po
236+
endif
229237

230238
create-gmo: ${GMO_FILES}
231239

240+
ifeq (, $(shell which msgmerge))
241+
$(warning "Install msgmerge to merge translations.")
242+
else
232243
update-po: $(OUTPUT)po/$(PACKAGE).pot
233244
$(ECHO) " MSGMRG " $@
234245
$(QUIET) @for HLANG in $(LANGUAGES); do \
@@ -241,6 +252,7 @@ update-po: $(OUTPUT)po/$(PACKAGE).pot
241252
rm -f $(OUTPUT)po/$$HLANG.new.po; \
242253
fi; \
243254
done;
255+
endif
244256

245257
compile-bench: $(OUTPUT)libcpupower.so.$(LIB_MAJ)
246258
@V=$(V) confdir=$(confdir) $(MAKE) -C bench O=$(OUTPUT)

0 commit comments

Comments
 (0)