1 { lib, stdenv, fetchurl, autoreconfHook, updateAutotoolsGnuConfigScriptsHook
3 , aclSupport ? lib.meta.availableOn stdenv.hostPlatform acl, acl
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
11 stdenv.mkDerivation rec {
16 url = "mirror://gnu/tar/tar-${version}.tar.xz";
17 sha256 = "sha256-TWL/NzQux67XSFNTI5MMfPlKz3HDWRiCsmp+pQ8+3BY=";
20 # GNU tar fails to link libiconv even though the configure script detects it.
21 # https://savannah.gnu.org/bugs/index.php?64441
22 patches = [ ./link-libiconv.patch ];
24 # gnutar tries to call into gettext between `fork` and `exec`,
25 # which is not safe on darwin.
26 # see http://article.gmane.org/gmane.os.macosx.fink.devel/21882
27 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
28 substituteInPlace src/system.c --replace '_(' 'N_('
31 outputs = [ "out" "info" ];
33 nativeBuildInputs = [ autoreconfHook ];
35 # Add libintl on Darwin specifically as it fails to link (or skip)
37 # "_libintl_textdomain", referenced from:
39 # ld: symbol(s) not found for architecture x86_64
40 buildInputs = lib.optional aclSupport acl ++ lib.optional stdenv.hostPlatform.isDarwin libintl;
42 # May have some issues with root compilation because the bootstrap tool
43 # cannot be used as a login shell for now.
44 FORCE_UNSAFE_CONFIGURE = lib.optionalString (stdenv.hostPlatform.system == "armv7l-linux" || stdenv.hostPlatform.isSunOS) "1";
46 preConfigure = if stdenv.hostPlatform.isCygwin then ''
47 sed -i gnu/fpending.h -e 's,include <stdio_ext.h>,,'
50 doCheck = false; # fails
51 doInstallCheck = false; # fails
54 description = "GNU implementation of the `tar' archiver";
56 The Tar program provides the ability to create tar archives, as
57 well as various other kinds of manipulation. For example, you
58 can use Tar on previously created archives to extract files, to
59 store additional files, or to update or list files which were
62 Initially, tar archives were used to store files conveniently on
63 magnetic tape. The name "Tar" comes from this use; it stands
64 for tape archiver. Despite the utility's name, Tar can direct
65 its output to available devices, files, or other programs (using
66 pipes), it can even access remote devices or files (as
69 homepage = "https://www.gnu.org/software/tar/";
71 license = lib.licenses.gpl3Plus;
73 maintainers = with lib.maintainers; [ RossComputerGuy ];
75 platforms = lib.platforms.all;