mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
po-docs: split pot and po handling
With the Weblate adoption, we let it update the po files from the catalog template. The po4a behaviour of extracting the template, merging the existing translations, and creating the translated PODs at once is problematic. Hence, split the extraction and the translated POD generation in two. Use po4a-gettextize to extract the catalog template only, not doing it anymore automatically at each build. There is no more need for a po4a.conf file. Use po4a-translate to create translated PODs from the po files, keeping the fixup of the generated files (to avoid spurious =encoding, etc). Add a silent rule to hide the po4a-translate command lines by default. These changes also allow us to get rid of the POD existance checks with associated error message pointing to the update-po rule. Now each translated POD file is generated because of make dependency, and it depends only on its po file. Signed-off-by: Pino Toscano <ptoscano@redhat.com>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -444,7 +444,6 @@ Makefile.in
|
||||
/po-docs/*/*.3
|
||||
/po-docs/*/*.5
|
||||
/po-docs/*/*.8
|
||||
/po-docs/po4a.conf
|
||||
/po-docs/*/*.pod
|
||||
/podwrapper.1
|
||||
/podwrapper.pl
|
||||
|
||||
@@ -59,8 +59,9 @@ AC_CHECK_PROG([XMLLINT],[xmllint],[xmllint],[no])
|
||||
AM_CONDITIONAL([HAVE_XMLLINT],[test "x$XMLLINT" != "xno"])
|
||||
|
||||
dnl po4a for translating man pages and POD files (optional).
|
||||
AC_CHECK_PROG([PO4A],[po4a],[po4a],[no])
|
||||
AM_CONDITIONAL([HAVE_PO4A], [test "x$PO4A" != "xno"])
|
||||
AC_CHECK_PROG([PO4A_GETTEXTIZE],[po4a-gettextize],[po4a-gettextize],[no])
|
||||
AC_CHECK_PROG([PO4A_TRANSLATE],[po4a-translate],[po4a-translate],[no])
|
||||
AM_CONDITIONAL([HAVE_PO4A], [test "x$PO4A_GETTEXTIZE" != "xno" && test "x$PO4A_TRANSLATE" != "xno"])
|
||||
|
||||
dnl Check for db_dump, db_load (optional).
|
||||
GUESTFS_FIND_DB_TOOL([DB_DUMP], [dump])
|
||||
|
||||
@@ -35,47 +35,22 @@ EXTRA_DIST = \
|
||||
$(linguas_not_translated:%=%.po) \
|
||||
podfiles
|
||||
|
||||
CLEANFILES += po4a.conf
|
||||
|
||||
# Build the final man pages from the translated POD files. Each
|
||||
# language directory contains a Makefile.am that we need to keep up to
|
||||
# date (note each $lang/Makefile.am should be identical).
|
||||
# XXX Is there a better way?
|
||||
SUBDIRS = $(linguas)
|
||||
|
||||
update-po: libguestfs-docs.pot
|
||||
|
||||
# Note: po4a puts the following junk at the top of every POD file it
|
||||
# generates:
|
||||
# - a warning
|
||||
# - a probably bogus =encoding line
|
||||
# Remove both.
|
||||
# XXX Fix po4a so it doesn't do this.
|
||||
libguestfs-docs.pot: po4a.conf
|
||||
$(PO4A) \
|
||||
-M utf-8 -L utf-8 -A utf-8 \
|
||||
-v \
|
||||
-k 0 \
|
||||
libguestfs-docs.pot:
|
||||
$(PO4A_GETTEXTIZE) \
|
||||
-f pod \
|
||||
-M utf-8 -L utf-8 \
|
||||
--package-name $(PACKAGE_NAME) \
|
||||
--package-version $(PACKAGE_VERSION) \
|
||||
--msgid-bugs-address libguestfs@redhat.com \
|
||||
--copyright-holder "Red Hat Inc." \
|
||||
po4a.conf
|
||||
for f in `cd $(srcdir); find $(linguas) -name '*.pod'`; do \
|
||||
$(SED) '0,/^=encoding/d' < $$f > $$f.new; \
|
||||
mv $$f.new $$f; \
|
||||
done
|
||||
|
||||
po4a.conf: podfiles
|
||||
rm -f $@-t
|
||||
echo "[po_directory] $(srcdir)" >> $@-t
|
||||
echo >> $@-t
|
||||
for f in `cat podfiles`; do \
|
||||
out=`basename -- $$f .pod`.pod; \
|
||||
echo "[type: pod] $$f \$$lang:\$$lang/$$out" >> $@-t; \
|
||||
echo >> $@-t; \
|
||||
done;
|
||||
mv $@-t $@
|
||||
-p $@ \
|
||||
$(patsubst %,-m %,$(shell cat $(srcdir)/podfiles))
|
||||
|
||||
podfiles: Makefile
|
||||
rm -f $@ $@-t
|
||||
|
||||
@@ -22,7 +22,7 @@ include $(top_srcdir)/subdir-rules.mk
|
||||
LINGUA = $(shell basename -- `pwd`)
|
||||
|
||||
# Before 1.23.23, the old Perl tools were called *.pl.
|
||||
CLEANFILES += *.pl
|
||||
CLEANFILES += *.pl *.pod
|
||||
|
||||
MANPAGES = \
|
||||
guestfish.1 \
|
||||
@@ -195,19 +195,20 @@ virt-p2v.1: virt-p2v.pod virt-p2v-kernel-config.pod
|
||||
--section 8 \
|
||||
$<
|
||||
|
||||
# If a POD file is missing, the user needs to run make update-po.
|
||||
# This cannot be done automatically by make because it would be unsafe
|
||||
# to run po4a or update podfiles potentially in parallel. Therefore
|
||||
# tell the user what to do and stop.
|
||||
$(podfiles):
|
||||
@if ! test -f $@; then \
|
||||
echo "***"; \
|
||||
echo "*** You need to run the following commands:"; \
|
||||
echo "*** rm po-docs/podfiles; make -C po-docs update-po"; \
|
||||
echo "*** After that, rerun make."; \
|
||||
echo "***"; \
|
||||
exit 1; \
|
||||
fi
|
||||
# Note: po4a puts the following junk at the top of every POD file it
|
||||
# generates:
|
||||
# - a warning
|
||||
# - a probably bogus =encoding line
|
||||
# Remove both.
|
||||
# XXX Fix po4a so it doesn't do this.
|
||||
%.pod: $(srcdir)/../$(LINGUA).po
|
||||
$(guestfs_am_v_po4a_translate)$(PO4A_TRANSLATE) \
|
||||
-f pod \
|
||||
-M utf-8 -L utf-8 \
|
||||
-k 0 \
|
||||
-m $(srcdir)/../$(shell grep '/$(notdir $@)$$' $(top_srcdir)/po-docs/podfiles) \
|
||||
-p $< \
|
||||
| $(SED) '0,/^=encoding/d' > $@
|
||||
|
||||
# XXX Can automake do this properly?
|
||||
install-data-hook:
|
||||
|
||||
@@ -78,6 +78,9 @@ guestfs_am_v_podwrapper_0 = @echo " POD " $@;
|
||||
guestfs_am_v_jar = $(guestfs_am_v_jar_@AM_V@)
|
||||
guestfs_am_v_jar_ = $(guestfs_am_v_jar_@AM_DEFAULT_V@)
|
||||
guestfs_am_v_jar_0 = @echo " JAR " $@;
|
||||
guestfs_am_v_po4a_translate = $(guestfs_am_v_po4a_translate_@AM_V@)
|
||||
guestfs_am_v_po4a_translate_ = $(guestfs_am_v_po4a_translate_@AM_DEFAULT_V@)
|
||||
guestfs_am_v_po4a_translate_0 = @echo " PO4A-T " $@;
|
||||
|
||||
%.cmi: %.mli
|
||||
$(guestfs_am_v_ocamlcmi)$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@
|
||||
|
||||
Reference in New Issue
Block a user