selinux/policycoreutils/po/Makefile
Jason Zaman 584e32a23b policycoreutils: honour LINGUAS variable
If the user has the $LINGUAS environment variable set, only translations
for those languages should be installed to the system.

The gettext manual [1] says:

"Internationalized packages have usually many ll.po files. Unless
translations are disabled, all those available are installed together
with the package. However, the environment variable LINGUAS may be set,
prior to configuration, to limit the installed set. LINGUAS should then
contain a space separated list of two-letter codes, stating which
languages are allowed."

[1]: https://www.gnu.org/software/gettext/manual/html_node/Installers.html#Installers

Signed-off-by: Jason Zaman <jason@perfinion.com>
2017-04-25 08:12:18 -04:00

146 lines
3.9 KiB
Makefile

#
# Makefile for the PO files (translation) catalog
#
TOP = ../..
# What is this package?
NLSPACKAGE = policycoreutils
POTFILE = $(NLSPACKAGE).pot
INSTALL = /usr/bin/install -c -p
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_DIR = /usr/bin/install -d
# destination directory
INSTALL_NLS_DIR = $(DESTDIR)/usr/share/locale
# PO catalog handling
MSGMERGE = msgmerge
MSGMERGE_FLAGS = -q
XGETTEXT = xgettext --default-domain=$(NLSPACKAGE)
MSGFMT = msgfmt
# All possible linguas
PO_LINGUAS := $(sort $(patsubst %.po,%,$(wildcard *.po)))
# Only the files matching what the user has set in LINGUAS
USER_LINGUAS := $(filter $(patsubst %,%%,$(LINGUAS)),$(PO_LINGUAS))
# if no valid LINGUAS, build all languages
USE_LINGUAS := $(if $(USER_LINGUAS),$(USER_LINGUAS),$(PO_LINGUAS))
POFILES = $(patsubst %,%.po,$(USE_LINGUAS))
MOFILES = $(patsubst %.po,%.mo,$(POFILES))
POTFILES = \
../run_init/open_init_pty.c \
../run_init/run_init.c \
../semodule_link/semodule_link.c \
../audit2allow/audit2allow \
../semanage/seobject.py \
../setsebool/setsebool.c \
../newrole/newrole.c \
../load_policy/load_policy.c \
../sestatus/sestatus.c \
../semodule/semodule.c \
../setfiles/setfiles.c \
../semodule_package/semodule_package.c \
../semodule_deps/semodule_deps.c \
../semodule_expand/semodule_expand.c \
../scripts/chcat \
../scripts/fixfiles \
../restorecond/stringslist.c \
../restorecond/restorecond.h \
../restorecond/utmpwatcher.h \
../restorecond/stringslist.h \
../restorecond/restorecond.c \
../restorecond/utmpwatcher.c \
../gui/booleansPage.py \
../gui/fcontextPage.py \
../gui/loginsPage.py \
../gui/mappingsPage.py \
../gui/modulesPage.py \
../gui/polgen.glade \
../gui/polgengui.py \
../gui/portsPage.py \
../gui/semanagePage.py \
../gui/statusPage.py \
../gui/system-config-selinux.glade \
../gui/system-config-selinux.py \
../gui/usersPage.py \
../secon/secon.c \
booleans.py \
../sepolicy/sepolicy.py \
../sepolicy/sepolicy/communicate.py \
../sepolicy/sepolicy/__init__.py \
../sepolicy/sepolicy/network.py \
../sepolicy/sepolicy/generate.py \
../sepolicy/sepolicy/sepolicy.glade \
../sepolicy/sepolicy/gui.py \
../sepolicy/sepolicy/manpage.py \
../sepolicy/sepolicy/transition.py \
../sepolicy/sepolicy/templates/executable.py \
../sepolicy/sepolicy/templates/__init__.py \
../sepolicy/sepolicy/templates/network.py \
../sepolicy/sepolicy/templates/rw.py \
../sepolicy/sepolicy/templates/script.py \
../sepolicy/sepolicy/templates/semodule.py \
../sepolicy/sepolicy/templates/tmp.py \
../sepolicy/sepolicy/templates/user.py \
../sepolicy/sepolicy/templates/var_lib.py \
../sepolicy/sepolicy/templates/var_log.py \
../sepolicy/sepolicy/templates/var_run.py \
../sepolicy/sepolicy/templates/var_spool.py
#default:: clean
all:: $(MOFILES)
booleans.py:
sepolicy booleans -a > booleans.py
$(POTFILE): $(POTFILES) booleans.py
$(XGETTEXT) --keyword=_ --keyword=N_ $(POTFILES)
@if cmp -s $(NLSPACKAGE).po $(POTFILE); then \
rm -f $(NLSPACKAGE).po; \
else \
mv -f $(NLSPACKAGE).po $(POTFILE); \
fi; \
update-po: Makefile $(POTFILE) refresh-po
@rm -f booleans.py
refresh-po: Makefile
for cat in $(POFILES); do \
lang=`basename $$cat .po`; \
if $(MSGMERGE) $(MSGMERGE_FLAGS) $$lang.po $(POTFILE) > $$lang.pot ; then \
mv -f $$lang.pot $$lang.po ; \
echo "$(MSGMERGE) of $$lang succeeded" ; \
else \
echo "$(MSGMERGE) of $$lang failed" ; \
rm -f $$lang.pot ; \
fi \
done
clean:
@rm -fv *mo *~ .depend
@rm -rf tmp
install: $(MOFILES)
@for n in $(MOFILES); do \
l=`basename $$n .mo`; \
$(INSTALL_DIR) $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES; \
$(INSTALL_DATA) --verbose $$n $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES/$(NLSPACKAGE).mo; \
done
%.mo: %.po
$(MSGFMT) -o $@ $<
report:
@for cat in $(wildcard *.po); do \
echo -n "$$cat: "; \
msgfmt -v --statistics -o /dev/null $$cat; \
done
.PHONY: missing depend
relabel: