wrapCC, wrapBintools: remove unnecessary indexing into platform sets

`targetPlatform` and `hostPlatform` are already in scope, so it is
unnecessary to index into `stdenvNoCC`.
This commit is contained in:
sternenseemann 2024-04-14 15:41:03 +02:00
parent 4aa9e4ecc6
commit 63d21d1325
2 changed files with 16 additions and 16 deletions

View File

@ -345,7 +345,7 @@ stdenvNoCC.mkDerivation {
done
''
+ optionalString stdenvNoCC.targetPlatform.isDarwin ''
+ optionalString targetPlatform.isDarwin ''
echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/libc-ldflags
''
@ -362,7 +362,7 @@ stdenvNoCC.mkDerivation {
###
### Remove certain timestamps from final binaries
###
+ optionalString (stdenvNoCC.targetPlatform.isDarwin && !(bintools.isGNU or false)) ''
+ optionalString (targetPlatform.isDarwin && !(bintools.isGNU or false)) ''
echo "export ZERO_AR_DATE=1" >> $out/nix-support/setup-hook
''
@ -379,9 +379,9 @@ stdenvNoCC.mkDerivation {
###
### Ensure consistent LC_VERSION_MIN_MACOSX
###
+ optionalString stdenvNoCC.targetPlatform.isDarwin (
+ optionalString targetPlatform.isDarwin (
let
inherit (stdenvNoCC.targetPlatform)
inherit (targetPlatform)
darwinPlatform darwinSdkVersion
darwinMinVersion darwinMinVersionVariable;
in ''

View File

@ -117,10 +117,10 @@ let
useGccForLibs = useCcForLibs
&& libcxx == null
&& !stdenvNoCC.targetPlatform.isDarwin
&& !(stdenvNoCC.targetPlatform.useLLVM or false)
&& !(stdenvNoCC.targetPlatform.useAndroidPrebuilt or false)
&& !(stdenvNoCC.targetPlatform.isiOS or false)
&& !targetPlatform.isDarwin
&& !(targetPlatform.useLLVM or false)
&& !(targetPlatform.useAndroidPrebuilt or false)
&& !(targetPlatform.isiOS or false)
&& gccForLibs != null;
gccForLibs_solib = getLib gccForLibs
+ optionalString (targetPlatform != hostPlatform) "/${targetPlatform.config}";
@ -247,17 +247,17 @@ let
then cc.hardeningUnsupportedFlagsByTargetPlatform targetPlatform
else (cc.hardeningUnsupportedFlags or []);
darwinPlatformForCC = optionalString stdenvNoCC.targetPlatform.isDarwin (
darwinPlatformForCC = optionalString targetPlatform.isDarwin (
if (targetPlatform.darwinPlatform == "macos" && isGNU) then "macosx"
else targetPlatform.darwinPlatform
);
darwinMinVersion = optionalString stdenvNoCC.targetPlatform.isDarwin (
stdenvNoCC.targetPlatform.darwinMinVersion
darwinMinVersion = optionalString targetPlatform.isDarwin (
targetPlatform.darwinMinVersion
);
darwinMinVersionVariable = optionalString stdenvNoCC.targetPlatform.isDarwin
stdenvNoCC.targetPlatform.darwinMinVersionVariable;
darwinMinVersionVariable = optionalString targetPlatform.isDarwin
targetPlatform.darwinMinVersionVariable;
in
assert includeFortifyHeaders' -> fortify-headers != null;
@ -477,8 +477,8 @@ stdenvNoCC.mkDerivation {
# break `useLLVM` into.)
+ optionalString (isClang
&& targetPlatform.isLinux
&& !(stdenvNoCC.targetPlatform.useAndroidPrebuilt or false)
&& !(stdenvNoCC.targetPlatform.useLLVM or false)
&& !(targetPlatform.useAndroidPrebuilt or false)
&& !(targetPlatform.useLLVM or false)
&& gccForLibs != null) (''
echo "--gcc-toolchain=${gccForLibs}" >> $out/nix-support/cc-cflags
@ -687,7 +687,7 @@ stdenvNoCC.mkDerivation {
done
''
+ optionalString stdenvNoCC.targetPlatform.isDarwin ''
+ optionalString targetPlatform.isDarwin ''
echo "-arch ${targetPlatform.darwinArch}" >> $out/nix-support/cc-cflags
''