various: Enable updateAutotoolsGnuConfigScriptsHook

Prior to August 2023, any config.guess generated by autoconf will
include a hardcoded /usr/bin/uname invocation for FreeBSD on any
architecture other than arm. This clearly doesn't work under nix.
We must then update or otherwise patch each old config.guess.
This commit is contained in:
Audrey Dutcher 2024-05-21 14:50:29 -07:00 committed by John Ericson
parent 9e21798e8f
commit 846de80d1c
36 changed files with 114 additions and 33 deletions

View File

@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchurl
, updateAutotoolsGnuConfigScriptsHook
, perl
, libiconv
, zlib
@ -28,7 +29,7 @@ stdenv.mkDerivation rec {
hash = "sha256-c5nppnCMMtZ4pypjIZ6W8jvgviM25Q/RNISY0HBB35A=";
};
nativeBuildInputs = [ perl ];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook perl ];
buildInputs = [ libiconv zlib popt ]
++ lib.optional enableACLs acl

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, writeTextDir
{ lib, stdenv, fetchurl, updateAutotoolsGnuConfigScriptsHook
, withCMake ? true, cmake
# sensitive downstream packages
@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" "man" ];
nativeBuildInputs = lib.optionals withCMake [ cmake ];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ] ++ lib.optionals withCMake [ cmake ];
cmakeFlags = [] ++ lib.optionals stdenv.hostPlatform.isStatic [
"-DCARES_SHARED=OFF"

View File

@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchurl
, updateAutotoolsGnuConfigScriptsHook
# for passthru.tests
, python3
, perlPackages
@ -29,6 +30,7 @@ stdenv.mkDerivation (finalAttrs: {
};
strictDeps = true;
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
outputs = [ "out" "dev" ]; # TODO: fix referrers
outputBin = "dev";

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchurl }:
{ stdenv, lib, fetchurl, updateAutotoolsGnuConfigScriptsHook }:
stdenv.mkDerivation rec {
pname = "gdbm";
@ -9,6 +9,8 @@ stdenv.mkDerivation rec {
sha256 = "sha256-dLEIHSH/8TrkvXwW5dblBKTCb3zeHcoNljpIQXS7ys0=";
};
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
doCheck = true; # not cross;
# Linking static stubs on cygwin requires correct ordering.

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchurl, libiconv, bash
{ stdenv, lib, fetchurl, libiconv, bash, updateAutotoolsGnuConfigScriptsHook
}:
# Note: this package is used for bootstrapping fetchurl, and thus
@ -50,6 +50,9 @@ stdenv.mkDerivation rec {
'';
strictDeps = true;
nativeBuildInputs = [
updateAutotoolsGnuConfigScriptsHook
];
buildInputs = lib.optionals (!stdenv.hostPlatform.isMinGW) [
bash
]

View File

@ -74,6 +74,11 @@ stdenv.mkDerivation rec {
postPatch = ''
substituteInPlace config/shlib.conf \
--replace "'ld " "'${stdenv.cc.targetPrefix}ld "
''
# this could be accomplished by updateAutotoolsGnuConfigScriptsHook, but that causes infinite recursion
# necessary for FreeBSD code path in configure
+ ''
substituteInPlace ./config/config.guess --replace-fail /usr/bin/uname uname
'';
libFolders = [ "util" "include" "lib" "build-tools" ];

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl
{ lib, stdenv, fetchurl, updateAutotoolsGnuConfigScriptsHook
, # Note: -static hasnt work on darwin
static ? with stdenv.hostPlatform; isStatic && !isDarwin
}:
@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
sha256 = "1sjs4324is7fp21an4aas2z4dwsvs6z4xwrmp72vwpq1s6wbfzjh";
};
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
configureFlags = lib.optional (static) "LDFLAGS=-static";
meta = {

View File

@ -15,6 +15,12 @@ stdenv.mkDerivation rec {
./CVE-2023-48795.patch
];
# this could be accomplished by updateAutotoolsGnuConfigScriptsHook, but that causes infinite recursion
# necessary for FreeBSD code path in configure
postPatch = ''
substituteInPlace ./config.guess --replace-fail /usr/bin/uname uname
'';
outputs = [ "out" "dev" "devdoc" ];
propagatedBuildInputs = [ openssl ]; # see Libs: in libssh2.pc

View File

@ -15,6 +15,12 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-5eH0yu4KAd4q7ibjE4gH1tPKK45nKHlm0f79ZeH9iUM=";
};
# this could be accomplished by updateAutotoolsGnuConfigScriptsHook, but that causes infinite recursion
# necessary for FreeBSD code path in configure
postPatch = ''
substituteInPlace ./build-aux/m4-autogen/config.guess --replace-fail /usr/bin/uname uname
'';
outputs = [
"out"
"man"

View File

@ -1,4 +1,4 @@
{lib, stdenv, fetchurl}:
{ lib, stdenv, fetchurl, updateAutotoolsGnuConfigScriptsHook }:
stdenv.mkDerivation rec {
pname = "lzo";
@ -9,6 +9,8 @@ stdenv.mkDerivation rec {
sha256 = "0wm04519pd3g8hqpjqhfr72q8qmbiwqaxcs3cndny9h86aa95y60";
};
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
configureFlags = lib.optional (!stdenv.hostPlatform.isStatic) "--enable-shared" ;
enableParallelBuilding = true;

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl }:
{ lib, stdenv, fetchurl, updateAutotoolsGnuConfigScriptsHook }:
stdenv.mkDerivation rec {
pname = "mpdecimal";
@ -10,6 +10,8 @@ stdenv.mkDerivation rec {
hash = "sha256-lCRFwyRbInMP1Bpnp8XCMdEcsbmTa5wPdjNPt9C0Row=";
};
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
configureFlags = [ "LD=${stdenv.cc.targetPrefix}cc" ];
postInstall = ''

View File

@ -2,6 +2,7 @@
, stdenv
, fetchurl
, buildPackages
, updateAutotoolsGnuConfigScriptsHook
, ncurses
, pkg-config
, abiVersion ? "6"
@ -68,6 +69,7 @@ stdenv.mkDerivation (finalAttrs: {
strictDeps = true;
nativeBuildInputs = [
updateAutotoolsGnuConfigScriptsHook
pkg-config
] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
# for `tic`, build already depends on for build `cc` so it's weird the build doesn't just build `tic`.

View File

@ -67,6 +67,12 @@ stdenv.mkDerivation rec {
export TZDIR=${tzdata}/share/zoneinfo
'';
# this could be accomplished by updateAutotoolsGnuConfigScriptsHook, but that causes infinite recursion
# necessary for FreeBSD code path in configure
postPatch = ''
substituteInPlace ./config.guess --replace-fail /usr/bin/uname uname
'';
postInstall = lib.optionalString (enableApp) ''
installShellCompletion --bash doc/bash_completion/{h2load,nghttp,nghttpd,nghttpx}
'' + lib.optionalString (!enableApp) ''

View File

@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchurl
, updateAutotoolsGnuConfigScriptsHook
, withJitSealloc ? true
}:
@ -13,6 +14,8 @@ stdenv.mkDerivation rec {
hash = "sha256-4qU5hP8LB9/bWuRIa7ubIcyo598kNAlsyb8bcow1C8s=";
};
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
postPatch = ''
# Fix jit autodetection:
# https://github.com/PCRE2Project/pcre2/pull/396

View File

@ -2,6 +2,7 @@
, stdenv
, fetchurl
, fetchpatch2
, updateAutotoolsGnuConfigScriptsHook
}:
stdenv.mkDerivation rec {
@ -13,6 +14,8 @@ stdenv.mkDerivation rec {
sha256 = "sha256-wlpIOPyOTByKrLi9Yg7bMISj1jv4mH/a08onWMYyQPk=";
};
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
patches = lib.optionals stdenv.isCygwin [
./1.16-cygwin.patch
./1.16-vpath.patch

View File

@ -1,5 +1,6 @@
{ lib, stdenv
, fetchpatch, fetchurl
, updateAutotoolsGnuConfigScriptsHook
, ncurses, termcap
, curses-library ?
if stdenv.hostPlatform.isWindows
@ -20,6 +21,7 @@ stdenv.mkDerivation rec {
strictDeps = true;
propagatedBuildInputs = [ curses-library ];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
patchFlags = [ "-p0" ];

View File

@ -1,4 +1,5 @@
{ lib, stdenv, fetchurl, zlib, readline, ncurses
, updateAutotoolsGnuConfigScriptsHook
# for tests
, python3Packages, sqldiff, sqlite-analyzer, tracker
@ -27,6 +28,7 @@ stdenv.mkDerivation rec {
outputs = [ "bin" "dev" "out" ];
separateDebugInfo = stdenv.isLinux;
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
buildInputs = [ zlib ] ++ lib.optionals interactive [ readline ncurses ];
# required for aarch64 but applied for all arches for simplicity

View File

@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchurl
, updateAutotoolsGnuConfigScriptsHook
, guileSupport ? false, guile
# avoid guile depend on bootstrap to prevent dependency cycles
, inBootstrap ? false
@ -31,7 +32,7 @@ stdenv.mkDerivation rec {
./0002-remove-impure-dirs.patch
];
nativeBuildInputs = lib.optionals guileEnabled [ pkg-config ];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ] ++ lib.optionals guileEnabled [ pkg-config ];
buildInputs = lib.optionals guileEnabled [ guile ];
configureFlags = lib.optional guileEnabled "--with-guile"

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, perl, autoconf }:
{ lib, stdenv, fetchurl, perl, autoconf, updateAutotoolsGnuConfigScriptsHook }:
stdenv.mkDerivation rec {
pname = "automake";
@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
};
strictDeps = true;
nativeBuildInputs = [ autoconf perl ];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook autoconf perl ];
buildInputs = [ autoconf ];
setupHook = ./setup-hook.sh;

View File

@ -1,4 +1,4 @@
{ fetchurl, lib, stdenv, expect, makeWrapper }:
{ fetchurl, lib, stdenv, expect, makeWrapper, updateAutotoolsGnuConfigScriptsHook }:
stdenv.mkDerivation rec {
pname = "dejagnu";
@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256 = "1qx2cv6qkxbiqg87jh217jb62hk3s7dmcs4cz1llm2wmsynfznl7";
};
nativeBuildInputs = [ makeWrapper ];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook makeWrapper ];
buildInputs = [ expect ];
# dejagnu-1.6.3 can't successfully run tests in source tree:

View File

@ -16,12 +16,17 @@ stdenv.mkDerivation rec {
# https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-devel/m4/m4-1.4.19-r1.ebuild
patches = lib.optional stdenv.hostPlatform.isLoongArch64 ./loong-fix-build.patch;
postPatch = if stdenv.hostPlatform.isLoongArch64 then ''
# this could be accomplished by updateAutotoolsGnuConfigScriptsHook, but that causes infinite recursion
# necessary for FreeBSD code path in configure
postPatch = ''
substituteInPlace ./build-aux/config.guess --replace-fail /usr/bin/uname uname
'' + lib.optionalString stdenv.hostPlatform.isLoongArch64 ''
touch ./aclocal.m4 ./lib/config.hin ./configure ./doc/stamp-vti || die
find . -name Makefile.in -exec touch {} + || die
'' else null;
'';
strictDeps = true;
enableParallelBuilding = true;
doCheck = false;

View File

@ -1,5 +1,6 @@
{ lib, stdenv, fetchurl, m4
, runtimeShell
, updateAutotoolsGnuConfigScriptsHook
, file
}:
@ -38,7 +39,7 @@ stdenv.mkDerivation rec {
# As libtool is an early bootstrap dependency try hard not to
# add autoconf and automake or help2man dependencies here. That way we can
# avoid pulling in perl and get away with just an `m4` depend.
nativeBuildInputs = [ m4 file ];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook m4 file ];
propagatedBuildInputs = [ m4 file ];
# Don't fixup "#! /bin/sh" in Libtool, otherwise it will use the

View File

@ -19,9 +19,14 @@ stdenv.mkDerivation rec {
++ lib.optional stdenv.isCygwin ./2.36.3-not-win32.patch;
# These three tests fail due to a (desired) behavior change from our ./requires-private.patch
postPatch = if vanilla then null else ''
rm -f check/check-requires-private check/check-gtk check/missing
'';
postPatch =
# this could be accomplished by updateAutotoolsGnuConfigScriptsHook, but that causes infinite recursion
# necessary for FreeBSD code path in configure
''
substituteInPlace ./config.guess ./glib/config.guess --replace-fail /usr/bin/uname uname
'' + lib.optionalString (!vanilla) ''
rm -f check/check-requires-private check/check-gtk check/missing
'';
buildInputs = [ libiconv ];

View File

@ -1,7 +1,7 @@
{ version, sha256, patches ? [] }:
{ lib, stdenv, buildPackages, fetchurl, perl, libintl, bash
, gnulib, gawk, freebsd, libiconv
, updateAutotoolsGnuConfigScriptsHook, gnulib, gawk, freebsd, libiconv
# we are a dependency of gcc, this simplifies bootstraping
, interactive ? false, ncurses, procps
@ -49,6 +49,7 @@ stdenv.mkDerivation {
# A native compiler is needed to build tools needed at build time
depsBuildBuild = [ buildPackages.stdenv.cc perl ];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
buildInputs = [ bash libintl ]
++ optionals stdenv.isSunOS [ libiconv gawk ]
++ optional interactive ncurses;

View File

@ -3,7 +3,7 @@
automake, autoconf, libiconv, libtool, intltool, gettext, python3, perl,
freetype, tradcpp, fontconfig, meson, ninja, ed, fontforge,
libGL, spice-protocol, zlib, libGLU, dbus, libunwind, libdrm, netbsd,
ncompress,
ncompress, updateAutotoolsGnuConfigScriptsHook,
mesa, udev, bootstrap_cmds, bison, flex, clangStdenv, autoreconfHook,
mcpp, libepoxy, openssl, pkg-config, llvm, libxslt, libxcrypt, hwdata,
ApplicationServices, Carbon, Cocoa, Xplugin,
@ -906,6 +906,7 @@ self: super:
lndir = super.lndir.overrideAttrs (attrs: {
buildInputs = [];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
preConfigure = ''
export XPROTO_CFLAGS=" "
export XPROTO_LIBS=" "

View File

@ -2,6 +2,7 @@
, stdenv
, buildPackages
, fetchurl
, updateAutotoolsGnuConfigScriptsHook
, bison
, util-linux
@ -97,7 +98,7 @@ stdenv.mkDerivation rec {
strictDeps = true;
# Note: Bison is needed because the patches above modify parse.y.
depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ bison ]
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook bison ]
++ lib.optional withDocs texinfo
++ lib.optional stdenv.hostPlatform.isDarwin stdenv.cc.bintools;

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, autoreconfHook, acl, libintl }:
{ lib, stdenv, fetchurl, autoreconfHook, updateAutotoolsGnuConfigScriptsHook, acl, libintl }:
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
@ -30,7 +30,8 @@ stdenv.mkDerivation rec {
outputs = [ "out" "info" ];
nativeBuildInputs = lib.optional stdenv.isDarwin autoreconfHook;
nativeBuildInputs = lib.optional stdenv.isDarwin autoreconfHook
++ lib.optional (!stdenv.isDarwin) updateAutotoolsGnuConfigScriptsHook;
# Add libintl on Darwin specifically as it fails to link (or skip)
# NLS on it's own:
# "_libintl_textdomain", referenced from:

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, fetchpatch, gettext, coreutils }:
{ lib, stdenv, fetchurl, fetchpatch, gettext, coreutils, updateAutotoolsGnuConfigScriptsHook }:
stdenv.mkDerivation rec {
pname = "sharutils";
@ -13,6 +13,7 @@ stdenv.mkDerivation rec {
# GNU Gettext is needed on non-GNU platforms.
buildInputs = [ coreutils gettext ];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
# These tests try to hit /etc/passwd to find out your username if pass in a submitter
# name on the command line. Since we block access to /etc/passwd on the Darwin sandbox

View File

@ -1,6 +1,7 @@
{ lib, stdenv
, fetchurl
, makeWrapper
, updateAutotoolsGnuConfigScriptsHook
, xz
, runtimeShellPackage
}:
@ -23,8 +24,8 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
buildInputs = [ runtimeShellPackage];
nativeBuildInputs = [ xz.bin makeWrapper ];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook makeWrapper ];
buildInputs = [ runtimeShellPackage ];
makeFlags = [
"SHELL=/bin/sh"

View File

@ -29,6 +29,12 @@ stdenv.mkDerivation (finalAttrs: {
enableParallelBuilding = true;
doCheck = true;
# this could be accomplished by updateAutotoolsGnuConfigScriptsHook, but that causes infinite recursion
# necessary for FreeBSD code path in configure
postPatch = ''
substituteInPlace ./build-aux/config.guess --replace-fail /usr/bin/uname uname
'';
preCheck = ''
# Tests have a /bin/sh dependency...
patchShebangs tests

View File

@ -1,4 +1,5 @@
{ lib, stdenv, fetchurl, file, zlib, libgnurx
, updateAutotoolsGnuConfigScriptsHook
, testers
}:
@ -30,7 +31,8 @@ stdenv.mkDerivation (finalAttrs: {
strictDeps = true;
enableParallelBuilding = true;
nativeBuildInputs = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) file;
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ]
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) file;
buildInputs = [ zlib ]
++ lib.optional stdenv.hostPlatform.isWindows libgnurx;

View File

@ -1,4 +1,5 @@
{ lib, stdenv, fetchurl
, updateAutotoolsGnuConfigScriptsHook
, coreutils
}:
@ -22,6 +23,7 @@ stdenv.mkDerivation rec {
patches = [ ./no-install-statedir.patch ];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
buildInputs = [ coreutils ]; # bin/updatedb script needs to call sort
# Since glibc-2.25 the i686 tests hang reliably right after test-sleep.

View File

@ -65,7 +65,10 @@ stdenv.mkDerivation (finalAttrs: {
./8.7.1-compression-fix.patch
];
# this could be accomplished by updateAutotoolsGnuConfigScriptsHook, but that causes infinite recursion
# necessary for FreeBSD code path in configure
postPatch = ''
substituteInPlace ./config.guess --replace-fail /usr/bin/uname uname
patchShebangs scripts
'';

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, xz, coreutils ? null }:
{ lib, stdenv, fetchurl, updateAutotoolsGnuConfigScriptsHook, xz, coreutils ? null }:
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
outputs = [ "out" "info" ];
nativeBuildInputs = [ (lib.getBin xz) ];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook (lib.getBin xz) ];
/* If no explicit coreutils is given, use the one from stdenv. */
buildInputs = [ coreutils ];

View File

@ -1,4 +1,4 @@
{ lib, stdenv, glibcLocales, fetchurl, pcre2, libiconv, perl, runtimeShellPackage }:
{ lib, stdenv, updateAutotoolsGnuConfigScriptsHook, glibcLocales, fetchurl, pcre2, libiconv, perl, runtimeShellPackage }:
# Note: this package is used for bootstrapping fetchurl, and thus
# cannot use fetchpatch! All mutable patches (generated by GitHub or
@ -26,6 +26,7 @@ stdenv.mkDerivation {
nativeCheckInputs = [ perl glibcLocales ];
outputs = [ "out" "info" ]; # the man pages are rather small
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook ];
buildInputs = [ pcre2 libiconv runtimeShellPackage ];
# cygwin: FAIL: multibyte-white-space

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, perl }:
{ lib, stdenv, fetchurl, updateAutotoolsGnuConfigScriptsHook, perl }:
stdenv.mkDerivation rec {
pname = "gnused";
@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
outputs = [ "out" "info" ];
nativeBuildInputs = [ perl ];
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook perl ];
preConfigure = "patchShebangs ./build-aux/help2man";
# Prevents attempts of running 'help2man' on cross-built binaries.