]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
build-sys: add targets to generated translated man pages
authorKarel Zak <kzak@redhat.com>
Wed, 21 Apr 2021 17:55:27 +0000 (19:55 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 22 Apr 2021 13:23:42 +0000 (15:23 +0200)
* add --enable-poman (disabled by default)
* add po-man/Makefile.am for "make all" and "make install"
* install man pages to $mandir/$lang/man{1,3,5,8}

Signed-off-by: Karel Zak <kzak@redhat.com>
Makefile.am
configure.ac
po-man/Makefile.am [new file with mode: 0644]

index 26ec138291549a9ade0527a74090184690809f5e..85f7ed605bb570d415054d4b7b7cd9bbc0ddd22f 100644 (file)
@@ -73,6 +73,12 @@ CLEANFILES =
 
 SUBDIRS = po
 
+if ENABLE_ASCIIDOC
+if ENABLE_POMAN
+SUBDIRS += po-man
+endif
+endif
+
 RCS_FIND_IGNORE = \( -name SCCS -o -name BitKeeper -o -name .svn -o \
                -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o
 
index abb96e6280a2a6b52ef826e374fa8798ba5d7e3f..6a610b854f279d951b76b9b1c14806ac4a794153 100644 (file)
@@ -743,6 +743,15 @@ UL_REQUIRES_PROGRAM([asciidoc], [ASCIIDOCTOR], [asciidoctor], [man pages])
 AM_CONDITIONAL([ENABLE_ASCIIDOC], [test "x$build_asciidoc" = xyes])
 
 
+AC_ARG_ENABLE([poman],
+  AS_HELP_STRING([--enable-poman], [generate translated man pages]),
+  [], [UL_DEFAULT_ENABLE([poman], [no])]
+)
+UL_BUILD_INIT([poman])
+UL_REQUIRES_PROGRAM([poman], [PO4A], [po4a], [translated man pages])
+AM_CONDITIONAL([ENABLE_POMAN], [test "x$uild_poman" = xyes])
+
+
 AX_CHECK_TLS
 
 have_pty=no
@@ -2612,6 +2621,7 @@ libsmartcols/docs/Makefile
 libsmartcols/docs/version.xml
 libsmartcols/src/libsmartcols.h
 po/Makefile.in
+po-man/Makefile
 ])
 
 AC_OUTPUT
@@ -2656,6 +2666,7 @@ AC_MSG_RESULT([
        Wide-char support: ${build_widechar}
 
        Manual pages:      ${build_asciidoc}
+       Manual pages translated: ${build_poman}
 
        warnings:
 
diff --git a/po-man/Makefile.am b/po-man/Makefile.am
new file mode 100644 (file)
index 0000000..20f5c0b
--- /dev/null
@@ -0,0 +1,63 @@
+
+PO_FILES = $(wildcard *.po)
+PO_LANGS = $(PO_FILES:.po=)
+
+PO_STAMPS = po4a-gen.stamp
+MAN_SECTIONS = 1 3 5 8
+CLEANFILES = $(PO_STAMPS)
+
+EXTRA_DIST = README.md $(PO_FILES) po4a.cfg util-linux-man.pot
+
+po4a-gen.stamp: $(PO_FILES)
+       @echo 'po4a: generate man-pages translations'
+       $(AM_V_GEN) $(PO4A) po4a.cfg
+       @touch po4a-gen.stamp
+
+gen-trans: $(PO_STAMPS)
+
+asciidoc_man_cmd = $(ASCIIDOCTOR) \
+       -b manpage \
+       -a 'VERSION=$(VERSION)' \
+       -a 'ADJTIME_PATH=$(ADJTIME_PATH)'
+
+gen-mans: gen-trans
+       @for l in $(PO_LANGS); do \
+         gendir="$(abs_builddir)/$$l"; \
+         genfiles=`echo $${gendir}/*.adoc`; \
+         if test "$$genfiles" != '$${gendir}/*.adoc'; then \
+           for file in $${genfiles}; do \
+             manname=`echo $$file | sed -e 's|^.*/||' -e 's|\.adoc||'`;  \
+             test -f $${gendir}/$${manname} || { \
+                  echo "  GEN     " $$l ": " $$manname && \
+                  $(asciidoc_man_cmd) \
+                     --base-dir=$${gendir} \
+                     --destination-dir $${gendir} $${file}; \
+             }; \
+           done; \
+         fi; \
+       done
+
+all: gen-mans
+
+clean-local:
+       rm -f *~ *.bak
+
+distclean-local:
+       rm -rf $(PO_LANGS) *.stamp
+
+install-data-local: gen-mans
+       @for l in $(PO_LANGS); do \
+         mansrcdir="$(abs_builddir)/$$l"; \
+         for s in $(MAN_SECTIONS); do \
+           installfiles=`echo $${mansrcdir}/*.$$s`; \
+           if test "$$installfiles" != '$${mansrcdir}/*.$$s'; then \
+             installdir="$(DESTDIR)$(mandir)/$$l/man$$s"; \
+             $(MKDIR_P) "$${installdir}" || exit 1; \
+             for file in $$installfiles; do \
+               manname=`echo $$file | sed -e 's|^.*/||'`;  \
+               echo "  Installing " $$l ": " $$manname ; \
+               $(INSTALL_DATA) $$file $${installdir}; \
+             done; \
+           fi; \
+         done; \
+       done