mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +00:00
wrapCC: check darwin-ness for -mcpu/-march based on targetPlatform
`stdenv.is*` defaults to `hostPlatform` which is technically incorrect here, since what we are gating concerns the target platform only. This would be a problem in practice if cross compiling from x86_64-darwin to aarch64-darwin whilst using gcc which is probably rare enough.
This commit is contained in:
parent
20a3a21814
commit
fde3861f21
@ -623,7 +623,7 @@ stdenv.mkDerivation {
|
||||
# For clang, this is handled in add-clang-cc-cflags-before.sh
|
||||
|
||||
# TODO: aarch64-darwin has mcpu incompatible with gcc
|
||||
+ optionalString ((targetPlatform ? gcc.arch) && !isClang && !(stdenv.isDarwin && stdenv.isAarch64) &&
|
||||
+ optionalString ((targetPlatform ? gcc.arch) && !isClang && !(targetPlatform.isDarwin && targetPlatform.isAarch64) &&
|
||||
isGccArchSupported targetPlatform.gcc.arch) ''
|
||||
echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before
|
||||
''
|
||||
@ -632,7 +632,7 @@ stdenv.mkDerivation {
|
||||
# instead of march. On all other platforms you should use mtune
|
||||
# and march instead.
|
||||
# TODO: aarch64-darwin has mcpu incompatible with gcc
|
||||
+ optionalString ((targetPlatform ? gcc.cpu) && (isClang || !(stdenv.isDarwin && stdenv.isAarch64))) ''
|
||||
+ optionalString ((targetPlatform ? gcc.cpu) && (isClang || !(targetPlatform.isDarwin && targetPlatform.isAarch64))) ''
|
||||
echo "-mcpu=${targetPlatform.gcc.cpu}" >> $out/nix-support/cc-cflags-before
|
||||
''
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user