3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/libraries/glibc-2.9/locale-override.patch
Eelco Dolstra 2a7ff23a8f * A patch to Glibc to allow the location of locale-archive to be
overriden at runtime (not enabled yet, but it works).  This will
  allow us to build Glibc with no or a minimal set of locales (which
  cuts 70 MB from the installed size of Glibc).  The locales that the
  user actually needs can then be built separately and enabled by
  setting the environment variable LOCALE_ARCHIVE.  For instance, on
  NixOS, we could set it to something like
  /var/run/current-system/locale-archive.  For setuid applications,
  the variable is ignored.

  This is especially useful on 64-bit systems, because there we tend
  to have *two* copies of locale-archive (namely in the 32-bit and
  64-bit builds of Glibc).  Having only one copy allows at least 70 MB
  to be cut from the NixOS installation CD.

svn path=/nixpkgs/branches/stdenv-updates/; revision=15150
2009-04-19 12:57:23 +00:00

73 lines
2.3 KiB
Diff

diff -rc glibc-2.9-20081208-orig/locale/loadarchive.c glibc-2.9-20081208/locale/loadarchive.c
*** glibc-2.9-20081208-orig/locale/loadarchive.c 2005-09-09 18:56:52.000000000 +0200
--- glibc-2.9-20081208/locale/loadarchive.c 2009-04-19 13:54:26.000000000 +0200
***************
*** 124,129 ****
--- 124,142 ----
}
+ static int
+ open_locale_archive ()
+ {
+ int fd = -1;
+ char *path = getenv ("LOCALE_ARCHIVE");
+ if (path)
+ fd = open_not_cancel_2 (path, O_RDONLY|O_LARGEFILE);
+ if (fd < 0)
+ fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
+ return fd;
+ }
+
+
/* Find the locale *NAMEP in the locale archive, and return the
internalized data structure for its CATEGORY data. If this locale has
already been loaded from the archive, just returns the existing data
***************
*** 203,209 ****
archmapped = &headmap;
/* The archive has never been opened. */
! fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
if (fd < 0)
/* Cannot open the archive, for whatever reason. */
return NULL;
--- 216,222 ----
archmapped = &headmap;
/* The archive has never been opened. */
! fd = open_locale_archive ();
if (fd < 0)
/* Cannot open the archive, for whatever reason. */
return NULL;
***************
*** 394,400 ****
if (fd == -1)
{
struct stat64 st;
! fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
if (fd == -1)
/* Cannot open the archive, for whatever reason. */
return NULL;
--- 407,413 ----
if (fd == -1)
{
struct stat64 st;
! fd = open_locale_archive ();
if (fd == -1)
/* Cannot open the archive, for whatever reason. */
return NULL;
diff -rc glibc-2.9-20081208-orig/sysdeps/generic/unsecvars.h glibc-2.9-20081208/sysdeps/generic/unsecvars.h
*** glibc-2.9-20081208-orig/sysdeps/generic/unsecvars.h 2006-10-11 18:24:05.000000000 +0200
--- glibc-2.9-20081208/sysdeps/generic/unsecvars.h 2009-04-19 13:55:34.000000000 +0200
***************
*** 16,21 ****
--- 16,22 ----
"LD_SHOW_AUXV\0" \
"LD_USE_LOAD_BIAS\0" \
"LOCALDOMAIN\0" \
+ "LOCALE_ARCHIVE\0" \
"LOCPATH\0" \
"MALLOC_TRACE\0" \
"NIS_PATH\0" \