From 63d21d13251584a3e947ec871d4e79ab4cfc580e Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 14 Apr 2024 15:41:03 +0200 Subject: [PATCH] wrapCC, wrapBintools: remove unnecessary indexing into platform sets `targetPlatform` and `hostPlatform` are already in scope, so it is unnecessary to index into `stdenvNoCC`. --- .../bintools-wrapper/default.nix | 8 +++---- pkgs/build-support/cc-wrapper/default.nix | 24 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 8baac3626892..3c553f181f0d 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -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 '' diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 17029736faca..11ae9868ce01 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -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 ''