From d8634f992a890d57c290ee41e7af2dacb092e8b4 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Thu, 13 Mar 2025 11:36:51 +0100 Subject: [PATCH] gcc: appease the formatter --- pkgs/development/compilers/gcc/all.nix | 11 +++++++--- .../compilers/gcc/common/checksum.nix | 5 ++++- .../gcc/common/extra-target-flags.nix | 4 ++-- .../compilers/gcc/common/libgcc.nix | 9 ++++++-- .../compilers/gcc/common/pre-configure.nix | 21 +++++++++++++------ .../compilers/gcc/patches/default.nix | 9 ++++++-- 6 files changed, 43 insertions(+), 16 deletions(-) diff --git a/pkgs/development/compilers/gcc/all.nix b/pkgs/development/compilers/gcc/all.nix index bf8601a141f1..a4eda45eb028 100644 --- a/pkgs/development/compilers/gcc/all.nix +++ b/pkgs/development/compilers/gcc/all.nix @@ -26,8 +26,10 @@ let inherit majorMinorVersion; reproducibleBuild = true; profiledCompiler = false; - libcCross = if ! lib.systems.equals stdenv.targetPlatform stdenv.buildPlatform then args.libcCross else null; - threadsCross = if ! lib.systems.equals stdenv.targetPlatform stdenv.buildPlatform then threadsCross else { }; + libcCross = + if !lib.systems.equals stdenv.targetPlatform stdenv.buildPlatform then args.libcCross else null; + threadsCross = + if !lib.systems.equals stdenv.targetPlatform stdenv.buildPlatform then threadsCross else { }; isl = if stdenv.hostPlatform.isDarwin then null else isl_0_20; # do not allow version skew when cross-building gcc # @@ -49,7 +51,10 @@ let # cross-case. stdenv = if - ((! lib.systems.equals stdenv.targetPlatform stdenv.buildPlatform) || (! lib.systems.equals stdenv.hostPlatform stdenv.targetPlatform)) + ( + (!lib.systems.equals stdenv.targetPlatform stdenv.buildPlatform) + || (!lib.systems.equals stdenv.hostPlatform stdenv.targetPlatform) + ) && stdenv.cc.isGNU then pkgs."gcc${majorVersion}Stdenv" diff --git a/pkgs/development/compilers/gcc/common/checksum.nix b/pkgs/development/compilers/gcc/common/checksum.nix index aa332ead8952..a283d281c9ed 100644 --- a/pkgs/development/compilers/gcc/common/checksum.nix +++ b/pkgs/development/compilers/gcc/common/checksum.nix @@ -9,7 +9,10 @@ let enableChecksum = - (with stdenv; lib.systems.equals buildPlatform hostPlatform && lib.systems.equals hostPlatform targetPlatform) + ( + with stdenv; + lib.systems.equals buildPlatform hostPlatform && lib.systems.equals hostPlatform targetPlatform + ) && langC && langCC && !stdenv.hostPlatform.isDarwin; diff --git a/pkgs/development/compilers/gcc/common/extra-target-flags.nix b/pkgs/development/compilers/gcc/common/extra-target-flags.nix index 9787d760e082..7acb440b434a 100644 --- a/pkgs/development/compilers/gcc/common/extra-target-flags.nix +++ b/pkgs/development/compilers/gcc/common/extra-target-flags.nix @@ -19,7 +19,7 @@ in let mkFlags = dep: langD: - lib.optionals ((! lib.systems.equals targetPlatform hostPlatform) && dep != null && !langD) ( + lib.optionals ((!lib.systems.equals targetPlatform hostPlatform) && dep != null && !langD) ( [ "-O2 -idirafter ${lib.getDev dep}${dep.incdir or "/include"}" ] @@ -35,7 +35,7 @@ in let mkFlags = dep: - lib.optionals ((! lib.systems.equals targetPlatform hostPlatform) && dep != null) ( + lib.optionals ((!lib.systems.equals targetPlatform hostPlatform) && dep != null) ( [ "-Wl,-L${lib.getLib dep}${dep.libdir or "/lib"}" ] diff --git a/pkgs/development/compilers/gcc/common/libgcc.nix b/pkgs/development/compilers/gcc/common/libgcc.nix index c0c9283bb1e7..1d921a0bca8d 100644 --- a/pkgs/development/compilers/gcc/common/libgcc.nix +++ b/pkgs/development/compilers/gcc/common/libgcc.nix @@ -25,7 +25,11 @@ lib.pipe drv pkg.overrideAttrs ( previousAttrs: lib.optionalAttrs - ((! lib.systems.equals targetPlatform hostPlatform) && (enableShared || targetPlatform.isMinGW) && withoutTargetLibc) + ( + (!lib.systems.equals targetPlatform hostPlatform) + && (enableShared || targetPlatform.isMinGW) + && withoutTargetLibc + ) { makeFlags = [ "all-gcc" @@ -46,7 +50,8 @@ lib.pipe drv ( let - targetPlatformSlash = if lib.systems.equals hostPlatform targetPlatform then "" else "${targetPlatform.config}/"; + targetPlatformSlash = + if lib.systems.equals hostPlatform targetPlatform then "" else "${targetPlatform.config}/"; # If we are building a cross-compiler and the target libc provided # to us at build time has a libgcc, use that instead of building a diff --git a/pkgs/development/compilers/gcc/common/pre-configure.nix b/pkgs/development/compilers/gcc/common/pre-configure.nix index af21a0d2aac7..adf73fb84425 100644 --- a/pkgs/development/compilers/gcc/common/pre-configure.nix +++ b/pkgs/development/compilers/gcc/common/pre-configure.nix @@ -35,7 +35,13 @@ lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) '' # meet that need: it runs on the hostPlatform. + lib.optionalString - (langFortran && (with stdenv; (! lib.systems.equals buildPlatform hostPlatform) && (lib.systems.equals hostPlatform targetPlatform))) + ( + langFortran + && ( + with stdenv; + (!lib.systems.equals buildPlatform hostPlatform) && (lib.systems.equals hostPlatform targetPlatform) + ) + ) '' export GFORTRAN_FOR_TARGET=${pkgsBuildTarget.gfortran}/bin/${stdenv.targetPlatform.config}-gfortran '' @@ -52,7 +58,8 @@ lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) '' # actually different we need to convince the configure script that it # is in fact building a cross compiler although it doesn't believe it. + - lib.optionalString (targetPlatform.config == hostPlatform.config && (! lib.systems.equals targetPlatform hostPlatform)) + lib.optionalString + (targetPlatform.config == hostPlatform.config && (!lib.systems.equals targetPlatform hostPlatform)) '' substituteInPlace configure --replace is_cross_compiler=no is_cross_compiler=yes '' @@ -65,12 +72,14 @@ lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) '' + lib.optionalString ( - (! lib.systems.equals targetPlatform hostPlatform) && withoutTargetLibc && targetPlatform.config == hostPlatform.config + (!lib.systems.equals targetPlatform hostPlatform) + && withoutTargetLibc + && targetPlatform.config == hostPlatform.config ) '' export inhibit_libc=true '' -+ lib.optionalString ((! lib.systems.equals targetPlatform hostPlatform) && withoutTargetLibc && enableShared) ( - import ./libgcc-buildstuff.nix { inherit lib stdenv; } -) ++ lib.optionalString ( + (!lib.systems.equals targetPlatform hostPlatform) && withoutTargetLibc && enableShared +) (import ./libgcc-buildstuff.nix { inherit lib stdenv; }) diff --git a/pkgs/development/compilers/gcc/patches/default.nix b/pkgs/development/compilers/gcc/patches/default.nix index ae46d9341159..7adc06b35779 100644 --- a/pkgs/development/compilers/gcc/patches/default.nix +++ b/pkgs/development/compilers/gcc/patches/default.nix @@ -62,7 +62,7 @@ in [ ] ++ optional (!atLeast12) ./fix-bug-80431.patch -++ optional (! lib.systems.equals targetPlatform hostPlatform) ./libstdc++-target.patch +++ optional (!lib.systems.equals targetPlatform hostPlatform) ./libstdc++-target.patch ++ optionals (noSysDirs) ( [ (if atLeast12 then ./gcc-12-no-sys-dirs.patch else ./no-sys-dirs.patch) ] ++ ( @@ -255,7 +255,12 @@ in ++ optional (langAda && (is9 || is10)) ./gnat-cflags.patch ++ - optional (is10 && buildPlatform.system == "aarch64-darwin" && (! lib.systems.equals targetPlatform buildPlatform)) + optional + ( + is10 + && buildPlatform.system == "aarch64-darwin" + && (!lib.systems.equals targetPlatform buildPlatform) + ) (fetchpatch { url = "https://raw.githubusercontent.com/richard-vd/musl-cross-make/5e9e87f06fc3220e102c29d3413fbbffa456fcd6/patches/gcc-${version}/0008-darwin-aarch64-self-host-driver.patch"; sha256 = "sha256-XtykrPd5h/tsnjY1wGjzSOJ+AyyNLsfnjuOZ5Ryq9vA=";