about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/glibc
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-02-26 23:32:33 +0000
committerAlyssa Ross <hi@alyssa.is>2019-02-26 23:32:33 +0000
commit1bf6dffc1145dcf54c2b60d8a72cd384de0ef0b5 (patch)
treecba73be7e3108dca51f75c9ec44a8bd61246b11a /nixpkgs/pkgs/development/libraries/glibc
parentdb8291322dd83add2250dd4480b46298655cbfba (diff)
parent1233c8d9e9bc463899ed6a8cf0232e6bf36475ee (diff)
downloadnixlib-1bf6dffc1145dcf54c2b60d8a72cd384de0ef0b5.tar
nixlib-1bf6dffc1145dcf54c2b60d8a72cd384de0ef0b5.tar.gz
nixlib-1bf6dffc1145dcf54c2b60d8a72cd384de0ef0b5.tar.bz2
nixlib-1bf6dffc1145dcf54c2b60d8a72cd384de0ef0b5.tar.lz
nixlib-1bf6dffc1145dcf54c2b60d8a72cd384de0ef0b5.tar.xz
nixlib-1bf6dffc1145dcf54c2b60d8a72cd384de0ef0b5.tar.zst
nixlib-1bf6dffc1145dcf54c2b60d8a72cd384de0ef0b5.zip
Merge commit '1233c8d9e9bc463899ed6a8cf0232e6bf36475ee'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/glibc')
-rw-r--r--nixpkgs/pkgs/development/libraries/glibc/default.nix23
1 files changed, 22 insertions, 1 deletions
diff --git a/nixpkgs/pkgs/development/libraries/glibc/default.nix b/nixpkgs/pkgs/development/libraries/glibc/default.nix
index e46985d3fca8..561f8d255ce0 100644
--- a/nixpkgs/pkgs/development/libraries/glibc/default.nix
+++ b/nixpkgs/pkgs/development/libraries/glibc/default.nix
@@ -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