mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-03-08 01:24:09 +01:00
edk2: Fix cross-compile
deep-merge env in mkDerivation to preserve GCC5 prefix
The shallow `//` merge in edk2.mkDerivation allowed consumers' `env`
attrs to completely overwrite the base `env` containing GCC5_*_PREFIX,
causing cross-compilation failures (e.g. x86_64 -> aarch64 OVMF) with
`gcc: error: unrecognized command-line option '-mlittle-endian'`.
Exclude `env` from the consumer attrs spread and explicitly deep-merge
it, ensuring GCC5_*_PREFIX is always set as a base while consumer `env`
keys (NIX_CFLAGS_COMPILE, PYTHON_COMMAND, etc.) are merged on top.
Fixes regression from c7b9734f4a ("edk2: move env variable(s) into
env for structuredAttrs").
Signed-off-by: Brian McGillion <bmg.avoin@gmail.com>
This commit is contained in:
parent
1d784f7a68
commit
cdf448de60
1 changed files with 7 additions and 2 deletions
|
|
@ -182,8 +182,6 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
++ attrs.nativeBuildInputs or [ ];
|
||||
strictDeps = true;
|
||||
|
||||
env.${"GCC5_${targetArch}_PREFIX"} = stdenv.cc.targetPrefix;
|
||||
|
||||
prePatch = ''
|
||||
rm -rf BaseTools
|
||||
ln -sv ${buildPackages.edk2}/BaseTools BaseTools
|
||||
|
|
@ -211,7 +209,14 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
// removeAttrs attrs [
|
||||
"nativeBuildInputs"
|
||||
"depsBuildBuild"
|
||||
"env"
|
||||
]
|
||||
// {
|
||||
env = {
|
||||
${"GCC5_${targetArch}_PREFIX"} = stdenv.cc.targetPrefix;
|
||||
}
|
||||
// (attrs.env or { });
|
||||
}
|
||||
);
|
||||
};
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue