diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 15be2dcacbf..4bd77ed485d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -34,11 +34,7 @@ with pkgs; # A stdenv capable of building 32-bit binaries. On x86_64-linux, # it uses GCC compiled with multilib support; on i686-linux, it's # just the plain stdenv. - stdenv_32bit = lowPrio ( - if system == "x86_64-linux" then - overrideCC stdenv gcc_multi - else - stdenv); + stdenv_32bit = lowPrio (if hostPlatform.is32bit then stdenv else multiStdenv); stdenvNoCC = stdenv.override { cc = null; }; @@ -5544,7 +5540,7 @@ with pkgs; }; #Use this instead of stdenv to build with clang - clangStdenv = if stdenv.isDarwin then stdenv else lowPrio llvmPackages.stdenv; + clangStdenv = if stdenv.cc.isClang then stdenv else lowPrio llvmPackages.stdenv; clang-sierraHack-stdenv = overrideCC stdenv clang-sierraHack; libcxxStdenv = if stdenv.isDarwin then stdenv else lowPrio llvmPackages.libcxxStdenv; @@ -5601,11 +5597,12 @@ with pkgs; gcc = gcc6; gcc-unwrapped = gcc.cc; - gccStdenv = if (!stdenv.isDarwin) then stdenv else stdenv.override { + gccStdenv = if stdenv.cc.isGNU then stdenv else stdenv.override { allowedRequisites = null; cc = gcc; - # Include unwrapped binaries like AS, etc. and remove libcxx/libcxxabi - extraBuildInputs = [ stdenv.cc.cc ]; + # Remove libcxx/libcxxabi, and add clang for AS if on darwin (it uses + # clang's internal assembler). + extraBuildInputs = lib.optional hostPlatform.isDarwin clang.cc; }; wrapCCMulti = cc: @@ -5645,6 +5642,7 @@ with pkgs; gccMultiStdenv = overrideCC stdenv gcc_multi; clangMultiStdenv = overrideCC stdenv clang_multi; + multiStdenv = if stdenv.cc.isClang then clangMultiStdenv else gccMultiStdenv; gcc_debug = lowPrio (wrapCC (gcc.cc.override { stripped = false;