nixpkgs/pkgs/tools/compression/bzip2/default.nix
John Ericson f52263ced0 treewide: Start to break up static overlay
We can use use `stdenv.hostPlatform.isStatic` instead, and move the
logic per package. The least opionated benefit of this is that it makes
it much easier to replace packages with modified ones, as there is no
longer any issue of overlay order.

CC @FRidh @matthewbauer
2021-01-03 19:18:16 +00:00

54 lines
1.4 KiB
Nix

{ stdenv, fetchurl
, linkStatic ? with stdenv.hostPlatform; isStatic || isCygwin
, autoreconfHook
}:
# 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.
stdenv.mkDerivation rec {
pname = "bzip2";
version = "1.0.6.0.1";
/* We use versions patched to use autotools style properly,
saving lots of trouble. */
src = fetchurl {
urls = map
(prefix: prefix + "/people/sbrabec/bzip2/tarballs/${pname}-${version}.tar.gz")
[
"http://ftp.uni-kl.de/pub/linux/suse"
"ftp://ftp.hs.uni-hamburg.de/pub/mirrors/suse"
"ftp://ftp.mplayerhq.hu/pub/linux/suse"
"http://ftp.suse.com/pub" # the original patched version but slow
];
sha256 = "0b5b5p8c7bslc6fslcr1nj9136412v3qcvbg6yxi9argq9g72v8c";
};
nativeBuildInputs = [ autoreconfHook ];
patches = [
./CVE-2016-3189.patch
./cve-2019-12900.patch
];
postPatch = ''
sed -i -e '/<sys\\stat\.h>/s|\\|/|' bzip2.c
'';
outputs = [ "bin" "dev" "out" "man" ];
configureFlags =
stdenv.lib.optionals linkStatic [ "--enable-static" "--disable-shared" ];
enableParallelBuilding = true;
meta = with stdenv.lib; {
description = "High-quality data compression program";
license = licenses.bsdOriginal;
platforms = platforms.all;
maintainers = [];
};
}