glibc: Fix for cross
This commit is contained in:
parent
df91297181
commit
7e096024d7
|
@ -4,17 +4,20 @@
|
||||||
cross:
|
cross:
|
||||||
|
|
||||||
{ name, fetchurl, lib, stdenv, installLocales ? false
|
{ name, fetchurl, lib, stdenv, installLocales ? false
|
||||||
, gccCross ? null, linuxHeaders ? null
|
, linuxHeaders ? null
|
||||||
, profilingLibraries ? false, meta
|
, profilingLibraries ? false, meta
|
||||||
, withGd ? false, gd ? null, libpng ? null
|
, withGd ? false, gd ? null, libpng ? null
|
||||||
, preConfigure ? "", ... }@args:
|
, preConfigure ? ""
|
||||||
|
, buildPackages ? {}
|
||||||
|
, ...
|
||||||
|
} @ args:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "2.25";
|
version = "2.25";
|
||||||
sha256 = "067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0";
|
sha256 = "067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0";
|
||||||
in
|
in
|
||||||
|
|
||||||
assert cross != null -> gccCross != null;
|
assert cross != null -> buildPackages.stdenv ? cc;
|
||||||
|
|
||||||
stdenv.mkDerivation ({
|
stdenv.mkDerivation ({
|
||||||
inherit linuxHeaders installLocales;
|
inherit linuxHeaders installLocales;
|
||||||
|
@ -113,8 +116,8 @@ stdenv.mkDerivation ({
|
||||||
|
|
||||||
outputs = [ "out" "bin" "dev" "static" ];
|
outputs = [ "out" "bin" "dev" "static" ];
|
||||||
|
|
||||||
buildInputs = lib.optionals (cross != null) [ gccCross ]
|
nativeBuildInputs = lib.optional (cross != null) buildPackages.stdenv.cc;
|
||||||
++ lib.optionals withGd [ gd libpng ];
|
buildInputs = lib.optionals withGd [ gd libpng ];
|
||||||
|
|
||||||
# Needed to install share/zoneinfo/zone.tab. Set to impure /bin/sh to
|
# 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
|
# prevent a retained dependency on the bootstrap tools in the stdenv-linux
|
||||||
|
@ -122,9 +125,7 @@ stdenv.mkDerivation ({
|
||||||
BASH_SHELL = "/bin/sh";
|
BASH_SHELL = "/bin/sh";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove the `gccCross' attribute so that the *native* glibc store path
|
// (removeAttrs args [ "lib" "buildPackages" "fetchurl" "withGd" "gd" "libpng" ]) //
|
||||||
# doesn't depend on whether `gccCross' is null or not.
|
|
||||||
// (removeAttrs args [ "lib" "gccCross" "fetchurl" "withGd" "gd" "libpng" ]) //
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name = name + "-${version}" +
|
name = name + "-${version}" +
|
||||||
|
|
|
@ -1,21 +1,23 @@
|
||||||
{ lib, stdenv, fetchurl, linuxHeaders
|
{ lib, stdenv, fetchurl
|
||||||
, installLocales ? true
|
, installLocales ? true
|
||||||
, profilingLibraries ? false
|
, profilingLibraries ? false
|
||||||
, gccCross ? null
|
|
||||||
, withGd ? false, gd ? null, libpng ? null
|
, withGd ? false, gd ? null, libpng ? null
|
||||||
|
, buildPlatform, hostPlatform
|
||||||
|
, buildPackages
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert stdenv.cc.isGNU;
|
assert stdenv.cc.isGNU;
|
||||||
|
|
||||||
let
|
let
|
||||||
build = import ./common.nix;
|
build = import ./common.nix;
|
||||||
cross = if gccCross != null then gccCross.target else null;
|
cross = if buildPlatform != hostPlatform then hostPlatform else null;
|
||||||
|
inherit (buildPackages) linuxHeaders;
|
||||||
in
|
in
|
||||||
build cross ({
|
build cross ({
|
||||||
name = "glibc" + lib.optionalString withGd "-gd";
|
name = "glibc" + lib.optionalString withGd "-gd";
|
||||||
|
|
||||||
inherit lib stdenv fetchurl linuxHeaders installLocales
|
inherit lib stdenv buildPackages fetchurl linuxHeaders installLocales
|
||||||
profilingLibraries gccCross withGd gd libpng;
|
profilingLibraries withGd gd libpng;
|
||||||
|
|
||||||
NIX_NO_SELF_RPATH = true;
|
NIX_NO_SELF_RPATH = true;
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ let
|
||||||
|
|
||||||
pkgs = pkgsFun ({inherit system;} // selectedCrossSystem);
|
pkgs = pkgsFun ({inherit system;} // selectedCrossSystem);
|
||||||
|
|
||||||
glibc = pkgs.buildPackages.libcCross;
|
glibc = pkgs.libcCross;
|
||||||
bash = pkgs.bash;
|
bash = pkgs.bash;
|
||||||
findutils = pkgs.findutils;
|
findutils = pkgs.findutils;
|
||||||
diffutils = pkgs.diffutils;
|
diffutils = pkgs.diffutils;
|
||||||
|
|
|
@ -7700,7 +7700,6 @@ with pkgs;
|
||||||
|
|
||||||
glibc = callPackage ../development/libraries/glibc {
|
glibc = callPackage ../development/libraries/glibc {
|
||||||
installLocales = config.glibc.locales or false;
|
installLocales = config.glibc.locales or false;
|
||||||
gccCross = null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
glibc_memusage = callPackage ../development/libraries/glibc {
|
glibc_memusage = callPackage ../development/libraries/glibc {
|
||||||
|
@ -7708,13 +7707,23 @@ with pkgs;
|
||||||
withGd = true;
|
withGd = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
glibcCross = forcedNativePackages.glibc.override {
|
# Being redundant to avoid cycles on boot. TODO: find a better way
|
||||||
gccCross = gccCrossStageStatic;
|
glibcCross = callPackage ../development/libraries/glibc {
|
||||||
inherit (forcedNativePackages) linuxHeaders;
|
installLocales = config.glibc.locales or false;
|
||||||
|
# Can't just overrideCC, because then the stdenv-cross mkDerivation will be
|
||||||
|
# thrown away. TODO: find a better solution for this.
|
||||||
|
stdenv = buildPackages.makeStdenvCross
|
||||||
|
buildPackages.buildPackages.stdenv
|
||||||
|
buildPackages.targetPlatform
|
||||||
|
buildPackages.binutils
|
||||||
|
buildPackages.gccCrossStageStatic;
|
||||||
};
|
};
|
||||||
|
|
||||||
# We can choose:
|
# We can choose:
|
||||||
libcCrossChooser = name: if name == "glibc" then glibcCross
|
libcCrossChooser = name:
|
||||||
|
# libc is hackily often used from the previous stage. This `or`
|
||||||
|
# hack fixes the hack, *sigh*.
|
||||||
|
/**/ if name == "glibc" then __targetPackages.glibcCross or glibcCross
|
||||||
else if name == "uclibc" then uclibcCross
|
else if name == "uclibc" then uclibcCross
|
||||||
else if name == "msvcrt" then windows.mingw_w64
|
else if name == "msvcrt" then windows.mingw_w64
|
||||||
else if name == "libSystem" then darwin.xcode
|
else if name == "libSystem" then darwin.xcode
|
||||||
|
|
Loading…
Reference in New Issue