Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glibc: use libgcc from pkgsHostHost #259964

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions pkgs/development/libraries/glibc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
, profilingLibraries ? false
, withGd ? false
, withLibcrypt? false
, buildPackages
, libgcc
, pkgsBuildHost
, pkgsHostHost
, libgccHostHost ? pkgsHostHost.libgcc
This conversation was marked as resolved.
Show resolved Hide resolved
}:

let
Expand All @@ -17,7 +18,7 @@ in

(callPackage ./common.nix { inherit stdenv; } {
inherit withLinuxHeaders withGd profilingLibraries withLibcrypt;
pname = "glibc" + lib.optionalString withGd "-gd" + lib.optionalString (stdenv.cc.isGNU && libgcc==null) "-nolibgcc";
pname = "glibc" + lib.optionalString withGd "-gd" + lib.optionalString (stdenv.cc.isGNU && libgccHostHost==null) "-nolibgcc";
This conversation was marked as resolved.
Show resolved Hide resolved
}).overrideAttrs(previousAttrs: {

# Note:
Expand Down Expand Up @@ -91,8 +92,8 @@ in
#
makeFlags =
(previousAttrs.makeFlags or [])
++ lib.optionals (libgcc != null) [
"user-defined-trusted-dirs=${libgcc}/lib"
++ lib.optionals (libgccHostHost != null) [
"user-defined-trusted-dirs=${libgccHostHost}/lib"
];
This conversation was marked as resolved.
Show resolved Hide resolved

postInstall = previousAttrs.postInstall + (if stdenv.hostPlatform == stdenv.buildPlatform then ''
Expand All @@ -101,11 +102,11 @@ in
'' else lib.optionalString stdenv.buildPlatform.isLinux ''
# 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
# we simply use the one from pkgsBuildHost
pushd ../glibc-2*/localedata
export I18NPATH=$PWD GCONV_PATH=$PWD/../iconvdata
mkdir -p $NIX_BUILD_TOP/${buildPackages.glibc}/lib/locale
${lib.getBin buildPackages.glibc}/bin/localedef \
mkdir -p $NIX_BUILD_TOP/${pkgsBuildHost.glibc}/lib/locale
${lib.getBin pkgsBuildHost.glibc}/bin/localedef \
--alias-file=../intl/locale.alias \
-i locales/C \
-f charmaps/UTF-8 \
Expand All @@ -115,7 +116,7 @@ in
else
"--big-endian"} \
C.UTF-8
cp -r $NIX_BUILD_TOP/${buildPackages.glibc}/lib/locale $out/lib
cp -r $NIX_BUILD_TOP/${pkgsBuildHost.glibc}/lib/locale $out/lib
popd
'') + ''

Expand Down Expand Up @@ -167,10 +168,9 @@ in

passthru =
(previousAttrs.passthru or {})
// lib.optionalAttrs (libgcc != null) {
inherit libgcc;
// lib.optionalAttrs (libgccHostHost != null) {
libgcc = libgccHostHost;
This conversation was marked as resolved.
Show resolved Hide resolved
};

meta = (previousAttrs.meta or {}) // { description = "The GNU C Library"; };
})

8 changes: 4 additions & 4 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21787,10 +21787,10 @@ with pkgs;
# Being redundant to avoid cycles on boot. TODO: find a better way
glibcCross = callPackage ../development/libraries/glibc {
stdenv = gccCrossLibcStdenv; # doesn't compile without gcc
libgcc = callPackage ../development/libraries/gcc/libgcc {
gcc = gccCrossLibcStdenv.cc;
glibc = glibcCross.override { libgcc = null; };
stdenvNoLibs = gccCrossLibcStdenv;
libgccHostHost = pkgsHostHost.callPackage ../development/libraries/gcc/libgcc {
gcc = pkgsHostHost.gccCrossLibcStdenv.cc;
glibc = pkgsHostHost.glibcCross.override { libgccHostHost = null; };
stdenvNoLibs = pkgsHostHost.gccCrossLibcStdenv;
This conversation was marked as resolved.
Show resolved Hide resolved
};
};

Expand Down