Merge pull request #29246 from LnL7/clang-stdenv

clang-stdenv: move libstdcxxHook to cc-wrapper
This commit is contained in:
John Ericson 2017-09-13 16:21:41 -04:00 committed by GitHub
commit 349a09228e
5 changed files with 88 additions and 28 deletions

View File

@ -1,4 +1,7 @@
{ newScope, stdenv, cmake, libxml2, python2, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun }:
{ newScope, stdenv, libstdcxxHook, cmake, libxml2, python2, isl, fetchurl
, overrideCC, wrapCC, ccWrapperFun, darwin
}:
let
callPackage = newScope (self // { inherit stdenv cmake libxml2 python2 isl version fetch; });
@ -22,20 +25,35 @@ let
inherit clang-tools-extra_src stdenv;
};
clang = wrapCC self.clang-unwrapped;
clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang;
libstdcxxClang = ccWrapperFun {
cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) libc nativeTools nativeLibc;
extraPackages = [ libstdcxxHook ];
};
libcxxClang = ccWrapperFun {
cc = self.clang-unwrapped;
isClang = true;
inherit (self) stdenv;
/* FIXME is this right? */
inherit (stdenv.cc) libc nativeTools nativeLibc;
extraPackages = [ self.libcxx self.libcxxabi ];
};
stdenv = overrideCC stdenv self.clang;
stdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.clang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
libcxxStdenv = overrideCC stdenv self.libcxxClang;
libcxxStdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.libcxxClang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
lldb = callPackage ./lldb.nix {};

View File

@ -1,4 +1,4 @@
{ newScope, stdenv, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun }:
{ newScope, stdenv, libstdcxxHook, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun, darwin }:
let
callPackage = newScope (self // { inherit stdenv isl version fetch; });
@ -22,20 +22,35 @@ let
inherit clang-tools-extra_src stdenv;
};
clang = wrapCC self.clang-unwrapped;
clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang;
libstdcxxClang = ccWrapperFun {
cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) libc nativeTools nativeLibc;
extraPackages = [ libstdcxxHook ];
};
libcxxClang = ccWrapperFun {
cc = self.clang-unwrapped;
isClang = true;
inherit (self) stdenv;
/* FIXME is this right? */
inherit (stdenv.cc) libc nativeTools nativeLibc;
extraPackages = [ self.libcxx self.libcxxabi ];
};
stdenv = overrideCC stdenv self.clang;
stdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.clang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
libcxxStdenv = overrideCC stdenv self.libcxxClang;
libcxxStdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.libcxxClang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
lldb = callPackage ./lldb.nix {};

View File

@ -1,4 +1,4 @@
{ newScope, stdenv, isl, fetchurl, overrideCC, wrapCC, darwin, ccWrapperFun }:
{ newScope, stdenv, libstdcxxHook, isl, fetchurl, overrideCC, wrapCC, ccWrapperFun, darwin }:
let
callPackage = newScope (self // { inherit stdenv isl version fetch; });
@ -22,20 +22,35 @@ let
inherit clang-tools-extra_src stdenv;
};
clang = wrapCC self.clang-unwrapped;
clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang;
libstdcxxClang = ccWrapperFun {
cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) libc nativeTools nativeLibc;
extraPackages = [ libstdcxxHook ];
};
libcxxClang = ccWrapperFun {
cc = self.clang-unwrapped;
isClang = true;
inherit (self) stdenv;
/* FIXME is this right? */
inherit (stdenv.cc) libc nativeTools nativeLibc;
extraPackages = [ self.libcxx self.libcxxabi ];
};
stdenv = overrideCC stdenv self.clang;
stdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.clang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
libcxxStdenv = overrideCC stdenv self.libcxxClang;
libcxxStdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.libcxxClang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
lldb = callPackage ./lldb.nix {};

View File

@ -37,14 +37,17 @@ let
llvm-manpages = lowPrio self.llvm.man;
clang-manpages = lowPrio self.clang-unwrapped.man;
clang = wrapCC self.clang-unwrapped;
clang = if stdenv.cc.isGNU then self.libstdcxxClang else self.libcxxClang;
openmp = callPackage ./openmp.nix {};
libstdcxxClang = ccWrapperFun {
cc = self.clang-unwrapped;
/* FIXME is this right? */
inherit (stdenv.cc) libc nativeTools nativeLibc;
extraPackages = [ libstdcxxHook ];
};
libcxxClang = ccWrapperFun {
cc = self.clang-unwrapped;
isClang = true;
inherit (self) stdenv;
/* FIXME is this right? */
inherit (stdenv.cc) libc nativeTools nativeLibc;
extraPackages = [ self.libcxx self.libcxxabi ];
@ -53,11 +56,16 @@ let
stdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.clang;
# Use the gcc libstdc++ when targeting linux.
extraBuildInputs = if stdenv.cc.isGNU then [ libstdcxxHook ] else drv.extraBuildInputs;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
libcxxStdenv = overrideCC stdenv self.libcxxClang;
libcxxStdenv = stdenv.override (drv: {
allowedRequisites = null;
cc = self.libcxxClang;
# Don't include the libc++ and libc++abi from the original stdenv.
extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
});
lld = callPackage ./lld.nix {};
@ -66,6 +74,8 @@ let
libcxx = callPackage ./libc++ {};
libcxxabi = callPackage ./libc++abi.nix {};
openmp = callPackage ./openmp.nix {};
};
in self

View File

@ -5316,7 +5316,7 @@ with pkgs;
#Use this instead of stdenv to build with clang
clangStdenv = if stdenv.isDarwin then stdenv else lowPrio llvmPackages.stdenv;
clang-sierraHack-stdenv = overrideCC stdenv clang-sierraHack;
libcxxStdenv = lowPrio llvmPackages.libcxxStdenv;
libcxxStdenv = if stdenv.isDarwin then stdenv else lowPrio llvmPackages.libcxxStdenv;
clean = callPackage ../development/compilers/clean { };
@ -19391,8 +19391,10 @@ with pkgs;
# `recurseIntoAttrs` for sake of hydra, not nix-env
tests = recurseIntoAttrs {
cc-wrapper = callPackage ../test/cc-wrapper { };
cc-wrapper-clang = callPackage ../test/cc-wrapper { stdenv = clangStdenv; };
cc-wrapper-libcxx = callPackage ../test/cc-wrapper { stdenv = libcxxStdenv; };
cc-wrapper-clang = callPackage ../test/cc-wrapper { stdenv = llvmPackages.stdenv; };
cc-wrapper-libcxx = callPackage ../test/cc-wrapper { stdenv = llvmPackages.libcxxStdenv; };
cc-wrapper-clang-39 = callPackage ../test/cc-wrapper { stdenv = llvmPackages_39.stdenv; };
cc-wrapper-libcxx-39 = callPackage ../test/cc-wrapper { stdenv = llvmPackages_39.libcxxStdenv; };
stdenv-inputs = callPackage ../test/stdenv-inputs { };
macOSSierraShared = callPackage ../test/macos-sierra-shared {};