Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libtool: 2.4.6 -> 2.4.7 #167071

Merged
merged 1 commit into from Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions pkgs/development/tools/misc/libtool/libtool2-macos11.patch

This file was deleted.

26 changes: 17 additions & 9 deletions pkgs/development/tools/misc/libtool/libtool2.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ lib, stdenv, fetchurl, fetchpatch, autoconf, automake, m4, perl, help2man
, runtimeShell
, file
}:

# Note: this package is used for bootstrapping fetchurl, and thus
Expand All @@ -8,20 +10,18 @@

stdenv.mkDerivation rec {
pname = "libtool";
version = "2.4.6";
version = "2.4.7";

src = fetchurl {
url = "mirror://gnu/libtool/${pname}-${version}.tar.gz";
sha256 = "1qq61k6lp1fp75xs398yzi6wvbx232l7xbyn3p13cnh27mflvgg3";
sha256 = "sha256-BOlsJATqcMWQxUbrpCAqThJyLGQAFsErmy8c49SB6ag=";
};

outputs = [ "out" "lib" ];

patches = [
# Suport macOS version 11.0
# https://lists.gnu.org/archive/html/libtool-patches/2020-06/msg00001.html
./libtool2-macos11.patch
];
# FILECMD was added in libtool 2.4.7; previous versions hardwired `/usr/bin/file`
# https://lists.gnu.org/archive/html/autotools-announce/2022-03/msg00000.html
SuperSandro2000 marked this conversation as resolved.
Show resolved Hide resolved
FILECMD = "${file}/bin/file";
SuperSandro2000 marked this conversation as resolved.
Show resolved Hide resolved

# Normally we'd use autoreconfHook, but that includes libtoolize.
postPatch = ''
Expand All @@ -34,10 +34,18 @@ stdenv.mkDerivation rec {
automake
autoconf
popd
'' +
# libtool commit da2e352735722917bf0786284411262195a6a3f6 changed
# the shebang from `/bin/sh` (which is a special sandbox exception)
# to `/usr/bin/env sh`, meaning that we now need to patch shebangs
# in libtoolize and ltmain.sh since `dontPatchShebangs` is set:
''
substituteInPlace libtoolize.in --replace '#! /usr/bin/env sh' '#!${runtimeShell}'
substituteInPlace build-aux/ltmain.in --replace '#! /usr/bin/env sh' '#!${runtimeShell}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

substituteInPlace build-aux/ltmain.in --replace '#! /usr/bin/env sh' '#!${runtimeShell}' now leaks out /nix/store paths into tarballs generated under nixpkgs. build-aux/ltmain.sh gets packaged as part of make dist in libtool-aware projects. Encountered it today on ski. Executable reproducer:

$ git clone https://github.com/trofi/ski && cd ski
$ git checkout v1.4.0
$ nix-shell --pure -p autoconf -p lzip -p automake -p libtool -p pkg-config -p libelf -p ncurses -p gperf -p bison -p flex
$$ ./autogen.sh && ./configure && make dist
$$ tar xf ski-1.4.0.tar.xz
$$ fgrep -R  nix/store ski-1.4.0/
ski-1.4.0/build-aux/ltmain.sh:#!/nix/store/3j918i1nbwhby0y38bn2r438rjhh8f4d-bash-5.1-p16/bin/bash

Note how ski-1.4.0/build-aux/ltmain.sh embeds the path to /nix/store.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for catching this.

I'm investigating a few solutions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'';

nativeBuildInputs = [ perl help2man m4 ] ++ [ autoconf automake ];
propagatedBuildInputs = [ m4 ];
nativeBuildInputs = [ autoconf automake help2man m4 perl ];
propagatedBuildInputs = [ m4 file ];

# Don't fixup "#! /bin/sh" in Libtool, otherwise it will use the
# "fixed" path in generated files!
Expand Down