2009-11-20 00:28:45 +01:00
|
|
|
/* 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"] }:
|
|
|
|
|
2009-11-22 17:03:56 +01:00
|
|
|
let build = import ./common.nix;
|
|
|
|
in
|
2009-12-01 22:44:41 +01:00
|
|
|
build null {
|
2009-11-22 17:03:56 +01:00
|
|
|
name = "glibc-locales";
|
|
|
|
|
|
|
|
inherit fetchurl stdenv;
|
|
|
|
installLocales = true;
|
|
|
|
|
2010-01-18 11:50:32 +01:00
|
|
|
builder = ./locales-builder.sh;
|
2009-11-22 17:03:56 +01:00
|
|
|
|
|
|
|
# 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 =
|
|
|
|
''
|
|
|
|
mkdir -p $TMPDIR/"$(dirname $(readlink -f $(type -p localedef)))/../lib/locale"
|
2010-08-23 19:36:51 +02:00
|
|
|
|
|
|
|
# Hack to allow building of the locales (needed since glibc-2.12)
|
2010-10-12 22:41:40 +02:00
|
|
|
sed -i -e "s,^LOCALEDEF=.*,LOCALEDEF=localedef --prefix=$TMPDIR," -e \
|
|
|
|
/library-path/d ../glibc-2*/localedata/Makefile
|
|
|
|
${if allLocales then "" else
|
|
|
|
"echo SUPPORTED-LOCALES=\"${toString locales}\" > ../glibc-2*/localedata/SUPPORTED"}
|
2010-08-23 19:36:51 +02:00
|
|
|
|
2009-11-22 17:03:56 +01:00
|
|
|
make localedata/install-locales \
|
|
|
|
localedir=$out/lib/locale \
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase =
|
|
|
|
''
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p "$out/lib/locale"
|
2009-11-22 17:03:56 +01:00
|
|
|
cp -v "$TMPDIR/nix/store/"*"/lib/locale/locale-archive" "$out/lib/locale"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta.description = "Locale information for the GNU C Library";
|
|
|
|
}
|