diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-05-11 19:20:15 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2021-05-12 00:14:56 +0000 |
commit | 37194a325de090747ce5f97a38de4329708c1912 (patch) | |
tree | 81cd6ce64e28f98b0c624683ccf776ab3faddcd6 /pkgs/development/compilers/llvm/12/default.nix | |
parent | e0d3c9d0317edf7fd8d99e78066a7cdaf1c5da21 (diff) | |
download | nixpkgs-37194a325de090747ce5f97a38de4329708c1912.tar nixpkgs-37194a325de090747ce5f97a38de4329708c1912.tar.gz nixpkgs-37194a325de090747ce5f97a38de4329708c1912.tar.bz2 nixpkgs-37194a325de090747ce5f97a38de4329708c1912.tar.lz nixpkgs-37194a325de090747ce5f97a38de4329708c1912.tar.xz nixpkgs-37194a325de090747ce5f97a38de4329708c1912.tar.zst nixpkgs-37194a325de090747ce5f97a38de4329708c1912.zip |
treewide: Try to make a few bootstrapping things more consistent
- Introduce `preLibcCrossHeaders` to bootstrap libgcc and compiler-rt the same way. - Organize LLVM bintools as `bintools{-unwrapped,,NoLibc}` for consistency with GNU Binutils and Apple's cctools. - Do Android changes for all `llvmPackages` for consistency. - Improve the way the default GCC and LLVM versions are selected.
Diffstat (limited to 'pkgs/development/compilers/llvm/12/default.nix')
-rw-r--r-- | pkgs/development/compilers/llvm/12/default.nix | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/pkgs/development/compilers/llvm/12/default.nix b/pkgs/development/compilers/llvm/12/default.nix index 73a8b7a90a0..2d3c1795bd2 100644 --- a/pkgs/development/compilers/llvm/12/default.nix +++ b/pkgs/development/compilers/llvm/12/default.nix @@ -1,4 +1,5 @@ -{ lowPrio, newScope, pkgs, lib, stdenv, cmake, gccForLibs +{ lowPrio, newScope, pkgs, lib, stdenv, cmake +, gccForLibs, preLibcCrossHeaders , libxml2, python3, isl, fetchurl, overrideCC, wrapCCWith, wrapBintoolsWith , buildLlvmTools # tools, but from the previous stage, for cross , targetLlvmLibraries # libraries, but from the next stage, for cross @@ -112,7 +113,16 @@ let # doesn’t support like LLVM. Probably we should move to some other # file. - bintools = callPackage ./bintools {}; + bintools-unwrapped = callPackage ./bintools {}; + + bintoolsNoLibc = wrapBintoolsWith { + bintools = tools.bintools-unwrapped; + libc = preLibcCrossHeaders; + }; + + bintools = wrapBintoolsWith { + bintools = tools.bintools-unwrapped; + }; lldClang = wrapCCWith rec { cc = tools.clang-unwrapped; @@ -141,9 +151,7 @@ let lldClangNoLibcxx = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = wrapBintoolsWith { - inherit (tools) bintools; - }; + inherit (tools) bintools; extraPackages = [ targetLlvmLibraries.compiler-rt ]; @@ -157,10 +165,7 @@ let lldClangNoLibc = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = wrapBintoolsWith { - inherit (tools) bintools; - libc = null; - }; + bintools = tools.bintoolsNoLibc; extraPackages = [ targetLlvmLibraries.compiler-rt ]; @@ -173,10 +178,7 @@ let lldClangNoCompilerRt = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = wrapBintoolsWith { - inherit (tools) bintools; - libc = null; - }; + bintools = tools.bintoolsNoLibc; extraPackages = [ ]; extraBuildCommands = '' echo "-nostartfiles" >> $out/nix-support/cc-cflags @@ -186,9 +188,7 @@ let lldClangNoCompilerRtWithLibc = wrapCCWith rec { cc = tools.clang-unwrapped; libcxx = null; - bintools = wrapBintoolsWith { - inherit (tools) bintools; - }; + inherit (tools) bintools; extraPackages = [ ]; extraBuildCommands = mkExtraBuildCommands0 cc; }; @@ -199,15 +199,19 @@ let callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version fetch; }); in { - compiler-rt-libc = callPackage ./compiler-rt ({ inherit llvm_meta; } // - (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { - stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc; - })); + compiler-rt-libc = callPackage ./compiler-rt { + inherit llvm_meta; + stdenv = if stdenv.hostPlatform.useLLVM or false + then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRtWithLibc + else stdenv; + }; - compiler-rt-no-libc = callPackage ./compiler-rt ({ inherit llvm_meta; } // - (lib.optionalAttrs (stdenv.hostPlatform.useLLVM or false) { - stdenv = overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt; - })); + compiler-rt-no-libc = callPackage ./compiler-rt { + inherit llvm_meta; + stdenv = if stdenv.hostPlatform.useLLVM or false + then overrideCC stdenv buildLlvmTools.lldClangNoCompilerRt + else stdenv; + }; # N.B. condition is safe because without useLLVM both are the same. compiler-rt = if stdenv.hostPlatform.isAndroid |