gcc: appease the formatter

This commit is contained in:
Stefan Frijters
2025-03-13 11:37:08 +01:00
parent be26b135bc
commit d8634f992a
6 changed files with 43 additions and 16 deletions
+8 -3
View File
@@ -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"
@@ -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;
@@ -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"}"
]
@@ -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
@@ -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; })
@@ -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=";