Skip to content

Commit f174277

Browse files
authored
Merge pull request #168413 from a-m-joseph/libtool-purity-fix-put-file-in-bootstrap
fixLibtool(): replace /usr/bin/file in ./configure, add file to common-path.nix
2 parents daf4bee + 97c4382 commit f174277

4 files changed

Lines changed: 27 additions & 1 deletion

File tree

pkgs/stdenv/common-path.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,12 @@
1212
pkgs.bash
1313
pkgs.patch
1414
pkgs.xz.bin
15+
16+
# The `file` command is added here because an enormous number of
17+
# packages have a vendored dependency upon `file` in their
18+
# `./configure` script, due to libtool<=2.4.6, or due to
19+
# libtool>=2.4.7 in which the package author decided to set FILECMD
20+
# when running libtoolize. In fact, file-5.4.6 *depends on itself*
21+
# and tries to invoke `file` from its own ./configure script.
22+
pkgs.file
1523
]

pkgs/stdenv/darwin/default.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ rec {
486486
gmp
487487
libiconv
488488
brotli.lib
489+
file
489490
] ++ lib.optional haveKRB5 libkrb5) ++
490491
(with pkgs."${finalLlvmPackages}"; [
491492
libcxx
@@ -561,6 +562,7 @@ rec {
561562
gmp
562563
libiconv
563564
brotli.lib
565+
file
564566
] ++ lib.optional haveKRB5 libkrb5) ++
565567
(with pkgs."${finalLlvmPackages}"; [
566568
libcxx
@@ -737,6 +739,7 @@ rec {
737739
brotli.lib
738740
cc.expand-response-params
739741
libxml2.out
742+
file
740743
] ++ lib.optional haveKRB5 libkrb5
741744
++ lib.optionals localSystem.isAarch64 [
742745
pkgs.updateAutotoolsGnuConfigScriptsHook

pkgs/stdenv/generic/setup.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,21 @@ configurePhase() {
10211021
echo "fixing libtool script $i"
10221022
fixLibtool "$i"
10231023
done
1024+
1025+
# replace `/usr/bin/file` with `file` in any `configure`
1026+
# scripts with vendored libtool code. Preserve mtimes to
1027+
# prevent some packages (e.g. libidn2) from spontaneously
1028+
# autoreconf'ing themselves
1029+
CONFIGURE_MTIME_REFERENCE=$(mktemp configure.mtime.reference.XXX)
1030+
find . \
1031+
-executable \
1032+
-type f \
1033+
-name configure \
1034+
-execdir grep -l 'GNU Libtool is free software; you can redistribute it and/or modify' {} \; \
1035+
-execdir touch -r {} "$CONFIGURE_MTIME_REFERENCE" \; \
1036+
-execdir sed -i s_/usr/bin/file_file_g {} \; \
1037+
-execdir touch -r "$CONFIGURE_MTIME_REFERENCE" {} \;
1038+
rm -f "$CONFIGURE_MTIME_REFERENCE"
10241039
fi
10251040

10261041
if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then

pkgs/stdenv/linux/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ in
417417
# Simple executable tools
418418
concatMap (p: [ (getBin p) (getLib p) ]) [
419419
gzip bzip2 xz bash binutils.bintools coreutils diffutils findutils
420-
gawk gnumake gnused gnutar gnugrep gnupatch patchelf ed
420+
gawk gnumake gnused gnutar gnugrep gnupatch patchelf ed file
421421
]
422422
# Library dependencies
423423
++ map getLib (

0 commit comments

Comments
 (0)