1{
2 lib,
3 stdenv,
4 fetchurl,
5 autoreconfHook,
6 updateAutotoolsGnuConfigScriptsHook,
7 libintl,
8 aclSupport ? lib.meta.availableOn stdenv.hostPlatform acl,
9 acl,
10}:
11
12# Note: this package is used for bootstrapping fetchurl, and thus
13# cannot use fetchpatch! All mutable patches (generated by GitHub or
14# cgit) that are needed here should be included directly in Nixpkgs as
15# files.
16
17stdenv.mkDerivation rec {
18 pname = "gnutar";
19 version = "1.35";
20
21 src = fetchurl {
22 url = "mirror://gnu/tar/tar-${version}.tar.xz";
23 sha256 = "sha256-TWL/NzQux67XSFNTI5MMfPlKz3HDWRiCsmp+pQ8+3BY=";
24 };
25
26 # GNU tar fails to link libiconv even though the configure script detects it.
27 # https://savannah.gnu.org/bugs/index.php?64441
28 patches = [ ./link-libiconv.patch ];
29
30 # gnutar tries to call into gettext between `fork` and `exec`,
31 # which is not safe on darwin.
32 # see http://article.gmane.org/gmane.os.macosx.fink.devel/21882
33 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
34 substituteInPlace src/system.c --replace '_(' 'N_('
35 '';
36
37 outputs = [
38 "out"
39 "info"
40 ];
41
42 nativeBuildInputs = [ autoreconfHook ];
43
44 # Add libintl on Darwin specifically as it fails to link (or skip)
45 # NLS on it's own:
46 # "_libintl_textdomain", referenced from:
47 # _main in tar.o
48 # ld: symbol(s) not found for architecture x86_64
49 buildInputs = lib.optional aclSupport acl ++ lib.optional stdenv.hostPlatform.isDarwin libintl;
50
51 # May have some issues with root compilation because the bootstrap tool
52 # cannot be used as a login shell for now.
53 FORCE_UNSAFE_CONFIGURE = lib.optionalString (
54 stdenv.hostPlatform.system == "armv7l-linux" || stdenv.hostPlatform.isSunOS
55 ) "1";
56
57 preConfigure =
58 if stdenv.hostPlatform.isCygwin then
59 ''
60 sed -i gnu/fpending.h -e 's,include <stdio_ext.h>,,'
61 ''
62 else
63 null;
64
65 doCheck = false; # fails
66 doInstallCheck = false; # fails
67
68 meta = {
69 description = "GNU implementation of the `tar' archiver";
70 longDescription = ''
71 The Tar program provides the ability to create tar archives, as
72 well as various other kinds of manipulation. For example, you
73 can use Tar on previously created archives to extract files, to
74 store additional files, or to update or list files which were
75 already stored.
76
77 Initially, tar archives were used to store files conveniently on
78 magnetic tape. The name "Tar" comes from this use; it stands
79 for tape archiver. Despite the utility's name, Tar can direct
80 its output to available devices, files, or other programs (using
81 pipes), it can even access remote devices or files (as
82 archives).
83 '';
84 homepage = "https://www.gnu.org/software/tar/";
85
86 license = lib.licenses.gpl3Plus;
87
88 maintainers = with lib.maintainers; [ RossComputerGuy ];
89 mainProgram = "tar";
90 platforms = lib.platforms.all;
91
92 priority = 10;
93 };
94}