mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-11 04:02:55 +03:00
top-level: Make cross compiling slightly saner
Removes the weird stdenv cycle used to match the old infrastructure. It turns out that matching it so precisely is not needed.
This commit is contained in:
parent
645e2b55e5
commit
f68e16f023
@ -8,24 +8,22 @@ rec {
|
||||
};
|
||||
vanillaStdenv = (import ../. (args // argClobber // {
|
||||
allPackages = args: allPackages (argClobber // args);
|
||||
})).stdenv;
|
||||
})).stdenv // {
|
||||
# Needed elsewhere as a hacky way to pass the target
|
||||
cross = crossSystem;
|
||||
};
|
||||
|
||||
# Yeah this isn't so cleanly just build-time packages yet. Notice the
|
||||
# buildPackages <-> stdenvCross cycle. Yup, it's very weird.
|
||||
#
|
||||
# This works because the derivation used to build `stdenvCross` are in
|
||||
# fact using `forceNativeDrv` to use the `nativeDrv` attribute of the resulting
|
||||
# derivation built with `vanillaStdenv` (second argument of `makeStdenvCross`).
|
||||
#
|
||||
# Eventually, `forceNativeDrv` should be removed and the cycle broken.
|
||||
# For now, this is just used to build the native stdenv. Eventually, it should
|
||||
# be used to build compilers and other such tools targeting the cross
|
||||
# platform. Then, `forceNativeDrv` can be removed.
|
||||
buildPackages = allPackages {
|
||||
# It's OK to change the built-time dependencies
|
||||
allowCustomOverrides = true;
|
||||
bootStdenv = stdenvCross;
|
||||
bootStdenv = vanillaStdenv;
|
||||
inherit system platform crossSystem config;
|
||||
};
|
||||
|
||||
stdenvCross = buildPackages.makeStdenvCross
|
||||
vanillaStdenv crossSystem
|
||||
buildPackages.stdenv crossSystem
|
||||
buildPackages.binutilsCross buildPackages.gccCrossStageFinal;
|
||||
}
|
||||
|
@ -46,10 +46,13 @@ in
|
||||
|
||||
callPackage_i686 = lib.callPackageWith (pkgsi686Linux // pkgsi686Linux.xorg);
|
||||
|
||||
forceNativeDrv = drv : if crossSystem == null then drv else
|
||||
(drv // { crossDrv = drv.nativeDrv; });
|
||||
|
||||
stdenvCross = lowPrio (makeStdenvCross defaultStdenv crossSystem binutilsCross gccCrossStageFinal);
|
||||
forceNativeDrv = drv:
|
||||
# Even when cross compiling, some packages come from the stdenv's
|
||||
# bootstrapping package set. Those packages are only built for the native
|
||||
# platform.
|
||||
if crossSystem != null && drv ? crossDrv
|
||||
then drv // { crossDrv = drv.nativeDrv; }
|
||||
else drv;
|
||||
|
||||
# A stdenv capable of building 32-bit binaries. On x86_64-linux,
|
||||
# it uses GCC compiled with multilib support; on i686-linux, it's
|
||||
|
Loading…
Reference in New Issue
Block a user