build-sys: Update building of translations

newlib was lagging behind oldlib in how the build system created
the translation files.
This commit is contained in:
Craig Small 2021-02-15 21:36:57 +11:00
parent fb0e4f3f68
commit 10c6b859b0
6 changed files with 166 additions and 138 deletions

5
.gitignore vendored
View File

@ -29,6 +29,11 @@ kill
libtool libtool
ltmain.sh ltmain.sh
m4/ m4/
man-po/translated
man-po/*.pot
man-po/man.stamp
man-po/??/*
man-po/??_??/*
Makefile Makefile
Makefile.in Makefile.in
missing missing

View File

@ -397,5 +397,3 @@ get-trans:
echo "Getting the latest translations from translationproject.org..." 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/ po
rsync -Lrtvz translationproject.org::tp/latest/procps-ng-man/ man-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

View File

@ -43,6 +43,18 @@ AC_PROG_LN_S
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
AC_DEFUN([PROCPS_PROG_PO4A], [
AC_REQUIRE([AM_NLS])
AC_CHECK_PROGS([PO4A], [po4a])
AS_IF([test "$USE_NLS" = "yes" && test -n "$PO4A"], [
USE_PO4A=yes
], [
USE_PO4A=no
])
AC_SUBST([USE_PO4A])
])
PROCPS_PROG_PO4A
# Checks for header files. # Checks for header files.
AC_HEADER_MAJOR AC_HEADER_MAJOR
AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h langinfo.h libintl.h limits.h locale.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 utmpx.h values.h wchar.h wctype.h]) AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h langinfo.h libintl.h limits.h locale.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 utmpx.h values.h wchar.h wctype.h])

8
man-po/.gitignore vendored
View File

@ -1,8 +0,0 @@
*.pot
/de/
/fr/
/pl/
/pt_BR/
/sv/
/uk/
/zh_CN/

View File

@ -1,134 +1,99 @@
translate-templates: $(DIST_MAN_POTS) # *.po and *.pot are kept in VCS and generated by po4a-dist command
EXTRA_DIST = $(DIST_MAN_POTS) $(DIST_MAN_POS) $(DIST_translated_MANS) # translated/* are put in distribution but not found in VCS
#
get-trans: # run:
rsync -Lrtvz translationproject.org::tp/latest/procps-ng-man/ . # make -C man-po po4a-dist
rsync -Lrtvz translationproject.org::tp/latest/procps-ng-man-ps/ ps # To update man page translations
rsync -Lrtvz translationproject.org::tp/latest/procps-ng-man-top/ top
translate-mans: dist-man-paths $(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 $@
CLEANFILES = $(DIST_MAN_POTS) $(translated_MANS)
maintainer-clean-local:
-rm -rf $(all_langs)
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)
$(MAN_PS_POT): $(MAN_PS_POT_FILES)
$(PO4A_UPDATEPO) -o translate_joined=MT -o noarg=ME -f man -m $< -p $@
$(MAN_TOP_POT): $(MAN_TOP_POT_FILES)
$(PO4A_UPDATEPO) -o translate_joined=MT -o noarg=ME -f man -m $< -p $@
$(MAN_POT): $(MAN_POT_FILES)
$(PO4A_UPDATEPO) -o translate_joined=MT -o noarg=ME -f man -m $< -p $@
dist_man_MANS = $(foreach lang, $(all_langs), $(foreach section, $(MAN_SECTIONS), $(wildcard $(lang)/man$(section)/*.$(section))))
dist-hook: translate-mans
echo $(translated_MANS)
dist-man-paths: translated_MANS = $(wildcard translated/*/*.[1-9])
echo $(top_langs) translated_MAN_sections=$(subst .,,$(sort $(suffix $(translated_MANS))))
@for p in $(man_paths) ; do \
echo " $(MKDIR_P) '$$p'"; \ translated_langs = $(notdir $(wildcard translated/*))
EXTRA_DIST = po4a.cfg \
procps-man.pot \
$(translated_MANS)
# Extract the list of languages from the po4a config file.
LINGUAS_DIST = $(shell sed -ne 's/^.*\[po4a_langs\] \(.*\)$$/\1/p' $(srcdir)/po4a.cfg)
# If the user has not defined it let's use the default.
LINGUAS ?= $(LINGUAS_DIST)
PO4A_V = $(PO4A_V_@AM_V@)
PO4A_V_ = $(PO4A_V_@AM_DEFAULT_V@)
PO4A_V_0 = @echo " PO4A $@";
PO4A_OPTS = --srcdir $(srcdir) --destdir $(CURDIR) \
--package-name $(PACKAGE) --package-version $(VERSION) \
--msgid-bugs-address "Procps list <procps@freelists.org>"
all-local: all-local-@USE_PO4A@
all-local-no:
all-local-yes: man.stamp
# FIXME: Use a stamp file until po4a supports them internally.
man.stamp:
$(PO4A_V) $(PO4A) $(PO4A_OPTS) $(srcdir)/po4a.cfg
$(AM_V_at) touch $@
clean-local: clean-local-@USE_PO4A@
clean-local-no:
clean-local-yes:
rm -rf $(LINGUAS_DIST)
$(AM_V_at) rm -f man.stamp
.PHONY: update-po
procps-man.pot:
# parafiles = $(patsubst %,-m%,$(subst :, ,$(dist_man_MANS)))
# parafiles = $(dist_man_MANS:doc=Ente)
po4a-gettextize -M utf8 --option groff_code=verbatim --option generated --option untranslated="a.RE,\|" --option unknown_macros=untranslated -f man $(patsubst %,-m%,$(subst :, ,$(dist_man_MANS))) -p $@
install-data-local:
for lang in $(LINGUAS) ; do \
files=""; \
for trans in $(notdir $(dist_man_MANS)); do \
if [ -f $(CURDIR)/$$lang/$$trans ]; then \
files="$$files $(CURDIR)/$$lang/$$trans"; \
elif [ -f $(srcdir)/$$lang/$$trans ]; then \
files="$$files $(srcdir)/$$lang/$$trans"; \
fi; \
done; \
$(MAKE) install-man \
mandir="$(mandir)/$$lang" \
man_MANS="" \
dist_man_MANS="$$files"; \
done done
# My Makefile-fu fails me here, I cannot see how to have double-wildcards uninstall-local:
# or have rules and recipies split for lang in $(LINGUAS); do \
# files=""; \
%/man1/top.1: ../top/top.1 top/%.po for trans in $(notdir $(dist_man_MANS)); do \
$(PO4A_TRANSLATE) -f man -m $< -p top/$*.po -l $@ if [ -f $(CURDIR)/$$lang/$$trans ]; then \
files="$$files $(CURDIR)/$$lang/$$trans"; \
elif [ -f $(srcdir)/$$lang/$$trans ]; then \
files="$$files $(srcdir)/$$lang/$$trans"; \
fi; \
done; \
$(MAKE) uninstall-man \
mandir="$(mandir)/$$lang" \
man_MANS="" \
dist_man_MANS="$$files"; \
done
%/man1/ps.1: ../ps/ps.1 ps/%.po dist-hook: man.stamp
$(PO4A_TRANSLATE) -f man -m $< -p ps/$*.po -l $@ cp $(srcdir)/man.stamp $(distdir)/
for lang in $(LINGUAS_DIST); do \
%/man1/free.1: ../free.1 %.po cp $(srcdir)/$$lang.po $(distdir); \
$(translate_manpage) cp $(srcdir)/$$lang.add $(distdir); \
$(MKDIR_P) $(distdir)/$$lang; \
%/man1/kill.1: ../kill.1 %.po cp -r $(srcdir)/$$lang $(distdir)/; \
$(translate_manpage) done
%/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

56
man-po/po4a.cfg Normal file
View File

@ -0,0 +1,56 @@
# Languages for man page
[po4a_langs] de fr pl pt_BR sv uk zh_CN
[po4a_paths] procps-man.pot $lang:$lang.po
[type: man] ../free.1 $lang:$lang/free.1 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../kill.1 $lang:$lang/kill.1 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../pgrep.1 $lang:$lang/pgrep.1 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../pidof.1 $lang:$lang/pidof.1 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../pmap.1 $lang:$lang/pmap.1 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../pwdx.1 $lang:$lang/pwdx.1 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../skill.1 $lang:$lang/skill.1 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../slabtop.1 $lang:$lang/slabtop.1 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../sysctl.8 $lang:$lang/sysctl.8 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../sysctl.conf.5 $lang:$lang/sysctl.conf.5 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../tload.1 $lang:$lang/tload.1 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../uptime.1 $lang:$lang/uptime.1 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../vmstat.8 $lang:$lang/vmstat.8 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../w.1 $lang:$lang/w.1 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../watch.1 $lang:$lang/watch.1 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../ps/ps.1 $lang:$lang/ps.1 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
[type: man] ../top/top.1 $lang:$lang/top.1 \
add_$lang:?add_$lang/$lang.add opt:"-k 80"
#../watch.1