summary refs log tree commit diff
path: root/pkgs/development/libraries/glibc-2.9
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2009-04-19 15:28:37 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2009-04-19 15:28:37 +0000
commit40f01daa819a05b956cdca0b0abdfa9f07c9e327 (patch)
treeb0375480b5d97863f9982310b3ab837c97baf829 /pkgs/development/libraries/glibc-2.9
parent2a7ff23a8fb7079458d1cc4e079512254dd57b7a (diff)
* A function to build Glibc's locale-archive separately from Glibc.
svn path=/nixpkgs/branches/stdenv-updates/; revision=15155
Diffstat (limited to 'pkgs/development/libraries/glibc-2.9')
-rw-r--r--pkgs/development/libraries/glibc-2.9/default.nix3
-rw-r--r--pkgs/development/libraries/glibc-2.9/locales.nix47
2 files changed, 50 insertions, 0 deletions
diff --git a/pkgs/development/libraries/glibc-2.9/default.nix b/pkgs/development/libraries/glibc-2.9/default.nix
index a5469dc8a6f28..b5b030f7696f2 100644
--- a/pkgs/development/libraries/glibc-2.9/default.nix
+++ b/pkgs/development/libraries/glibc-2.9/default.nix
@@ -40,6 +40,9 @@ stdenv.mkDerivation rec {
        does work because "status" will contain UNAVAIL after the
        failure to find mdns4_minimal. */
     ./nss-skip-unavail.patch
+
+    /* Make it possible to override the locale-archive in NixOS. */
+    # ./locale-override.patch
   ];
 
   # `--with-tls --without-__thread' enables support for TLS but causes
diff --git a/pkgs/development/libraries/glibc-2.9/locales.nix b/pkgs/development/libraries/glibc-2.9/locales.nix
new file mode 100644
index 0000000000000..a5ef4797810bd
--- /dev/null
+++ b/pkgs/development/libraries/glibc-2.9/locales.nix
@@ -0,0 +1,47 @@
+/* This function builds just the `lib/locale/locale-archive' file from
+   Glibc and nothing else.  If `allLocales' is true, all supported
+   locales are included; otherwise, just the locales listed in
+   `locales'.  See localedata/SUPPORTED in the Glibc source tree for
+   the list of all supported locales:
+   http://sourceware.org/cgi-bin/cvsweb.cgi/libc/localedata/SUPPORTED?cvsroot=glibc
+*/
+
+{ stdenv, fetchurl, allLocales ? true, locales ? ["en_US.UTF-8/UTF-8"] }:
+
+stdenv.mkDerivation rec {
+  name = "glibc-locales-2.9";
+  
+  src = fetchurl {
+    url = http://nixos.org/tarballs/glibc-2.9-20081208.tar.bz2;
+    sha256 = "0zhxbgcsl97pf349m0lz8d5ljvvzrcqc23yf08d888xlk4ms8m3h";
+  };
+
+  configurePhase = "true";
+
+  # Awful hack: `localedef' doesn't allow the path to `locale-archive'
+  # to be overriden, but you *can* specify a prefix, i.e. it will use
+  # <prefix>/<path-to-glibc>/lib/locale/locale-archive.  So we use
+  # $TMPDIR as a prefix, meaning that the locale-archive is placed in
+  # $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive.
+  buildPhase =
+    ''
+      touch config.make
+      touch config.status
+      mkdir -p $TMPDIR/"$(dirname $(readlink -f $(type -p localedef)))/../lib/locale"
+      make localedata/install-locales \
+          LOCALEDEF="localedef --prefix=$TMPDIR" \
+          localedir=$out/lib/locale \
+          ${if allLocales then "" else "SUPPORTED-LOCALES=\"${toString locales}\""}
+    '';
+
+  installPhase =
+    ''
+      ensureDir $out/lib/locale
+      cp $TMPDIR/nix/store/*/lib/locale/locale-archive $out/lib/locale/
+    '';
+
+  meta = {
+    homepage = http://www.gnu.org/software/libc/;
+    description = "Locale information for the GNU C Library";
+  };
+}