mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
Trying to move all stdenv cross-compiling details out of the stdenv expression,
into a stdenv adapater. svn path=/nixpkgs/branches/stdenv-updates/; revision=18397
This commit is contained in:
parent
2c7fa189fb
commit
0c631f6181
@ -30,4 +30,8 @@ stdenv.mkDerivation {
|
||||
meta = if gcc != null then gcc.meta else
|
||||
{ description = "System C compiler wrapper";
|
||||
};
|
||||
|
||||
passthru = {
|
||||
inherit cross;
|
||||
};
|
||||
}
|
||||
|
@ -23,3 +23,6 @@ fi
|
||||
if test -n "@glibc@"; then
|
||||
PATH=$PATH:@glibc@/bin
|
||||
fi
|
||||
|
||||
configureFlags="$configureFlags --build=$system --host=$crossConfig"
|
||||
dontStrip=1
|
||||
|
@ -107,6 +107,18 @@ rec {
|
||||
isStatic = true;
|
||||
} // {inherit fetchurl;};
|
||||
|
||||
# Return a modified stdenv that adds a cross compiler to the
|
||||
# builds.
|
||||
makeStdenvCross = stdenv: binutilsCross : gccCross: stdenv //
|
||||
{ mkDerivation = args: stdenv.mkDerivation (args // {
|
||||
|
||||
buildInputs =
|
||||
(if args ? buildInputs then args.buildInputs else [])
|
||||
++ [ gccCross binutilsCross ];
|
||||
|
||||
crossConfig = gccCross.cross.config;
|
||||
});
|
||||
};
|
||||
|
||||
/* Modify a stdenv so that the specified attributes are added to
|
||||
every derivation returned by its mkDerivation function.
|
||||
|
@ -10,7 +10,7 @@
|
||||
# system, e.g., cygwin and mingw builds on i686-cygwin. Most people
|
||||
# can ignore it.
|
||||
|
||||
{system, stdenvType ? system, allPackages ? import ../.., cross ? null}:
|
||||
{system, stdenvType ? system, allPackages ? import ../..}:
|
||||
|
||||
assert system != "i686-cygwin" -> system == stdenvType;
|
||||
|
||||
@ -41,7 +41,7 @@ rec {
|
||||
|
||||
|
||||
# Linux standard environment.
|
||||
stdenvLinux = (import ./linux {inherit system allPackages cross;}).stdenvLinux;
|
||||
stdenvLinux = (import ./linux {inherit system allPackages;}).stdenvLinux;
|
||||
|
||||
|
||||
# MinGW/MSYS standard environment.
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ system, name, preHook ? null, postHook ? null, initialPath, gcc, shell
|
||||
, cross ? null
|
||||
, param1 ? "", param2 ? "", param3 ? "", param4 ? "", param5 ? ""
|
||||
, extraAttrs ? {}
|
||||
|
||||
@ -53,9 +52,6 @@ let
|
||||
["-e" (if attrs ? builder then attrs.builder else ./default-builder.sh)];
|
||||
stdenv = result;
|
||||
system = result.system;
|
||||
# The env variable 'cross' is used in all the crosscompiler
|
||||
# bootstrapping in another sense
|
||||
crossTarget = if (cross != null) then cross.config else null;
|
||||
})
|
||||
)
|
||||
# The meta attribute is passed in the resulting attribute set,
|
||||
|
@ -5,8 +5,7 @@
|
||||
# ensuring purity of components produced by it.
|
||||
|
||||
# The function defaults are for easy testing.
|
||||
{system ? "i686-linux", allPackages ? import ../../top-level/all-packages.nix,
|
||||
cross ? null}:
|
||||
{system ? "i686-linux", allPackages ? import ../../top-level/all-packages.nix}:
|
||||
|
||||
rec {
|
||||
|
||||
@ -205,26 +204,15 @@ rec {
|
||||
# When updating stdenvLinux, make sure that the result has no
|
||||
# dependency (`nix-store -qR') on bootstrapTools.
|
||||
stdenvLinux = import ../generic {
|
||||
name = "stdenv-linux" +
|
||||
stdenvLinuxBoot3Pkgs.lib.optionalString (cross != null) "-${cross.config}";
|
||||
name = "stdenv-linux";
|
||||
|
||||
inherit system cross;
|
||||
inherit system;
|
||||
|
||||
preHook = builtins.toFile "prehook.sh" commonPreHook;
|
||||
|
||||
initialPath =
|
||||
((import ../common-path.nix) {pkgs = stdenvLinuxBoot3Pkgs;})
|
||||
++ [stdenvLinuxBoot3Pkgs.patchelf]
|
||||
++ stdenvLinuxBoot3Pkgs.lib.optionals (cross != null)
|
||||
[ (stdenvLinuxBoot3Pkgs.binutilsCross cross)
|
||||
(stdenvLinuxBoot3Pkgs.gccCrossStageFinal cross) ];
|
||||
|
||||
postHook = if (cross != null) then
|
||||
(builtins.toFile "cross-posthook.sh" ''
|
||||
configureFlags="$configureFlags --build=${system} --host=${cross.config}"
|
||||
dontStrip=1
|
||||
'')
|
||||
else null;
|
||||
++ [stdenvLinuxBoot3Pkgs.patchelf];
|
||||
|
||||
gcc = wrapGCC rec {
|
||||
inherit (stdenvLinuxBoot2Pkgs) binutils;
|
||||
|
@ -213,15 +213,8 @@ let
|
||||
allPackages = args: import ./all-packages.nix ({ inherit config; } // args);
|
||||
};
|
||||
|
||||
allStdenvsCross = cross : import ../stdenv {
|
||||
inherit system stdenvType cross;
|
||||
allPackages = args: import ./all-packages.nix ({ inherit config; } // args);
|
||||
};
|
||||
|
||||
defaultStdenv = allStdenvs.stdenv;
|
||||
|
||||
stdenvCross = cross : (allStdenvsCross cross).stdenv;
|
||||
|
||||
stdenv =
|
||||
if bootStdenv != null then bootStdenv else
|
||||
let changer = getConfig ["replaceStdenv"] null;
|
||||
@ -244,7 +237,10 @@ let
|
||||
inherit (import ../stdenv/adapters.nix {inherit (pkgs) dietlibc fetchurl runCommand;})
|
||||
overrideGCC overrideInStdenv overrideSetup
|
||||
useDietLibC useKlibc makeStaticBinaries addAttrsToDerivation
|
||||
keepBuildTree cleanupBuildTree addCoverageInstrumentation;
|
||||
keepBuildTree cleanupBuildTree addCoverageInstrumentation makeStdenvCross;
|
||||
|
||||
stdenvCross = cross : makeStdenvCross stdenv (binutilsCross cross)
|
||||
(gccCrossStageFinal cross);
|
||||
|
||||
|
||||
### BUILD SUPPORT
|
||||
|
Loading…
Reference in New Issue
Block a user