From: Craig Small Date: Mon, 11 Nov 2019 10:41:00 +0000 (+1100) Subject: build-sys: Use po4a for manpage translations X-Git-Tag: v3.3.16~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2590e3be42e5e80d976262847123babee05373e8;p=procps-ng build-sys: Use po4a for manpage translations Using the newer po4a tool for manpage translations. Also removing the manpage po file update from dist target because it should be something the is explicitly done. The git repository will hold the original man pages and the po translation files. The distribution tarball will hold those and the translated manpages. This means most people won't need po4a as the distribution fill will have these translated manpages. --- diff --git a/.gitignore b/.gitignore index e92cfe9c..ae075985 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ kill libtool ltmain.sh m4/ +man-po/translated Makefile Makefile.in missing diff --git a/Makefile.am b/Makefile.am index 781e3812..bbf0c7df 100644 --- a/Makefile.am +++ b/Makefile.am @@ -353,5 +353,3 @@ get-trans: echo "Getting the latest translations from translationproject.org..." rsync -Lrtvz translationproject.org::tp/latest/procps-ng/ po rsync -Lrtvz translationproject.org::tp/latest/procps-ng-man/ man-po - rsync -Lrtvz translationproject.org::tp/latest/procps-ng-man-ps/ man-po/ps - rsync -Lrtvz translationproject.org::tp/latest/procps-ng-man-top/ man-po/top diff --git a/configure.ac b/configure.ac index bc84a0d3..4359dd88 100644 --- a/configure.ac +++ b/configure.ac @@ -42,6 +42,12 @@ AC_PROG_LN_S PKG_PROG_PKG_CONFIG AC_PROG_MAKE_SET +AC_PATH_PROG(PO4A, po4a) +if test "xPO4A" = "x" ; then + AM_CONDITIONAL(USE_PO4A, false) +else + AM_CONDITIONAL(USE_PO4A, true) +fi # Checks for header files. AC_HEADER_MAJOR AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h langinfo.h libintl.h limits.h locale.h netinet/in.h stdint.h stdio_ext.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/time.h termios.h unistd.h utmp.h values.h wchar.h wctype.h]) diff --git a/man-po/Makefile.am b/man-po/Makefile.am index 7bba57fe..2a5a08ba 100644 --- a/man-po/Makefile.am +++ b/man-po/Makefile.am @@ -1,141 +1,35 @@ -translate-templates: $(DIST_MAN_POTS) -EXTRA_DIST = $(DIST_MAN_POTS) $(DIST_MAN_POS) $(DIST_translated_MANS) - -get-trans: - rsync -Lrtvz translationproject.org::tp/latest/procps-ng-man/ . - rsync -Lrtvz translationproject.org::tp/latest/procps-ng-man-ps/ ps - rsync -Lrtvz translationproject.org::tp/latest/procps-ng-man-top/ top - -translate-mans: $(translated_MANS) - -base_langs = $(patsubst %.po,%,$(wildcard *.po)) -top_langs = $(patsubst %.po,%,$(notdir $(wildcard top/*.po))) -ps_langs = $(patsubst %.po,%,$(notdir $(wildcard ps/*.po))) -all_langs = $(base_langs) $(top_langs) $(ps_langs) -DIST_MAN_POS = $(wildcard *.po) $(wildcard top/*.po) $(wildcard ps/*.po) -DIST_translated_MANS = $(shell find . -name '*.[1-9]') -MAN_SECTIONS = 1 5 8 -MAN_PAGES = free.1 kill.1 pgrep.1 pidof.1 pkill.1 pmap.1 pwdx.1 skill.1 slabtop.1 \ - tload.1 uptime.1 w.1 watch.1 \ - sysctl.conf.5 \ - sysctl.8 vmstat.8 -man1_pages := $(foreach man,$(filter %.1, $(MAN_PAGES)), man1/$(man)) -man5_pages := $(foreach man,$(filter %.5, $(MAN_PAGES)), man5/$(man)) -man8_pages := $(foreach man,$(filter %.8, $(MAN_PAGES)), man8/$(man)) - -man_pages = $(man1_pages) $(man8_pages) - -man_paths = $(foreach lang, $(base_langs), $(foreach section,$(MAN_SECTIONS),$(lang)/man$(section))) \ - $(foreach lang, $(top_langs), $(lang)/man1) \ - $(foreach lang, $(ps_langs), $(lang)/man1) -translated_MANS :=$(foreach lang,$(base_langs), $(foreach manpage,$(man_pages),$(lang)/$(manpage))) -translated_MANS +=$(foreach lang,$(top_langs), $(lang)/man1/top.1) -translated_MANS +=$(foreach lang,$(ps_langs), $(lang)/man1/ps.1) - -PO4A_UPDATEPO = po4a-updatepo -PO4A_TRANSLATE = po4a-translate -translate_manpage = $(PO4A_TRANSLATE) -o translate_joined=MT -o noarg=ME -f man -m $< -p $*.po -l $@ +# *.po and *.pot are kept in VCS and generated by po4a-dist command +# translated/* are put in distribution but not found in VCS +# +# run: +# make -C man-po po4a-dist +# To update man page translations -CLEANFILES = $(DIST_MAN_POTS) $(translated_MANS) -maintainer-clean-local: - -rm -rf $(all_langs) +DIST_translated_MANS = $(shell find translated -name '*.[1-9]') -MAN_PS_POT = template-man-ps.pot -MAN_PS_POT_FILES = $(top_srcdir)/ps/ps.1 -MAN_TOP_POT = template-man-top.pot -MAN_TOP_POT_FILES = $(top_srcdir)/top/top.1 -MAN_POT = template-man.pot -MAN_POT_FILES = $(top_srcdir)/free.1 $(top_srcdir)/kill.1 $(top_srcdir)/pgrep.1 \ - $(top_srcdir)/pidof.1 $(top_srcdir)/pkill.1 $(top_srcdir)/pmap.1 \ - $(top_srcdir)/pwdx.1 $(top_srcdir)/skill.1 $(top_srcdir)/slabtop.1 \ - $(top_srcdir)/snice.1 $(top_srcdir)/sysctl.8 $(top_srcdir)/uptime.1 \ - $(top_srcdir)/sysctl.conf.5 $(top_srcdir)/tload.1 \ - $(top_srcdir)/vmstat.8 $(top_srcdir)/w.1 $(top_srcdir)/watch.1 -DIST_MAN_POTS = $(MAN_PS_POT) $(MAN_TOP_POT) $(MAN_POT) +EXTRA_DIST = po4a.cfg $(DIST_translated_MANS) -$(MAN_PS_POT): $(MAN_PS_POT_FILES) - $(eval po4a_manfiles := $(foreach manfile,$^,$(addprefix -m , $(manfile)))) - $(PO4A_UPDATEPO) -o translate_joined=MT -o noarg=ME -f man $(po4a_manfiles) -p $@ +if USE_PO4A -$(MAN_TOP_POT): $(MAN_TOP_POT_FILES) - $(eval po4a_manfiles := $(foreach manfile,$^,$(addprefix -m , $(manfile)))) - $(PO4A_UPDATEPO) -o translate_joined=MT -o noarg=ME -f man $(po4a_manfiles) -p $@ +po4a-dist: + -@po4a -M utf-8 -k 0 po4a.cfg +endif -$(MAN_POT): $(MAN_POT_FILES) - $(eval po4a_manfiles := $(foreach manfile,$^,$(addprefix -m , $(manfile)))) - $(PO4A_UPDATEPO) -o translate_joined=MT -o noarg=ME -f man $(po4a_manfiles) -p $@ -man_MANS := $(foreach lang, $(all_langs), $(foreach section, $(MAN_SECTIONS), $(wildcard $(lang)/man$(section)/*.$(section)))) -dist-hook: translate-mans - echo $(translated_MANS) +get-trans: + rsync -Lrtvz translationproject.org::tp/latest/procps-ng-man/ . +translated_langs = $(notdir $(wildcard translated/*)) -install-data-local: translate-mans - for l in $(base_langs) ; do \ - for sect in `ls $$l` ; do \ +install-data-local: + for l in $(translated_langs) ; do \ + for sect in `ls translated/$$l` ; do \ $(MKDIR_P) $(DESTDIR)$(mandir)/$$l/$$sect ; \ - for file in `ls $$l/$$sect` ; do \ - $(INSTALL_DATA) $$l/$$sect/$$file $(DESTDIR)$(mandir)/$$l/$$sect ; \ + for file in `ls translated/$$l/$$sect` ; do \ + $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/$$l/$$sect ; \ done ; \ done ; \ done -# My Makefile-fu fails me here, I cannot see how to have double-wildcards -# or have rules and recipies split -# -%/man1/top.1: ../top/top.1 top/%.po - $(PO4A_TRANSLATE) -f man -m $< -p top/$*.po -l $@ - -%/man1/ps.1: ../ps/ps.1 ps/%.po - $(PO4A_TRANSLATE) -f man -m $< -p ps/$*.po -l $@ - -%/man1/free.1: ../free.1 %.po - $(translate_manpage) - -%/man1/kill.1: ../kill.1 %.po - $(translate_manpage) - -%/man1/pgrep.1: ../pgrep.1 %.po - $(translate_manpage) - -%/man1/pidof.1: ../pidof.1 %.po - $(translate_manpage) - -%/man1/pkill.1: ../pkill.1 %.po - $(translate_manpage) - -%/man1/pmap.1: ../pmap.1 %.po - $(translate_manpage) - -%/man1/pwdx.1: ../pwdx.1 %.po - $(translate_manpage) - -%/man1/skill.1: ../skill.1 %.po - $(translate_manpage) - -%/man1/slabtop.1: ../slabtop.1 %.po - $(translate_manpage) - -%/man1/tload.1: ../tload.1 %.po - $(translate_manpage) - -%/man1/uptime.1: ../uptime.1 %.po - $(translate_manpage) - -%/man1/w.1: ../w.1 %.po - $(translate_manpage) - -%/man1/watch.1: ../watch.1 %.po - $(translate_manpage) - -%/man5/sysctl.conf.5: ../sysctl.conf.5 %.po - $(translate_manpage) - -%/man8/sysctl.8: ../sysctl.8 %.po - $(translate_manpage) - -%/man8/vmstat.8: ../vmstat.8 %.po - $(translate_manpage) - -.PHONY = translate-mans dist-man-paths +.PHONY = translated_langs get-trans po4a-dist diff --git a/man-po/po4a.cfg b/man-po/po4a.cfg new file mode 100644 index 00000000..e0c12395 --- /dev/null +++ b/man-po/po4a.cfg @@ -0,0 +1,53 @@ +[po_directory] . + +[type: man] ../free.1 $lang:translated/$lang/free.1 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../kill.1 $lang:translated/$lang/kill.1 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../pgrep.1 $lang:translated/$lang/pgrep.1 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../pidof.1 $lang:translated/$lang/pidof.1 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../pmap.1 $lang:translated/$lang/pmap.1 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../pwdx.1 $lang:translated/$lang/pwdx.1 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../skill.1 $lang:translated/$lang/skill.1 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../slabtop.1 $lang:translated/$lang/slabtop.1 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../sysctl.8 $lang:translated/$lang/sysctl.8 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../sysctl.conf.5 $lang:translated/$lang/sysctl.conf.5 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../tload.1 $lang:translated/$lang/tload.1 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../uptime.1 $lang:translated/$lang/uptime.1 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../vmstat.8 $lang:translated/$lang/vmstat.8 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../w.1 $lang:translated/$lang/w.1 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../watch.1 $lang:translated/$lang/watch.1 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../ps/ps.1 $lang:translated/$lang/ps.1 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" + +[type: man] ../top/top.1 $lang:translated/$lang/top.1 \ + add_$lang:?add_$lang/$lang.add opt:"-k 80" +#../watch.1