Add glibc version to locale-archive name (#1716710)

This commit is contained in:
Florian Weimer 2019-06-04 16:02:20 +02:00
parent 3aed6a961c
commit 819bb4065c
2 changed files with 197 additions and 3 deletions

183
glibc-rh1716710.patch Normal file
View File

@ -0,0 +1,183 @@
Author: Florian Weimer <fweimer@redhat.com>
Date: Tue Jun 4 14:34:42 2019 +0200
locale: Make the file name of the locale archive configurable
This improves support for parallel installation and upgrade scenarios
involving changes to the locale archive format or the data stored in
it.
diff --git a/INSTALL b/INSTALL
index e137a71169651929..0244b0aa9689336a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -106,6 +106,14 @@ if 'CFLAGS' is specified it must enable optimization. For example:
particular case and potentially change debugging information and
metadata only).
+'--with-locale-archive-name=NAME'
+ Use NAME as the file name of the locale archive, and not the
+ default 'locale-archive'. Usually, the locale archive is stored in
+ the directory '/usr/lib/locale' (for both 32-bit and 64-bit
+ targets). For parallel installation of partially compatible
+ versions of the GNU C Library, this option can be used to alter the
+ name of the file used by glibc and by the 'localedef' tool.
+
'--disable-shared'
Don't build shared libraries even if it is possible. Not all
systems support shared libraries; you need ELF support and
diff --git a/config.h.in b/config.h.in
index 824dfe8d8cb61dd1..7d263447ed153766 100644
--- a/config.h.in
+++ b/config.h.in
@@ -189,6 +189,9 @@
/* Define if the linker defines __ehdr_start. */
#undef HAVE_EHDR_START
+/* The file name of the locale archive (without the directory). */
+#undef LOCALE_ARCHIVE_NAME
+
/*
*/
diff --git a/config.make.in b/config.make.in
index 2fed3da773020a09..a6421039ebbbd966 100644
--- a/config.make.in
+++ b/config.make.in
@@ -23,6 +23,7 @@ datarootdir = @datarootdir@
localstatedir = @libc_cv_localstatedir@
localedir = @localedir@
multidir= @libc_cv_multidir@
+locale-archive-name = @locale_archive_name@
# Should we use and build ldconfig?
use-ldconfig = @use_ldconfig@
diff --git a/configure b/configure
index c773c487b542b3be..0d9645c389d3f111 100755
--- a/configure
+++ b/configure
@@ -687,6 +687,7 @@ hardcoded_path_in_tests
enable_timezone_tools
extra_nonshared_cflags
use_default_link
+locale_archive_name
sysheaders
ac_ct_CXX
CXXFLAGS
@@ -763,6 +764,7 @@ with_gd_lib
with_binutils
with_selinux
with_headers
+with_locale_archive_name
with_default_link
with_nonshared_cflags
enable_sanity_checks
@@ -1484,6 +1486,9 @@ Optional Packages:
--with-selinux if building with SELinux support
--with-headers=PATH location of system headers to use (for example
/usr/src/linux/include) [default=compiler default]
+ --with-locale-archive-name=NAME
+ file name of the locale archive
+ [default=locale-archive]
--with-default-link do not use explicit linker scripts
--with-nonshared-cflags=CFLAGS
build nonshared libraries with additional CFLAGS
@@ -3335,6 +3340,20 @@ fi
+# Check whether --with-locale-archive-name was given.
+if test "${with_locale_archive_name+set}" = set; then :
+ withval=$with_locale_archive_name; locale_archive_name=$withval
+else
+ locale_archive_name=locale-archive
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define LOCALE_ARCHIVE_NAME "$locale_archive_name"
+_ACEOF
+
+
+
+
# Check whether --with-default-link was given.
if test "${with_default_link+set}" = set; then :
diff --git a/configure.ac b/configure.ac
index 598ba6c4aed08a3b..1b33559103b65e8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,6 +147,15 @@ AC_ARG_WITH([headers],
[sysheaders=''])
AC_SUBST(sysheaders)
+AC_ARG_WITH([locale-archive-name],
+ AC_HELP_STRING([--with-locale-archive-name=NAME],
+ [file name of the locale archive
+ @<:@default=locale-archive@:>@]),
+ [locale_archive_name=$withval],
+ [locale_archive_name=locale-archive])
+AC_DEFINE_UNQUOTED(LOCALE_ARCHIVE_NAME, "$locale_archive_name")
+AC_SUBST(locale_archive_name)
+
AC_SUBST(use_default_link)
AC_ARG_WITH([default-link],
AC_HELP_STRING([--with-default-link],
diff --git a/locale/loadarchive.c b/locale/loadarchive.c
index 803c1cf2a45838a7..834f794abf6a830c 100644
--- a/locale/loadarchive.c
+++ b/locale/loadarchive.c
@@ -42,7 +42,7 @@
/* Name of the locale archive file. */
-static const char archfname[] = COMPLOCALEDIR "/locale-archive";
+static const char archfname[] = COMPLOCALEDIR "/" LOCALE_ARCHIVE_NAME;
/* Size of initial mapping window, optimal if large enough to
cover the header plus the initial locale. */
diff --git a/locale/programs/locale.c b/locale/programs/locale.c
index 6eae3175bb3cad9a..be8f07b20f100a10 100644
--- a/locale/programs/locale.c
+++ b/locale/programs/locale.c
@@ -46,7 +46,7 @@
#include "../locarchive.h"
#include <programs/xmalloc.h>
-#define ARCHIVE_NAME COMPLOCALEDIR "/locale-archive"
+#define ARCHIVE_NAME COMPLOCALEDIR "/" LOCALE_ARCHIVE_NAME
/* If set print the name of the category. */
static int show_category_name;
diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index e6310b18beee8dd2..02f44f682452de3e 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -57,7 +57,7 @@
extern const char *output_prefix;
-#define ARCHIVE_NAME COMPLOCALEDIR "/locale-archive"
+#define ARCHIVE_NAME COMPLOCALEDIR "/" LOCALE_ARCHIVE_NAME
static const char *locnames[] =
{
diff --git a/manual/install.texi b/manual/install.texi
index 29f6b68e25d04e4b..19e1f9ca161032b1 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -131,6 +131,14 @@ that the objects in @file{libc_nonshared.a} are compiled with this flag
(although this will not affect the generated code in this particular
case and potentially change debugging information and metadata only).
+@item --with-locale-archive-name=@var{name}
+Use @var{name} as the file name of the locale archive, and not the
+default @file{locale-archive}. Usually, the locale archive is stored
+in the directory @file{/usr/lib/locale} (for both 32-bit and 64-bit
+targets). For parallel installation of partially compatible versions
+of @theglibc{}, this option can be used to alter the name of the file
+used by glibc and by the @command{localedef} tool.
+
@c disable static doesn't work currently
@c @item --disable-static
@c Don't build static libraries. Static libraries aren't that useful these

View File

@ -87,7 +87,7 @@
Summary: The GNU libc libraries
Name: glibc
Version: %{glibcversion}
Release: 24%{?dist}
Release: 25%{?dist}
# In general, GPLv2+ is used by programs, LGPLv2+ is used for
# libraries.
@ -160,6 +160,8 @@ Patch28: glibc-rh1615608.patch
# https://www.sourceware.org/ml/libc-alpha/2019-03/msg00436.html
Patch31: glibc-fedora-nscd-warnings.patch
Patch32: glibc-rh1716710.patch
##############################################################################
# Continued list of core "glibc" package information:
##############################################################################
@ -507,6 +509,11 @@ end
# and thus satisfies glibc's requirement for installed locales.
# Users can add one more other langauge packs and then eventually
# uninstall all-langpacks to save space.
#
# Historically, the postun scriptlet of glibc-all-langpacks deleted
# the locale-archive file. Therefore, we tell glibc to use a
# different, release-specific name.
%global locale_archive_name locale-archive.%{version}-%{release}
%package all-langpacks
Summary: All language packs for %{name}.
Requires: %{name} = %{version}-%{release}
@ -828,6 +835,7 @@ build()
--prefix=%{_prefix} \
--with-headers=%{_prefix}/include $EnableKernel \
--with-nonshared-cflags="$BuildFlagsNonshared" \
--with-locale-archive-name="%{locale_archive_name}" \
--enable-bind-now \
--build=%{target} \
--enable-stack-protector=strong \
@ -1031,7 +1039,7 @@ rm -f %{glibc_sysroot}%{_infodir}/libc.info*
%ifnarch %{auxarches}
olddir=`pwd`
pushd %{glibc_sysroot}%{_prefix}/lib/locale
rm -f locale-archive
rm -f %{locale_archive_name}
$olddir/build-%{target}/elf/ld.so \
--library-path $olddir/build-%{target}/ \
$olddir/build-%{target}/locale/localedef \
@ -1924,7 +1932,7 @@ fi
%doc documentation/gai.conf
%files all-langpacks
%attr(0644,root,root) %{_prefix}/lib/locale/locale-archive
%attr(0644,root,root) %{_prefix}/lib/locale/%{locale_archive_name}
%files locale-source
%dir %{_prefix}/share/i18n/locales
@ -1985,6 +1993,9 @@ fi
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog
* Tue Jun 4 2019 Florian Weimer <fweimer@redhat.com> - 2.29.9000-25
- Add glibc version to locale-archive name (#1716710)
* Mon Jun 03 2019 Carlos O'Donell <carlos@redhat.com> - 2.29.9000-24
- Auto-sync with upstream branch master,
commit dc91a19e6f71e1523f4ac179191a29b2131d74bb: