glibcLocales: follow host platform endianness

This commit is contained in:
Minijackson 2022-08-26 11:23:10 +02:00
parent bb97e96c23
commit 81c37edce4
No known key found for this signature in database
GPG key ID: FEA888C9F5D64F62

View file

@ -19,19 +19,26 @@ callPackage ./common.nix { inherit stdenv; } {
extraNativeBuildInputs = [ glibc ];
# 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 =
''
LOCALEDEF_FLAGS = [
(if stdenv.hostPlatform.isLittleEndian
then "--little-endian"
else "--big-endian")
];
buildPhase = ''
# 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.
LOCALEDEF_FLAGS+=" --prefix=$TMPDIR"
mkdir -p $TMPDIR/"${buildPackages.glibc.out}/lib/locale"
echo 'C.UTF-8/UTF-8 \' >> ../glibc-2*/localedata/SUPPORTED
# Hack to allow building of the locales (needed since glibc-2.12)
sed -i -e 's,^$(rtld-prefix) $(common-objpfx)locale/localedef,localedef --prefix='$TMPDIR',' ../glibc-2*/localedata/Makefile
sed -i -e 's,^$(rtld-prefix) $(common-objpfx)locale/localedef,localedef $(LOCALEDEF_FLAGS),' ../glibc-2*/localedata/Makefile
''
+ lib.optionalString (!allLocales) ''
# Check that all locales to be built are supported