edk2/OVMF: Determine build type from CC setting

This commit is contained in:
Markus Partheymüller 2020-04-20 13:30:35 +02:00
parent fe8afcb993
commit 94d114dc2a
2 changed files with 9 additions and 8 deletions

View File

@ -17,13 +17,9 @@ let
throw "Unsupported architecture";
version = lib.getVersion edk2;
buildType = if stdenv.isDarwin then
"CLANGPDB"
else
"GCC5";
in
edk2.mkDerivation projectDscPath buildType {
edk2.mkDerivation projectDscPath {
name = "OVMF-${version}";
outputs = [ "out" "fd" ];

View File

@ -30,6 +30,11 @@ buildStdenv = if stdenv.isDarwin then
else
stdenv;
buildType = if stdenv.isDarwin then
"CLANGPDB"
else
"GCC5";
edk2 = buildStdenv.mkDerivation {
pname = "edk2";
version = "201911";
@ -44,9 +49,9 @@ edk2 = buildStdenv.mkDerivation {
buildInputs = [ libuuid pythonEnv ];
makeFlags = [ "-C BaseTools" ]
++ lib.optional (stdenv.isDarwin) [ "BUILD_CC=clang BUILD_CXX=clang++ BUILD_AS=clang" ];
++ lib.optional (stdenv.cc.isClang) [ "BUILD_CC=clang BUILD_CXX=clang++ BUILD_AS=clang" ];
NIX_CFLAGS_COMPILE = "-Wno-return-type" + lib.optionalString (!stdenv.isDarwin) " -Wno-error=stringop-truncation";
NIX_CFLAGS_COMPILE = "-Wno-return-type" + lib.optionalString (stdenv.cc.isGNU) " -Wno-error=stringop-truncation";
hardeningDisable = [ "format" "fortify" ];
@ -66,7 +71,7 @@ edk2 = buildStdenv.mkDerivation {
};
passthru = {
mkDerivation = projectDscPath: buildType: attrs: buildStdenv.mkDerivation ({
mkDerivation = projectDscPath: attrs: buildStdenv.mkDerivation ({
inherit (edk2) src;
buildInputs = [ bc pythonEnv ] ++ attrs.buildInputs or [];