libelf: unconditionally apply autoreconfHook

Without the change build fails on `clang-16` and `gcc-14`:

    $  nix build --impure --expr 'with import ./. {}; libelf.override { stdenv = clangStdenv; }'
    ...
    configure: error: installation or configuration problem: C compiler cannot create executables.

`libelf` is not part of a bootstrap process since 7f458e5c50 "gcc:
drop unused libelf dependency" thus it is safe to run `autoreconf`
unconditionally.
This commit is contained in:
Sergei Trofimovich 2023-12-01 16:02:51 +00:00
parent 3ca25cf885
commit 8ef81629e9

View File

@ -2,11 +2,6 @@
, fetchurl, autoreconfHook, gettext, freebsd, netbsd
}:
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
# cgit) that are needed here should be included directly in Nixpkgs as
# files.
stdenv.mkDerivation rec {
pname = "libelf";
version = "0.8.13";
@ -52,18 +47,10 @@ stdenv.mkDerivation rec {
(if stdenv.hostPlatform.isFreeBSD then [ freebsd.gencat ]
else if stdenv.hostPlatform.isNetBSD then [ netbsd.gencat ]
else [ gettext ])
# Need to regenerate configure script with newer version in order to pass
# "mr_cv_target_elf=yes" and determine integer sizes correctly when
# cross-compiling, but `autoreconfHook` brings in `makeWrapper` which
# doesn't work with the bootstrapTools bash, so can only do this for
# cross builds when `stdenv.shell` is a newer bash.
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform
# The provided `configure` script fails on clang 16 because some tests have a `main`
# returning an implicit `int`, which clang 16 treats as an error. Running `autoreconf` fixes
# the test and allows `configure` to detect clang properly.
# This is done only for clang on Darwin because the Darwin stdenv bootstrap does not use
# libelf, so should be safe because it will always be run with a compatible version of bash.
|| (stdenv.cc.isClang && stdenv.isDarwin)) autoreconfHook;
++ [ autoreconfHook ];
meta = {
description = "ELF object file access library";