diff mbox series

[PATCHv2] Add convenience target 'install-locale-files'.

Message ID 3d01061c-9323-09ab-8571-75900dabd397@redhat.com
State New
Headers show
Series [PATCHv2] Add convenience target 'install-locale-files'. | expand

Commit Message

Carlos O'Donell July 26, 2018, 6:03 p.m. UTC
On 07/26/2018 01:33 PM, Joseph Myers wrote:
> On Thu, 26 Jul 2018, Carlos O'Donell wrote:
> 
>> The convenience install target 'install-locale-files' is created
>> to allow distributions to install all of the SUPPORTED locales as
>> files instead of into the locale-archive.
>>
>> You invoke the new convenience target like this:
>> make localedata/install-locale-files install_root=<prefix>
>>
>> OK for 2.29 when it opens?
> 
> This is missing documentation in install.texi (alongside the existing 
> documentation of "make localedata/install-locales") / regeneration of 
> INSTALL.

Fixed.

v2
- Update documentation to talk about locale-archive / locale files.
- Regenerate INSTALL.

Tested both install methods.

OK for 2.29 when it opens?

Comments

Rical Jasan July 26, 2018, 6:36 p.m. UTC | #1
On 07/26/2018 11:03 AM, Carlos O'Donell wrote:
...
> diff --git a/manual/install.texi b/manual/install.texi
> index a8577dd610..2501586302 100644
> --- a/manual/install.texi
> +++ b/manual/install.texi
> @@ -462,13 +462,27 @@ permissions on a pseudoterminal so it can be used by the calling process.
>  If you are using a Linux kernel with the @code{devpts} filesystem enabled
>  and mounted at @file{/dev/pts}, you don't need this program.
>  
> -After installation you might want to configure the timezone and locale
> -installation of your system.  @Theglibc{} comes with a locale
> -database which gets configured with @code{localedef}.  For example, to
> -set up a German locale with name @code{de_DE}, simply issue the command
> -@samp{localedef -i de_DE -f ISO-8859-1 de_DE}.  To configure all locales
> -that are supported by @theglibc{}, you can issue from your build directory the
> -command @samp{make localedata/install-locales}.
> +After installation you should configure the timezone and install locales
> +for your system.  The time zone configuration ensures that youre system

"your"

Should there be a short NEWS entry about this?  I mention it because
additions to INSTALL seem to almost always be accompanied by one.

Also, what about documenting the install_root=<prefix> option?  I
recognize it as a common option, but it's still an option that packagers
have to choose to use, so it wouldn't hurt to mention that we support
it, especially since the content talks about installing the locale files
/somewhere/ on the system (giving examples).  My first question about
running a command whose name is "install-something" is, "Where?"

Rical
diff mbox series

Patch

From e91cedf2e53acfe9d0670c275648e8f33de2d126 Mon Sep 17 00:00:00 2001
From: Carlos O'Donell <carlos@redhat.com>
Date: Thu, 26 Jul 2018 10:14:55 -0400
Subject: [PATCH] Add convenience target 'install-locale-files'.

The convenience install target 'install-locale-files' is created
to allow distributions to install all of the SUPPORTED locales as
files instead of into the locale-archive.

You invoke the new convenience target like this:
make localedata/install-locale-files install_root=<prefix>
---
 ChangeLog           | 12 ++++++++++++
 INSTALL             | 28 ++++++++++++++++++++++------
 localedata/Makefile | 26 ++++++++++++++++++++------
 manual/install.texi | 28 +++++++++++++++++++++-------
 4 files changed, 75 insertions(+), 19 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8b509d4a34..f52bf6a1a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@ 
+2018-07-26  Carlos O'Donell <carlos@redhat.com>
+
+	* localedata/Makefile (INSTALL-SUPPORTED-LOCALES): Remove.
+	(INSTALL-SUPPORTED-LOCALE-ARCHIVE): Define.
+	(INSTALL-SUPPORTED-LOCALE-FILES): Define.
+	(install-locales): Depend on install-locale-archive.
+	(install-locale-archive): Define.
+	(install-lcoale-files): Define.
+	(build-one-locale): Define macro.
+	* manual/install.texi (Running make install): Document.
+	* manual/INSTALL: Regenerate.
+
 2018-07-25  Carlos O'Donell <carlos@redhat.com>
 
 	[BZ #23393]
diff --git a/INSTALL b/INSTALL
index 840b862511..47aa241af4 100644
--- a/INSTALL
+++ b/INSTALL
@@ -419,13 +419,29 @@  a pseudoterminal so it can be used by the calling process.  If you are
 using a Linux kernel with the 'devpts' filesystem enabled and mounted at
 '/dev/pts', you don't need this program.
 
-   After installation you might want to configure the timezone and
-locale installation of your system.  The GNU C Library comes with a
-locale database which gets configured with 'localedef'.  For example, to
-set up a German locale with name 'de_DE', simply issue the command
-'localedef -i de_DE -f ISO-8859-1 de_DE'.  To configure all locales that
+   After installation you should configure the timezone and install
+locales for your system.  The time zone configuration ensures that youre
+system time matches the time for your current timezone.  The locales
+ensure that the display of information on your system matches the
+expectations of your language and geographic region.
+
+   The GNU C Library is able to use two kinds of localization
+information sources, the first is a locale database named
+'locale-archive' which is generally installed as
+'/usr/lib/locale/locale-archive'.  The locale archive has the benefit of
+taking up less space and being very fast to load, but only if you plan
+to install sixty or more locales.  If you plan to install one or two
+locales you can instead install individual locales into their self-named
+directories e.g.  '/usr/lib/locale/en_US.utf8'.  For example to install
+the German locale using the character set for UTF-8 with name 'de_DE'
+into the locale archive issue the command 'localedef -i de_DE -f UTF-8
+de_DE', and to install just the one locale issue the command 'localedef
+--no-archive -i de_DE -f UTF-8 de_DE'.  To configure all locales that
 are supported by the GNU C Library, you can issue from your build
-directory the command 'make localedata/install-locales'.
+directory the command 'make localedata/install-locales' to install all
+locales into the locale archive or 'make
+localedata/install-locale-files' to install all locales as files in the
+locale installation directory.
 
    To configure the locally used timezone, set the 'TZ' environment
 variable.  The script 'tzselect' helps you to select the right value.
diff --git a/localedata/Makefile b/localedata/Makefile
index 13c5423e0e..0eea396ad8 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -380,12 +380,18 @@  endif
 
 include SUPPORTED
 
-INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
+INSTALL-SUPPORTED-LOCALE-ARCHIVE=$(addprefix install-archive-, $(SUPPORTED-LOCALES))
+INSTALL-SUPPORTED-LOCALE-FILES=$(addprefix install-files-, $(SUPPORTED-LOCALES))
 
 # Sometimes the whole collection of locale files should be installed.
 LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
 $(rtld-prefix) $(common-objpfx)locale/localedef
-install-locales: $(INSTALL-SUPPORTED-LOCALES)
+install-locales: install-locale-archive
+
+# Create and install the locale-archive file.
+install-locale-archive: $(INSTALL-SUPPORTED-LOCALE-ARCHIVE)
+# Create and install the locales individually (no archive).
+install-locale-files: $(INSTALL-SUPPORTED-LOCALE-FILES)
 
 install-locales-dir:
 	$(..)./scripts/mkinstalldirs $(inst_complocaledir)
@@ -393,11 +399,10 @@  install-locales-dir:
 # The SHIFT_JIS and SHIFT_JISX0213 character maps are not ASCII compatible,
 # therefore we have to use --no-warnings=ascii to disable the ASCII check.
 # See localedata/gen-locale.sh for the same logic.
-$(INSTALL-SUPPORTED-LOCALES): install-locales-dir
-	@locale=`echo $@ | sed -e 's/^install-//'`; \
+define build-one-locale
+	locale=`echo $@ | sed -e 's/^install-[a-z]*-//'`; \
 	charset=`echo $$locale | sed -e 's,.*/,,'`; \
 	locale=`echo $$locale | sed -e 's,/[^/]*,,'`; \
-	flags="-c"; \
 	if [ "$$charset" = 'SHIFT_JIS' ] \
 	   || [ "$$charset" = 'SHIFT_JISX0213' ]; then \
 	   flags="$$flags --no-warnings=ascii"; \
@@ -410,7 +415,16 @@  $(INSTALL-SUPPORTED-LOCALES): install-locales-dir
 	$(LOCALEDEF) $$flags --alias-file=../intl/locale.alias \
 		     -i locales/$$input -f charmaps/$$charset \
 		     $(addprefix --prefix=,$(install_root)) $$locale \
-	&& echo ' done'; \
+	&& echo ' done';
+endef
+
+$(INSTALL-SUPPORTED-LOCALE-ARCHIVE): install-locales-dir
+	@flags="-c"; \
+	$(build-one-locale)
+
+$(INSTALL-SUPPORTED-LOCALE-FILES): install-locales-dir
+	@flags="-c --no-archive"; \
+	$(build-one-locale)
 
 tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP
 tst-wctype-ENV = LC_ALL=ja_JP.EUC-JP
diff --git a/manual/install.texi b/manual/install.texi
index a8577dd610..2501586302 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -462,13 +462,27 @@  permissions on a pseudoterminal so it can be used by the calling process.
 If you are using a Linux kernel with the @code{devpts} filesystem enabled
 and mounted at @file{/dev/pts}, you don't need this program.
 
-After installation you might want to configure the timezone and locale
-installation of your system.  @Theglibc{} comes with a locale
-database which gets configured with @code{localedef}.  For example, to
-set up a German locale with name @code{de_DE}, simply issue the command
-@samp{localedef -i de_DE -f ISO-8859-1 de_DE}.  To configure all locales
-that are supported by @theglibc{}, you can issue from your build directory the
-command @samp{make localedata/install-locales}.
+After installation you should configure the timezone and install locales
+for your system.  The time zone configuration ensures that youre system
+time matches the time for your current timezone.  The locales ensure that
+the display of information on your system matches the expectations of
+your language and geographic region.
+
+@Theglibc{} is able to use two kinds of localization information sources, the
+first is a locale database named @file{locale-archive} which is generally
+installed as @file{/usr/lib/locale/locale-archive}.  The locale archive has the
+benefit of taking up less space and being very fast to load, but only if you
+plan to install sixty or more locales.  If you plan to install one or two
+locales you can instead install individual locales into their self-named
+directories e.g.  @file{/usr/lib/locale/en_US.utf8}.  For example to install the
+German locale using the character set for UTF-8 with name @code{de_DE} into the
+locale archive issue the command @samp{localedef -i de_DE -f UTF-8 de_DE}, and
+to install just the one locale issue the command @samp{localedef --no-archive -i
+de_DE -f UTF-8 de_DE}.  To configure all locales that are supported by
+@theglibc{}, you can issue from your build directory the command @samp{make
+localedata/install-locales} to install all locales into the locale archive or
+@samp{make localedata/install-locale-files} to install all locales as files in
+the locale installation directory.
 
 To configure the locally used timezone, set the @code{TZ} environment
 variable.  The script @code{tzselect} helps you to select the right value.
-- 
2.14.4