Sources Bugzilla – Bug 14259
--localedir arg to configure is ignored
Last modified: 2012-12-03 23:57:50 UTC
Created attachment 6453 [details] patch to fix --localedir configure argument For some time, glibc has supported defining the install location of locale data files by providing the --localedir=foo argument to configure. Currently, the argument is ignored and locale data is always stored and searched for in /usr/lib(64)/locale. Previously, there was a check in sysdeps/gnu/configure.in (and the generated file sysdeps/gnu/configure) which tested the $libdir variable in a 64-bit build, and set $libc_cv_localedir only for that case. $libc_cv_localedir should be set in all cases, otherwise the --localedir arg is ignored, and locale data files always end up in /usr/lib(64)/locale A patch is attached which fixes this in the tip of the upstream repository.
Created attachment 6454 [details] patch to fix --localedir configure argument
Etienne, Could you please describe in more detail exactly what was wrong before and what the new behaviour is with your patch? For example if I configure without --localedir, has the behaviour changed? Are the locale files still installed in the same place? Thanks.
Hi Carlos, The explanation is complex due to the nature of the build infrastructure, but here goes: I want to change the location of the locale-archive in the installation. By default it is installed as /usr/lib(64)/locale/locale-archive. I thought I would be able to do this with the --localedir argument to configure. But it turns out that doesn't work. The locale archive is placed in LOCALEDIR/locale-archive, and LOCALEDIR is defined using -D in CFLAGS from a configure variable called $localedir. $localedir is sourced from $libc_cv_localedir in config.make.in:14 On 32-bit builds, $libc_cv_localedir is never set, hence $localedir is always empty and it defaults to ${libdir}/locale (from Makeconfig:222) and can't be changed with --localedir. On 64-bit builds, $libc_cv_localedir is set to ${exec_dir}/lib64/locale (see sysdeps/gnu/configure:20) only if --prefix=/usr is specified, otherwise it is left empty, and $localedir again defaults to ${libdir}/locale. The glibc build infrastructure has some special case scripting for the case where --prefix=/usr, which is where I decided to make the fix. I am not an expert in locales at all, but it seems to me that something is broken if I can't change the location of the locale-archive with --localedir. Does anyone own the locale code?
test ________________________________ From: elesueur at vmware dot com <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sources.redhat.com Sent: Thursday, June 21, 2012 10:14 AM Subject: [Bug build/14259] --localedir arg to configure is ignored http://sourceware.org/bugzilla/show_bug.cgi?id=14259 --- Comment #3 from Etienne Le Sueur <elesueur at vmware dot com> 2012-06-21 04:44:48 UTC --- Hi Carlos, The explanation is complex due to the nature of the build infrastructure, but here goes: I want to change the location of the locale-archive in the installation. By default it is installed as /usr/lib(64)/locale/locale-archive. I thought I would be able to do this with the --localedir argument to configure. But it turns out that doesn't work. The locale archive is placed in LOCALEDIR/locale-archive, and LOCALEDIR is defined using -D in CFLAGS from a configure variable called $localedir. $localedir is sourced from $libc_cv_localedir in config.make.in:14 On 32-bit builds, $libc_cv_localedir is never set, hence $localedir is always empty and it defaults to ${libdir}/locale (from Makeconfig:222) and can't be changed with --localedir. On 64-bit builds, $libc_cv_localedir is set to ${exec_dir}/lib64/locale (see sysdeps/gnu/configure:20) only if --prefix=/usr is specified, otherwise it is left empty, and $localedir again defaults to ${libdir}/locale. The glibc build infrastructure has some special case scripting for the case where --prefix=/usr, which is where I decided to make the fix. I am not an expert in locales at all, but it seems to me that something is broken if I can't change the location of the locale-archive with --localedir. Does anyone own the locale code?
(In reply to comment #3) > Hi Carlos, > > The explanation is complex due to the nature of the build infrastructure, but > here goes: > > I want to change the location of the locale-archive in the installation. By > default it is installed as /usr/lib(64)/locale/locale-archive. I thought I > would be able to do this with the --localedir argument to configure. But it > turns out that doesn't work. > > The locale archive is placed in LOCALEDIR/locale-archive, and LOCALEDIR is > defined using -D in CFLAGS from a configure variable called $localedir. > $localedir is sourced from $libc_cv_localedir in config.make.in:14 > > On 32-bit builds, $libc_cv_localedir is never set, hence $localedir is always > empty and it defaults to ${libdir}/locale (from Makeconfig:222) and can't be > changed with --localedir. > > On 64-bit builds, $libc_cv_localedir is set to ${exec_dir}/lib64/locale (see > sysdeps/gnu/configure:20) only if --prefix=/usr is specified, otherwise it is > left empty, and $localedir again defaults to ${libdir}/locale. > > The glibc build infrastructure has some special case scripting for the case > where --prefix=/usr, which is where I decided to make the fix. > > I am not an expert in locales at all, but it seems to me that something is > broken if I can't change the location of the locale-archive with --localedir. > > Does anyone own the locale code? The development community owns the code, we all need to step up to maintain the code. Petr Baudis is our locale expert, but that doesn't mean he owns the locale configuration code. Your explanation here is perfect, it's exactly the explanation I was expecting in the *initial* submission of the ticket. You explain what you need and why, and what's wrong with the current code. The target milestone is already set for 2.17, we are in the 2.16 code freeze right now. Once we are out of the code freeze we'll start looking at the 2.17 issues. Your patch is a good starting place. Next steps: * Wait for the 2.16 freeze to thaw. * Work with the maintainers to get your patch checked in. In the meantime I suggest reviewing: http://sourceware.org/glibc/wiki/Contribution%20checklist Note: Your patch is not legally significant since it's a simple 2 line change. However, if you wish to continue contributing to the project we will need a copyright assignment in place.
Comment on attachment 6454 [details] patch to fix --localedir configure argument You seem to change the behaviour. With your change I get on i686 via config.make (without specifying --localedir) datarootdir = ${prefix}/share localedir = ${datarootdir}/locale Previously localedir was unset and thus Makeconfig set it to: localedir = $(libdir)/locale So, now it's /usr/share/locale and previously it was /usr/lib/locale. This change is not acceptable. Let me work on a better patch.
--localedir specifies the location of the gettext message files. It is _not_ meant for the locale data files. If localedir should be configurable, it needs a new option.
Waiting for updated patch from contributor that creates a new configuration option to set the locale data file directory.