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