2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv
|
2020-06-02 18:00:15 +00:00
|
|
|
, fetchurl
|
2023-02-02 18:25:31 +00:00
|
|
|
, makeWrapper
|
2024-06-20 14:57:18 +00:00
|
|
|
, updateAutotoolsGnuConfigScriptsHook
|
|
|
|
, runtimeShellPackage
|
2020-06-02 18:00:15 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
# Note: this package is used for bootstrapping fetchurl, and thus
|
|
|
|
# cannot use fetchpatch! All mutable patches (generated by GitHub or
|
|
|
|
# cgit) that are needed here should be included directly in Nixpkgs as
|
|
|
|
# files.
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "gzip";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "1.13";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://gnu/gzip/${pname}-${version}.tar.xz";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-dFTraTXbF8ZlVXbC4bD6vv04tNCTbg+H9IzQYs6RoFc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "man" "info" ];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
nativeBuildInputs = [ updateAutotoolsGnuConfigScriptsHook makeWrapper ];
|
|
|
|
buildInputs = [ runtimeShellPackage ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
makeFlags = [
|
|
|
|
"SHELL=/bin/sh"
|
|
|
|
"GREP=grep"
|
|
|
|
# gzip 1.12 doesn't build `zless` unless it can find `less`, but we
|
|
|
|
# can avoid having `less` as a build input if we just override these.
|
|
|
|
"ZLESS_MAN=zless.1"
|
|
|
|
"ZLESS_PROG=zless"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# Many gzip executables are shell scripts that depend upon other gzip
|
|
|
|
# executables being in $PATH. Rather than try to re-write all the
|
|
|
|
# internal cross-references, just add $out/bin to PATH at the top of
|
|
|
|
# all the executables that are shell scripts.
|
|
|
|
preFixup = ''
|
|
|
|
sed -i '1{;/#!\/bin\/sh/aPATH="'$out'/bin:$PATH"
|
|
|
|
}' $out/bin/*
|
2023-02-02 18:25:31 +00:00
|
|
|
''
|
|
|
|
# run gzip with "-n" when $GZIP_NO_TIMESTAMPS (set by stdenv's setup.sh) is set to stop gzip from adding timestamps
|
2020-06-02 18:00:15 +00:00
|
|
|
# to archive headers: https://github.com/NixOS/nixpkgs/issues/86348
|
2023-02-02 18:25:31 +00:00
|
|
|
# if changing so that there's no longer a .gzip-wrapped then update copy in make-bootstrap-tools.nix
|
|
|
|
+ ''
|
|
|
|
wrapProgram $out/bin/gzip \
|
|
|
|
--add-flags "\''${GZIP_NO_TIMESTAMPS:+-n}"
|
2020-06-02 18:00:15 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
homepage = "https://www.gnu.org/software/gzip/";
|
|
|
|
description = "GNU zip compression program";
|
|
|
|
|
|
|
|
longDescription =
|
|
|
|
''gzip (GNU zip) is a popular data compression program written by
|
|
|
|
Jean-loup Gailly for the GNU project. Mark Adler wrote the
|
|
|
|
decompression part.
|
|
|
|
|
|
|
|
We developed this program as a replacement for compress because of
|
|
|
|
the Unisys and IBM patents covering the LZW algorithm used by
|
|
|
|
compress. These patents made it impossible for us to use compress,
|
|
|
|
and we needed a replacement. The superior compression ratio of gzip
|
|
|
|
is just a bonus.
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
platforms = lib.platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
license = lib.licenses.gpl3Plus;
|
2024-04-21 15:54:59 +00:00
|
|
|
|
|
|
|
mainProgram = "gzip";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|