From patchwork Tue Jun 4 13:40:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1109922 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-102429-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="oGf+DM1B"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45JCkC5tnhz9s3Z for ; Tue, 4 Jun 2019 23:41:07 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=WW/VfgW8xx7wtOxanQ+YXJD7js/Y5 9UugDJGD6Ykyzgay3EeQo9E33XkSVE6f+1dh15MRPPbdCTnjTKOQzsvXLRT7UFxv hLulwVCqztPHRuCNrgLe3Xk3Sv40CA/OTofNTwO6uuHIcgopuESLCWzEYiWM6q4z FSDKzIjLpa8Ls0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; s=default; bh=zy3cxx7W2semajuyjZqR7PR3oXc=; b=oGf +DM1BAm1rGrjB6JpqKlckWkD4WJcongjOa46J+qsXsPRXQNMfnYb4UUlW6PqSOXv 4ftPytlEGamEtNkSwZ8d9Q5jBR2SwJfxFUVariqXgbeXIMzCKfD40KiFXPUhxUF+ 3tp92C2kRcHLD2/TOpcA61eAb62c0YS+cKiPavho= Received: (qmail 122237 invoked by alias); 4 Jun 2019 13:40:52 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 122186 invoked by uid 89); 4 Jun 2019 13:40:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=Configuring X-HELO: mx1.redhat.com From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH] locale: Make the file name of the locale archive configurable Date: Tue, 04 Jun 2019 15:40:45 +0200 Message-ID: <87k1e131uq.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 This improves support for parallel installation and upgrade scenarios involving changes to the locale archive format or the data stored in it. 2019-06-04 Florian Weimer * configure.ac: Handle --locale-archive-name. (LOCALE_ARCHIVE_NAME): Define. (locale_archive_name): Substitute. * config.h.in (LOCALE_ARCHIVE_NAME): Undefine. * config.make.in (locale-archive-name): Define. * locale/loadarchive.c (archfname): Use LOCALE_ARCHIVE_NAME. * locale/programs/locale.c (ARCHIVE_NAME): Likewise. * locale/programs/locarchive.c (ARCHIVE_NAME): Likewise. * manual/install.texi (Configuring and compiling): Document --with-locale-archive-name. * configure, INSTALL: Regenerate. diff --git a/INSTALL b/INSTALL index e137a71169..0244b0aa96 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 824dfe8d8c..7d263447ed 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 2fed3da773..a6421039eb 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 c773c487b5..0d9645c389 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 598ba6c4ae..1b33559103 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 803c1cf2a4..834f794abf 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 6eae3175bb..be8f07b20f 100644 --- a/locale/programs/locale.c +++ b/locale/programs/locale.c @@ -46,7 +46,7 @@ #include "../locarchive.h" #include -#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 e6310b18be..02f44f6824 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 29f6b68e25..19e1f9ca16 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