1{ lib, stdenv, fetchurl, fetchpatch, m4
2, runtimeShell
3, file
4}:
5
6# Note: this package is used for bootstrapping fetchurl, and thus
7# cannot use fetchpatch! All mutable patches (generated by GitHub or
8# cgit) that are needed here should be included directly in Nixpkgs as
9# files.
10
11stdenv.mkDerivation rec {
12 pname = "libtool";
13 version = "2.4.7";
14
15 src = fetchurl {
16 url = "mirror://gnu/libtool/${pname}-${version}.tar.gz";
17 sha256 = "sha256-BOlsJATqcMWQxUbrpCAqThJyLGQAFsErmy8c49SB6ag=";
18 };
19
20 outputs = [ "out" "lib" ];
21
22 # FILECMD was added in libtool 2.4.7; previous versions hardwired `/usr/bin/file`
23 # https://lists.gnu.org/archive/html/autotools-announce/2022-03/msg00000.html
24 FILECMD = "${file}/bin/file";
25
26 postPatch =
27 # libtool commit da2e352735722917bf0786284411262195a6a3f6 changed
28 # the shebang from `/bin/sh` (which is a special sandbox exception)
29 # to `/usr/bin/env sh`, meaning that we now need to patch shebangs
30 # in libtoolize.in:
31 ''
32 substituteInPlace libtoolize.in --replace '#! /usr/bin/env sh' '#!${runtimeShell}'
33 # avoid help2man run after 'libtoolize.in' update
34 touch doc/libtoolize.1
35 '';
36
37 strictDeps = true;
38 # As libtool is an early bootstrap dependency try hard not to
39 # add autoconf and automake or help2man dependencies here. That way we can
40 # avoid pulling in perl and get away with just an `m4` depend.
41 nativeBuildInputs = [ m4 file ];
42 propagatedBuildInputs = [ m4 file ];
43
44 # Don't fixup "#! /bin/sh" in Libtool, otherwise it will use the
45 # "fixed" path in generated files!
46 dontPatchShebangs = true;
47 dontFixLibtool = true;
48
49 # XXX: The GNU ld wrapper does all sorts of nasty things wrt. RPATH, which
50 # leads to the failure of a number of tests.
51 doCheck = false;
52 doInstallCheck = false;
53
54 enableParallelBuilding = true;
55
56 meta = with lib; {
57 description = "GNU Libtool, a generic library support script";
58 longDescription = ''
59 GNU libtool is a generic library support script. Libtool hides
60 the complexity of using shared libraries behind a consistent,
61 portable interface.
62
63 To use libtool, add the new generic library building commands to
64 your Makefile, Makefile.in, or Makefile.am. See the
65 documentation for details.
66 '';
67 homepage = "https://www.gnu.org/software/libtool/";
68 license = licenses.gpl2Plus;
69 maintainers = [ ];
70 platforms = platforms.unix;
71 mainProgram = "libtool";
72 };
73}