From cd3604f63a9b869beaf08421274369da09bb892f Mon Sep 17 00:00:00 2001 From: lzcunt Date: Tue, 9 Dec 2025 20:25:20 +0300 Subject: [PATCH] gcc: reconfigure build system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Split from #371092. See and for some rationale. Co-Authored-By: Arsen Arsenović --- .../compilers/gcc/common/dependencies.nix | 2 ++ .../compilers/gcc/common/pre-configure.nix | 13 +++++++++++++ pkgs/development/compilers/gcc/default.nix | 2 ++ 3 files changed, 17 insertions(+) diff --git a/pkgs/development/compilers/gcc/common/dependencies.nix b/pkgs/development/compilers/gcc/common/dependencies.nix index 7438cb64f8ea..c9e85c0d99fb 100644 --- a/pkgs/development/compilers/gcc/common/dependencies.nix +++ b/pkgs/development/compilers/gcc/common/dependencies.nix @@ -7,6 +7,7 @@ texinfo, which, gettext, + autoconf269, gnused, patchelf, gmp, @@ -41,6 +42,7 @@ in texinfo which gettext + autoconf269 ] ++ optionals (perl != null) [ perl ] ++ optionals (with stdenv.targetPlatform; isVc4 || isRedox || isSnapshot && flex != null) [ flex ] diff --git a/pkgs/development/compilers/gcc/common/pre-configure.nix b/pkgs/development/compilers/gcc/common/pre-configure.nix index d04aadd8729d..806cbfc5b115 100644 --- a/pkgs/development/compilers/gcc/common/pre-configure.nix +++ b/pkgs/development/compilers/gcc/common/pre-configure.nix @@ -80,6 +80,19 @@ lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) '' export inhibit_libc=true '' +# We need to reconfigure the build system in case it has been patched. Since +# gcc is patched quite often, reconfiguring it unconditionally makes sense. +# This is also good practice for a couple other reasons. +# See . ++ '' + for i in */configure.ac; do + pushd "$(dirname "$i")" + echo "Running autoreconf in $PWD" + autoconf -f + popd + done +'' + + lib.optionalString ( (!lib.systems.equals targetPlatform hostPlatform) && withoutTargetLibc && enableShared ) (import ./libgcc-buildstuff.nix { inherit lib stdenv; }) diff --git a/pkgs/development/compilers/gcc/default.nix b/pkgs/development/compilers/gcc/default.nix index 7f5ba5aa8bf1..f7a19a73673b 100644 --- a/pkgs/development/compilers/gcc/default.nix +++ b/pkgs/development/compilers/gcc/default.nix @@ -30,6 +30,7 @@ which, patchelf, binutils, + autoconf269, isl ? null, # optional, for the Graphite optimization framework. zlib ? null, libucontext ? null, @@ -131,6 +132,7 @@ let # inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc${majorVersion}.cc.override)" | jq '.[]' --raw-output' inherit apple-sdk + autoconf269 binutils buildPackages cargo