stdenv: linux: centralise updateAutotoolsGnuConfigScriptsHook in stageFun

The hook was added six times — once in each of stages 1, xgcc, 2, 3, 4
(and again at the final stdenv) — to teach configure scripts about
non-x86_64 architectures. Wire it once inside stageFun instead, guarded
by `prevStage ? updateAutotoolsGnuConfigScriptsHook` so the dummy stage
(whose prevStage is the raw stub) is unaffected.

The final stdenv (built outside stageFun) keeps its explicit entry.

Eval-verified: stdenv.drvPath is unchanged from master
(q2xn5647kadsgpz40xcmjssa0pmdmiwi-stdenv-linux.drv).
This commit is contained in:
Aliaksandr 2026-05-14 01:05:26 +03:00
commit 5c20ed83dd
No known key found for this signature in database
GPG key ID: CACB28BA93CE71A2

View file

@ -181,7 +181,13 @@ let
buildPlatform = localSystem;
hostPlatform = localSystem;
targetPlatform = localSystem;
inherit extraNativeBuildInputs;
# Every real (post-dummy) stage needs this hook so configure scripts
# can recognise architectures (LoongArch, RISC-V, etc.).
extraNativeBuildInputs =
extraNativeBuildInputs
++ lib.optional (
prevStage ? updateAutotoolsGnuConfigScriptsHook
) prevStage.updateAutotoolsGnuConfigScriptsHook;
inherit (stage0) initialPath;
preHook = ''
# Don't patch #!/interpreter because it leads to retained
@ -311,9 +317,6 @@ in
};
});
};
# `gettext` comes with obsolete config.sub/config.guess that don't recognize LoongArch64.
extraNativeBuildInputs = [ prevStage.updateAutotoolsGnuConfigScriptsHook ];
}
)
@ -427,9 +430,6 @@ in
'';
});
};
# `gettext` comes with obsolete config.sub/config.guess that don't recognize LoongArch64.
extraNativeBuildInputs = [ prevStage.updateAutotoolsGnuConfigScriptsHook ];
}
)
@ -531,10 +531,6 @@ in
);
};
# `gettext` comes with obsolete config.sub/config.guess that don't recognize LoongArch64.
# `libtool` comes with obsolete config.sub/config.guess that don't recognize Risc-V.
extraNativeBuildInputs = [ prevStage.updateAutotoolsGnuConfigScriptsHook ];
}
)
@ -605,8 +601,6 @@ in
};
extraNativeBuildInputs = [
prevStage.patchelf
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
prevStage.updateAutotoolsGnuConfigScriptsHook
];
}
)
@ -671,8 +665,6 @@ in
extraNativeBuildInputs = [
prevStage.patchelf
prevStage.xz
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
prevStage.updateAutotoolsGnuConfigScriptsHook
];
}
)