2021-01-03 03:32:25 +08:00
|
|
|
|
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
1996-05-08 11:31:04 +08:00
|
|
|
|
# This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
|
|
# The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 12:58:11 +08:00
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
1996-05-08 11:31:04 +08:00
|
|
|
|
|
|
|
|
|
# The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 12:58:11 +08:00
|
|
|
|
# Lesser General Public License for more details.
|
1996-05-08 11:31:04 +08:00
|
|
|
|
|
2001-07-06 12:58:11 +08:00
|
|
|
|
# You should have received a copy of the GNU Lesser General Public
|
2012-02-10 07:18:22 +08:00
|
|
|
|
# License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 13:40:42 +08:00
|
|
|
|
# <https://www.gnu.org/licenses/>.
|
1997-01-20 10:49:49 +08:00
|
|
|
|
|
|
|
|
|
# Makefile for installing libc message catalogs.
|
1996-05-08 11:31:04 +08:00
|
|
|
|
|
|
|
|
|
subdir := po
|
|
|
|
|
|
2014-02-27 07:12:03 +08:00
|
|
|
|
include ../Makeconfig
|
|
|
|
|
|
2002-02-14 06:50:48 +08:00
|
|
|
|
# Add names of the languages with broken .po files here.
|
2006-01-08 14:46:10 +08:00
|
|
|
|
BROKEN_LINGUAS =
|
2001-04-20 12:45:54 +08:00
|
|
|
|
|
1996-05-08 11:31:04 +08:00
|
|
|
|
# List of languages for which we have message catalogs of translations.
|
2001-04-20 12:45:54 +08:00
|
|
|
|
ALL_LINGUAS := $(filter-out $(BROKEN_LINGUAS),$(basename $(wildcard *.po)))
|
1996-05-08 11:31:04 +08:00
|
|
|
|
|
|
|
|
|
# You can override this in configparms or the make command line to limit
|
|
|
|
|
# the languages which get installed.
|
|
|
|
|
ifdef LINGUAS
|
|
|
|
|
LINGUAS := $(filter $(addsuffix %,$(LINGUAS)),$(ALL_LINGUAS))
|
|
|
|
|
else
|
|
|
|
|
LINGUAS = $(ALL_LINGUAS)
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
# Text domain name to install under; must match ../locale/SYS_libc.c string.
|
1996-09-08 10:07:08 +08:00
|
|
|
|
domainname = libc
|
1996-05-08 11:31:04 +08:00
|
|
|
|
|
|
|
|
|
# Pattern for where message catalog object for language % gets installed.
|
2016-02-25 09:06:04 +08:00
|
|
|
|
mo-installed = $(inst_localedir)/%/LC_MESSAGES/$(domainname).mo
|
1996-05-08 11:31:04 +08:00
|
|
|
|
|
|
|
|
|
# Files to install: a $(domainname).mo file for each language.
|
|
|
|
|
install-others = $(LINGUAS:%=$(mo-installed))
|
|
|
|
|
|
Do not build .mo files in source directory (bug 14121).
Building and installing glibc leaves .mo files (compiled message
translations) behind in the source directory. Building those files in
the source directory may once have made sense, if they were included
in release tarballs; now that release tarballs are just the output of
"git archive", building any non-checked-in files in the source
directory does not make sense. This patch changes these files to be
built in the build directory instead. The realclean rule is changed
to simply adding the .mo files to the "generated" variable, since once
the files are in the build directory it make no sense to exclude them
from normal cleanup rules.
This is necessary but not sufficient to avoid build-many-glibcs.py
needing to copy the glibc source directory. Its list of files to
touch on checkout to avoid subsequent regeneration (configure,
preconfigure, *-kw.h) is incomplete (missing at least INSTALL,
sysdeps/gnu/errlist.c, posix/testcases.h, posix/ptestcases.h,
locale/C-translit.h, (only regenerated for Hurd builds)
sysdeps/mach/hurd/bits/errno.h, (only regenerated for 32-bit SPARC
builds) sysdeps/sparc/sparc32/{sdiv,udiv,rem,urem}.S) - the existing
list may be sufficient to prevent regeneration that actually changes
the file contents depending on the installed build tools, but not to
ensure there is no regeneration at all - and there might well be other
things writing into the source directory in the course of building and
testing (so needing appropriate testing with read-only source
directories with different timestamp orderings to find and eliminate
all such cases).
Tested for x86_64.
[BZ #14121]
* po/Makefile (generated): Add $(ALL_LINGUAS:%=%.mo).
(%.mo): Change to $(objpfx)%.mo. Use $(make-target-directory).
($(mo-installed)): Use $(objpfx)%.mo.
(realclean): Remove rule.
2017-12-15 22:27:20 +08:00
|
|
|
|
generated += $(ALL_LINGUAS:%=%.mo)
|
|
|
|
|
|
1996-05-08 11:31:04 +08:00
|
|
|
|
|
1996-05-09 00:18:27 +08:00
|
|
|
|
include ../Rules
|
1996-05-08 11:31:04 +08:00
|
|
|
|
|
2006-01-08 14:46:10 +08:00
|
|
|
|
# Generate the translation template from all the source files.
|
2014-01-09 06:09:48 +08:00
|
|
|
|
libc.pot: pot.header libc.pot.files
|
2006-01-08 14:46:10 +08:00
|
|
|
|
@rm -f $@.new
|
|
|
|
|
set `date -R`; disp="$$6"; \
|
|
|
|
|
sed -e 's/VERSION/$(version)/' \
|
|
|
|
|
-e "s/DATE/`date +'%Y-%m-%d %H:%M'$$disp`/" \
|
2012-06-14 07:50:29 +08:00
|
|
|
|
-e "s/CHARSET/UTF-8/" \
|
2006-01-08 14:46:10 +08:00
|
|
|
|
$< > $@.new
|
2011-05-31 12:09:03 +08:00
|
|
|
|
egrep -v '\.ksh$$' $(word 2,$^) > $(objdir)/tmp-libc.pot-files
|
2006-01-08 14:46:10 +08:00
|
|
|
|
cd ..; $(XGETTEXT) --keyword=_ --keyword=N_ \
|
|
|
|
|
--add-comments=TRANS --flag=error:3:c-format \
|
2009-02-07 04:42:21 +08:00
|
|
|
|
--flag=f_print:2:c-format \
|
2006-01-08 14:46:10 +08:00
|
|
|
|
--sort-by-file --omit-header -E -n -d - \
|
2011-05-31 12:09:03 +08:00
|
|
|
|
-f $(objdir)/tmp-libc.pot-files >> po/$@.new
|
|
|
|
|
egrep '\.ksh$$' $(word 2,$^) > $(objdir)/tmp-libc.pot-files
|
|
|
|
|
cd ..; $(XGETTEXT) --add-comments=TRANS --language=Shell \
|
|
|
|
|
--sort-by-file --omit-header -E -n -o po/$@.new -j \
|
|
|
|
|
-f $(objdir)/tmp-libc.pot-files po/$@.new
|
|
|
|
|
rm $(objdir)/tmp-libc.pot-files
|
2006-01-08 14:46:10 +08:00
|
|
|
|
mv -f $@.new $@
|
|
|
|
|
|
2007-05-30 02:08:41 +08:00
|
|
|
|
po-sed-cmd = \
|
2011-05-31 12:09:03 +08:00
|
|
|
|
'/\/tst-/d;$(foreach S,[ch] cxx sh ksh bash,$(subst .,\.,/.$S\(.in\)*$$/p;))'
|
2007-05-30 02:08:41 +08:00
|
|
|
|
|
2006-01-08 14:46:10 +08:00
|
|
|
|
# Omit tst-* files, and get only files with the given suffixes.
|
|
|
|
|
libc.pot.files: FORCE
|
2007-05-30 02:08:41 +08:00
|
|
|
|
$(..)scripts/list-sources.sh .. | sed -n $(po-sed-cmd) > $@.new
|
2006-01-08 14:46:10 +08:00
|
|
|
|
mv -f $@.new $@
|
1996-05-08 11:31:04 +08:00
|
|
|
|
|
|
|
|
|
.SUFFIXES: .mo .po .pot
|
|
|
|
|
|
|
|
|
|
# Compile the binary message object files from the portable object source
|
|
|
|
|
# files of translations for each language.
|
Do not build .mo files in source directory (bug 14121).
Building and installing glibc leaves .mo files (compiled message
translations) behind in the source directory. Building those files in
the source directory may once have made sense, if they were included
in release tarballs; now that release tarballs are just the output of
"git archive", building any non-checked-in files in the source
directory does not make sense. This patch changes these files to be
built in the build directory instead. The realclean rule is changed
to simply adding the .mo files to the "generated" variable, since once
the files are in the build directory it make no sense to exclude them
from normal cleanup rules.
This is necessary but not sufficient to avoid build-many-glibcs.py
needing to copy the glibc source directory. Its list of files to
touch on checkout to avoid subsequent regeneration (configure,
preconfigure, *-kw.h) is incomplete (missing at least INSTALL,
sysdeps/gnu/errlist.c, posix/testcases.h, posix/ptestcases.h,
locale/C-translit.h, (only regenerated for Hurd builds)
sysdeps/mach/hurd/bits/errno.h, (only regenerated for 32-bit SPARC
builds) sysdeps/sparc/sparc32/{sdiv,udiv,rem,urem}.S) - the existing
list may be sufficient to prevent regeneration that actually changes
the file contents depending on the installed build tools, but not to
ensure there is no regeneration at all - and there might well be other
things writing into the source directory in the course of building and
testing (so needing appropriate testing with read-only source
directories with different timestamp orderings to find and eliminate
all such cases).
Tested for x86_64.
[BZ #14121]
* po/Makefile (generated): Add $(ALL_LINGUAS:%=%.mo).
(%.mo): Change to $(objpfx)%.mo. Use $(make-target-directory).
($(mo-installed)): Use $(objpfx)%.mo.
(realclean): Remove rule.
2017-12-15 22:27:20 +08:00
|
|
|
|
$(objpfx)%.mo: %.po
|
|
|
|
|
$(make-target-directory)
|
1996-05-08 11:31:04 +08:00
|
|
|
|
$(MSGFMT) -o $@ $<
|
|
|
|
|
|
1996-09-08 10:07:08 +08:00
|
|
|
|
# Install the message object files as libc.po in the language directory.
|
Do not build .mo files in source directory (bug 14121).
Building and installing glibc leaves .mo files (compiled message
translations) behind in the source directory. Building those files in
the source directory may once have made sense, if they were included
in release tarballs; now that release tarballs are just the output of
"git archive", building any non-checked-in files in the source
directory does not make sense. This patch changes these files to be
built in the build directory instead. The realclean rule is changed
to simply adding the .mo files to the "generated" variable, since once
the files are in the build directory it make no sense to exclude them
from normal cleanup rules.
This is necessary but not sufficient to avoid build-many-glibcs.py
needing to copy the glibc source directory. Its list of files to
touch on checkout to avoid subsequent regeneration (configure,
preconfigure, *-kw.h) is incomplete (missing at least INSTALL,
sysdeps/gnu/errlist.c, posix/testcases.h, posix/ptestcases.h,
locale/C-translit.h, (only regenerated for Hurd builds)
sysdeps/mach/hurd/bits/errno.h, (only regenerated for 32-bit SPARC
builds) sysdeps/sparc/sparc32/{sdiv,udiv,rem,urem}.S) - the existing
list may be sufficient to prevent regeneration that actually changes
the file contents depending on the installed build tools, but not to
ensure there is no regeneration at all - and there might well be other
things writing into the source directory in the course of building and
testing (so needing appropriate testing with read-only source
directories with different timestamp orderings to find and eliminate
all such cases).
Tested for x86_64.
[BZ #14121]
* po/Makefile (generated): Add $(ALL_LINGUAS:%=%.mo).
(%.mo): Change to $(objpfx)%.mo. Use $(make-target-directory).
($(mo-installed)): Use $(objpfx)%.mo.
(realclean): Remove rule.
2017-12-15 22:27:20 +08:00
|
|
|
|
$(mo-installed): $(objpfx)%.mo $(+force); $(do-install) || exit 0
|
1996-05-08 11:31:04 +08:00
|
|
|
|
|
2017-01-20 14:54:46 +08:00
|
|
|
|
# Update translations from the translation project.
|
|
|
|
|
TRANSLATIONS_URL = https://translationproject.org/latest/libc
|
|
|
|
|
WGET = wget
|
|
|
|
|
|
|
|
|
|
update-translations:
|
|
|
|
|
$(WGET) -qO- $(TRANSLATIONS_URL) | sed -n 's|.*href="\([^"]\+po\)".*|\1|p' | \
|
|
|
|
|
while read f; do \
|
2020-01-18 00:36:01 +08:00
|
|
|
|
$(WGET) -O $(objdir)/$$f-tmp2 $(TRANSLATIONS_URL)/$$f && \
|
|
|
|
|
msgmerge --previous --no-wrap $(objdir)/$$f-tmp2 libc.pot > \
|
|
|
|
|
$(objdir)/$$f-tmp && \
|
2020-01-18 01:19:33 +08:00
|
|
|
|
msgattrib --translated --no-fuzzy --no-obsolete --no-wrap \
|
|
|
|
|
$(objdir)/$$f-tmp > $(objdir)/$$f-tmp0 && \
|
|
|
|
|
mv -f $(objdir)/$$f-tmp0 $$f; \
|
2017-01-20 14:54:46 +08:00
|
|
|
|
done
|