cc-wrapper: Fix for prebuilt android
We don't want to use Nix-built GCC's libs with prebuilt clang in this case.
This commit is contained in:
parent
e6cbcc2ac1
commit
204dc3a88b
1 changed files with 9 additions and 3 deletions
|
@ -61,6 +61,12 @@ let
|
||||||
then import ../expand-response-params { inherit (buildPackages) stdenv; }
|
then import ../expand-response-params { inherit (buildPackages) stdenv; }
|
||||||
else "";
|
else "";
|
||||||
|
|
||||||
|
useGccForLibs = isClang
|
||||||
|
&& libcxx == null
|
||||||
|
&& !(stdenv.targetPlatform.useLLVM or false)
|
||||||
|
&& !(stdenv.targetPlatform.useAndroidPrebuilt or false)
|
||||||
|
&& gccForLibs != null;
|
||||||
|
|
||||||
# older compilers (for example bootstrap's GCC 5) fail with -march=too-modern-cpu
|
# older compilers (for example bootstrap's GCC 5) fail with -march=too-modern-cpu
|
||||||
isGccArchSupported = arch:
|
isGccArchSupported = arch:
|
||||||
if isGNU then
|
if isGNU then
|
||||||
|
@ -272,7 +278,7 @@ stdenv.mkDerivation {
|
||||||
##
|
##
|
||||||
## GCC libs for non-GCC support
|
## GCC libs for non-GCC support
|
||||||
##
|
##
|
||||||
+ optionalString (isClang && libcxx == null && !(stdenv.targetPlatform.useLLVM or false) && gccForLibs != null) ''
|
+ optionalString useGccForLibs ''
|
||||||
|
|
||||||
echo "-B${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version}" >> $out/nix-support/cc-cflags
|
echo "-B${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version}" >> $out/nix-support/cc-cflags
|
||||||
echo "-L${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version}" >> $out/nix-support/cc-ldflags
|
echo "-L${gccForLibs}/lib/gcc/${targetPlatform.config}/${gccForLibs.version}" >> $out/nix-support/cc-ldflags
|
||||||
|
@ -316,11 +322,11 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
# We have a libc++ directly, we have one via "smuggled" GCC, or we have one
|
# We have a libc++ directly, we have one via "smuggled" GCC, or we have one
|
||||||
# bundled with the C compiler because it is GCC
|
# bundled with the C compiler because it is GCC
|
||||||
+ optionalString (libcxx != null || (isClang && !(stdenv.targetPlatform.useLLVM or false) && gccForLibs.langCC or false) || (isGNU && cc.langCC or false)) ''
|
+ optionalString (libcxx != null || (useGccForLibs && gccForLibs.langCC or false) || (isGNU && cc.langCC or false)) ''
|
||||||
touch "$out/nix-support/libcxx-cxxflags"
|
touch "$out/nix-support/libcxx-cxxflags"
|
||||||
touch "$out/nix-support/libcxx-ldflags"
|
touch "$out/nix-support/libcxx-ldflags"
|
||||||
''
|
''
|
||||||
+ optionalString (libcxx == null && (isClang && !(stdenv.targetPlatform.useLLVM or false) && gccForLibs.langCC or false)) ''
|
+ optionalString (libcxx == null && (useGccForLibs && gccForLibs.langCC or false)) ''
|
||||||
for dir in ${gccForLibs}/include/c++/*; do
|
for dir in ${gccForLibs}/include/c++/*; do
|
||||||
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
echo "-isystem $dir" >> $out/nix-support/libcxx-cxxflags
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue