nixpkgs/pkgs
Adam Joseph 97c43828fb fixLibtool(): patch ./configure, add file to common-path.nix
libtool's libtool.m4 script assumes that `file` is available, and can
be found at `/usr/bin/file` (this path is hardwired).  Furthermore,
the script with this assumption is vendored into the ./configure
scripts of an enormous number of packages.  Without this commit, you
will frequently see errors like this during the configurePhase with
the sandbox enabled:

  ./configure: line 9595: /usr/bin/file: command not found

Due mostly to luck, this error does not affect native compiles on
nixpkgs' two most popular platforms, x86_64-linux and aarch64-linux.
However it will cause incorrect linker flag detection and a failure to
generate shared libraries for sandboxed cross-builds to a x86_64-linux
host as well as any sandboxed build (cross or native) for the following
hosts: x86_64-freebsd, *-hpux, *-irix, mips64*-linux, powerpc*-linux,
s390x-linux, s390x-tpf, sparc-linux, and *-solaris.

This commit fixes the problem by adding an extra line to fixLibtool()
in pkgs/stdenv/generic/setup.sh.  This extra line will scan the
unpacked source code for executable files named "configure" which
contain the following text:

'GNU Libtool is free software; you can redistribute it and/or modify'

This text is taken to be an indicator of a vendored libtool.m4.  When
it is found, the configure script containing it is subjected to `sed
-i s_/usr/bin/file_file_` which replaces all occurrences of
`/usr/bin/file` with `file`.

Additionally, the `file` package is now considered to be part of
`stdenv`.  It has been added to `common-path.nix` so that the `file`
binary will be found in the `$PATH` of every build, except for the
bootstrap-tools and the first few stages of stdenv boostrapping.

Verified no regressions under:

  nix-build --arg pkgs 'import ./. {}' ./lib/tests/release.nix

This commit allows the following commands to complete, which should
enable Hydra to produce bootstrap-files for mips64el:

  nix-build \
    --option sandbox true \
    --option sandbox-fallback false \
    pkgs/top-level/release-cross.nix \
    -A bootstrapTools.mips64el-linux-gnuabi64.build

  nix-build \
    --option sandbox true \
    --option sandbox-fallback false \
    . \
    -A pkgsCross.mips64el-linux-gnuabi64.nix_2_4
2022-05-26 13:53:36 -07:00
..
applications Merge staging-next into staging 2022-05-25 18:01:56 +00:00
build-support Merge pull request #172962 from Artturin/defaultparallelnorebuild 2022-05-25 12:25:34 -07:00
common-updater
data treewide: extraPostFetch -> postFetch 2022-05-23 17:18:50 +03:00
desktops Merge pull request #174102 from jtojnar/gnome-updates 2022-05-25 19:26:26 +02:00
development Merge pull request #172962 from Artturin/defaultparallelnorebuild 2022-05-25 12:25:34 -07:00
games Merge pull request #174337 from SuperSandro2000/lincity 2022-05-25 18:14:39 +02:00
misc betterlockscreen: 4.0.3 -> 4.0.4 2022-05-25 04:52:41 +00:00
os-specific Merge pull request #172962 from Artturin/defaultparallelnorebuild 2022-05-25 12:25:34 -07:00
pkgs-lib
servers Merge pull request #174563 from SuperSandro2000/go-camo 2022-05-25 20:00:53 +02:00
shells nushell: 0.61.0 -> 0.62.0 2022-05-20 15:32:32 +02:00
stdenv fixLibtool(): patch ./configure, add file to common-path.nix 2022-05-26 13:53:36 -07:00
test Merge master into staging-next 2022-05-23 18:01:20 +00:00
tools Merge pull request #172962 from Artturin/defaultparallelnorebuild 2022-05-25 12:25:34 -07:00
top-level Merge staging-next into staging 2022-05-25 18:01:56 +00:00