diff --git a/pkgs/development/libraries/glibc-2.11/common.nix b/pkgs/development/libraries/glibc-2.11/common.nix index fcdccd90f2e..cdd968b4582 100644 --- a/pkgs/development/libraries/glibc-2.11/common.nix +++ b/pkgs/development/libraries/glibc-2.11/common.nix @@ -5,6 +5,7 @@ cross : { name, fetchurl, stdenv, installLocales ? false , gccCross ? null, kernelHeaders ? null +, machHeaders ? null, hurdHeaders ? null, mig ? null , profilingLibraries ? false, meta , preConfigure ? "", ... }@args : @@ -77,7 +78,8 @@ stdenv.mkDerivation ({ "--without-fp" ]; - buildInputs = stdenv.lib.optionals (cross != null) [ gccCross ]; + buildInputs = stdenv.lib.optionals (cross != null) [ gccCross ] + ++ stdenv.lib.optional (mig != null) mig; # Needed to install share/zoneinfo/zone.tab. Set to impure /bin/sh to # prevent a retained dependency on the bootstrap tools in the stdenv-linux @@ -149,4 +151,15 @@ stdenv.mkDerivation ({ maintainers = [ stdenv.lib.maintainers.ludo ]; platforms = stdenv.lib.platforms.linux; } // meta; -}) +} + +// + +(if (cross != null && cross.config == "i586-pc-gnu") + then { + # Work around the fact that the configure snippet that looks for + # does not honor `--with-headers=$sysheaders' and that + # glibc expects both Mach and Hurd headers to be in the same place. + CPATH = "${hurdHeaders}/include:${machHeaders}/include"; + } + else { })) diff --git a/pkgs/development/libraries/glibc-2.11/default.nix b/pkgs/development/libraries/glibc-2.11/default.nix index 32c37aaac34..9bbc7740896 100644 --- a/pkgs/development/libraries/glibc-2.11/default.nix +++ b/pkgs/development/libraries/glibc-2.11/default.nix @@ -1,10 +1,14 @@ { stdenv, fetchurl, kernelHeaders +, machHeaders ? null, hurdHeaders ? null , installLocales ? true , profilingLibraries ? false , gccCross ? null +, mig ? null }: assert stdenv.gcc.gcc != null; +assert (mig != null) -> (machHeaders != null); +assert (machHeaders != null) -> (hurdHeaders != null); let build = import ./common.nix; @@ -37,6 +41,12 @@ in // + (if hurdHeaders != null + then { inherit machHeaders hurdHeaders mig; } + else { }) + + // + (if cross != null then { preConfigure = '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2f4534d42f0..0d4d5a898ec 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3901,12 +3901,20 @@ let installLocales = getPkgConfig "glibc" "locales" false; }; - glibc211Cross = forceBuildDrv (makeOverridable (import ../development/libraries/glibc-2.11) { - inherit stdenv fetchurl; - gccCross = gccCrossStageStatic; - kernelHeaders = linuxHeadersCross; - installLocales = getPkgConfig "glibc" "locales" false; - }); + glibc211Cross = forceBuildDrv (makeOverridable (import ../development/libraries/glibc-2.11) + (let crossGNU = (crossSystem.config == "i586-pc-gnu"); + in ({ + inherit stdenv fetchurl; + gccCross = gccCrossStageStatic; + kernelHeaders = if crossGNU then hurdHeaders else linuxHeadersCross; + installLocales = getPkgConfig "glibc" "locales" false; + } + + // + + (if crossGNU + then { inherit machHeaders hurdHeaders; mig = migCross; } + else { })))); glibcCross = glibc211Cross;