mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
glibc: fix cross-build
glibc's buildsystem uses its own executables to generate locales. This does not work for cross-compilation so instead we use localedef from buildPackages.
This commit is contained in:
parent
aa88d65e28
commit
ff1b945851
1 changed files with 22 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
|||
, withLinuxHeaders ? true
|
||||
, profilingLibraries ? false
|
||||
, withGd ? false
|
||||
, buildPackages
|
||||
}:
|
||||
|
||||
callPackage ./common.nix { inherit stdenv; } {
|
||||
|
@ -55,9 +56,29 @@ callPackage ./common.nix { inherit stdenv; } {
|
|||
fi
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
postInstall = (if stdenv.hostPlatform == stdenv.buildPlatform then ''
|
||||
echo SUPPORTED-LOCALES=C.UTF-8/UTF-8 > ../glibc-2*/localedata/SUPPORTED
|
||||
make -j''${NIX_BUILD_CORES:-1} -l''${NIX_BUILD_CORES:-1} localedata/install-locales
|
||||
'' else ''
|
||||
# This is based on http://www.linuxfromscratch.org/lfs/view/development/chapter06/glibc.html
|
||||
# Instead of using their patch to build a build-native localedef,
|
||||
# we simply use the one from buildPackages
|
||||
pushd ../glibc-2*/localedata
|
||||
export I18NPATH=$PWD GCONV_PATH=$PWD/../iconvdata
|
||||
mkdir -p $NIX_BUILD_TOP/${buildPackages.glibc}/lib/locale
|
||||
${stdenv.lib.getBin buildPackages.glibc}/bin/localedef \
|
||||
--alias-file=../intl/locale.alias \
|
||||
-i locales/C \
|
||||
-f charmaps/UTF-8 \
|
||||
--prefix $NIX_BUILD_TOP \
|
||||
${if stdenv.hostPlatform.parsed.cpu.significantByte.name == "littleEndian" then
|
||||
"--little-endian"
|
||||
else
|
||||
"--big-endian"} \
|
||||
C.UTF-8
|
||||
cp -r $NIX_BUILD_TOP/${buildPackages.glibc}/lib/locale $out/lib
|
||||
popd
|
||||
'') + ''
|
||||
|
||||
test -f $out/etc/ld.so.cache && rm $out/etc/ld.so.cache
|
||||
|
||||
|
|
Loading…
Reference in a new issue