po: generate files into build directory

Historically we did not support VPATH builds and everything was
generated into source directory.  The introduction of VPATH builds
did not changed the way how our translation files are handled.

This patch changes the rules to generate everything into build
directory and stops distributing generated files in order to have
properly separated VPATH builds.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Pavel Hrdina 2019-10-23 21:56:50 +02:00
parent f4fd068c4e
commit 8c9ca8a284
2 changed files with 19 additions and 16 deletions

4
.gitignore vendored
View File

@ -39,12 +39,8 @@ Makefile.in
.git-module-status .git-module-status
# libvirt related ignores # libvirt related ignores
!/po/*.mini.po
/build/ /build/
/ci/scratch/ /ci/scratch/
/po/*gmo
/po/*po
/po/*pot
/src/access/org.libvirt.api.policy /src/access/org.libvirt.api.policy
/src/access/viraccessapicheck.c /src/access/viraccessapicheck.c
/src/access/viraccessapicheck.h /src/access/viraccessapicheck.h

View File

@ -16,17 +16,16 @@ LANGS := \
POTFILE_DEPS := $(shell $(SED) 's,^,$(top_srcdir)/,' $(srcdir)/POTFILES) POTFILE_DEPS := $(shell $(SED) 's,^,$(top_srcdir)/,' $(srcdir)/POTFILES)
POTFILE := $(srcdir)/$(DOMAIN).pot POTFILE := $(DOMAIN).pot
POFILES := $(LANGS:%=$(srcdir)/%.po) POMINIFILES := $(LANGS:%=%.mini.po)
GMOFILES := $(LANGS:%=$(srcdir)/%.gmo) POFILES := $(LANGS:%=%.po)
GMOFILES := $(LANGS:%=%.gmo)
MAINTAINERCLEANFILES = $(POTFILE) $(POFILES) $(GMOFILES) CLEANFILES = $(POTFILE) $(POFILES) $(GMOFILES)
EXTRA_DIST = \ EXTRA_DIST = \
POTFILES \ POTFILES \
$(POTFILE) \ $(POMINIFILES)
$(POFILES) \
$(GMOFILES)
if HAVE_GNU_GETTEXT_TOOLS if HAVE_GNU_GETTEXT_TOOLS
@ -63,10 +62,18 @@ update-mini-po: $(POTFILE)
done done
push-pot: $(POTFILE) push-pot: $(POTFILE)
zanata push --push-type=source zanata push \
--project-config $(srcdir)/zanata.xml \
--push-type=source \
--transdir $(builddir) \
--srcdir $(srcdir)
pull-po: $(POTFILE) pull-po: $(POTFILE)
zanata pull --create-skeletons zanata pull \
--project-config $(srcdir)/zanata.xml \
--create-skeletons \
--transdir $(builddir) \
--srcdir $(srcdir)
$(MAKE) update-mini-po $(MAKE) update-mini-po
$(MAKE) update-gmo $(MAKE) update-gmo
@ -76,11 +83,11 @@ $(POTFILE): POTFILES $(POTFILE_DEPS)
$(SED) $(SED_PO_FIXUP_ARGS) < $@-t > $@ $(SED) $(SED_PO_FIXUP_ARGS) < $@-t > $@
rm -f $@-t rm -f $@-t
$(srcdir)/%.po: $(srcdir)/%.mini.po $(POTFILE) %.po: %.mini.po $(POTFILE)
$(MSGMERGE) --no-fuzzy-matching $< $(POTFILE) | \ $(MSGMERGE) --no-fuzzy-matching $< $(POTFILE) | \
$(SED) $(SED_PO_FIXUP_ARGS) > $@ $(SED) $(SED_PO_FIXUP_ARGS) > $@
$(srcdir)/%.gmo: $(srcdir)/%.po %.gmo: %.po
rm -f $@ $@-t rm -f $@ $@-t
$(MSGFMT) -c -o $@-t $< $(MSGFMT) -c -o $@-t $<
mv $@-t $@ mv $@-t $@
@ -99,7 +106,7 @@ install-data-hook: $(GMOFILES)
for lang in $(LANGS); do \ for lang in $(LANGS); do \
d=$(DESTDIR)$(langinstdir)/$$lang/LC_MESSAGES; \ d=$(DESTDIR)$(langinstdir)/$$lang/LC_MESSAGES; \
mkdir -p $$d; \ mkdir -p $$d; \
install -m 0644 $(srcdir)/$$lang.gmo $$d/$(DOMAIN).mo; \ install -m 0644 $$lang.gmo $$d/$(DOMAIN).mo; \
done done
uninstall-hook: uninstall-hook: