Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bzip2: 1.0.6 -> 1.0.8 #94969

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions pkgs/tools/compression/bzip2/1.0.6.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{ stdenv, fetchurl
, linkStatic ? (stdenv.hostPlatform.system == "i686-cygwin")
, 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 = [];
};
}
48 changes: 22 additions & 26 deletions pkgs/tools/compression/bzip2/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{ stdenv, fetchurl
{ stdenv, lib, fetchurl
, linkStatic ? (stdenv.hostPlatform.system == "i686-cygwin")
, autoreconfHook
}:

# Note: this package is used for bootstrapping fetchurl, and thus
Expand All @@ -10,37 +9,34 @@

stdenv.mkDerivation rec {
pname = "bzip2";
version = "1.0.6.0.1";
version = "1.0.8";

/* 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";
url = "https://sourceware.org/pub/bzip2/${pname}-${version}.tar.gz";
sha256 = "0s92986cv0p692icqlw1j42y9nld8zd83qwhzbqd61p1dqbh6nmb";
};

nativeBuildInputs = [ autoreconfHook ];
outputs = [ "bin" "dev" "out" "man" ] ++ lib.optionals linkStatic [ "static" ];

patches = [
./CVE-2016-3189.patch
./cve-2019-12900.patch
];

postPatch = ''
sed -i -e '/<sys\\stat\.h>/s|\\|/|' bzip2.c
buildPhase = ''
cc=${cc:-$CC}
make CC=cc
make CC=cc -f Makefile-libbz2_so
'';

outputs = [ "bin" "dev" "out" "man" ];

configureFlags =
stdenv.lib.optionals linkStatic [ "--enable-static" "--disable-shared" ];
installFlags = [ "PREFIX=$(out)" ];

postInstall = ''
moveToOutput bin $bin
ln -s libbz2.so.1.0 libbz2.so.1
jonringer marked this conversation as resolved.
Show resolved Hide resolved
ln -s libbz2.so.1 libbz2.so
mv libbz2.so* $out/lib
'' + (if linkStatic then ''
mkdir -p $static/lib
mv $out/lib/libz2.a $static/lib/libz2.a
'' else ''
rm $out/lib/libbz2.a
'');

enableParallelBuilding = true;

Expand Down
5 changes: 4 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2571,7 +2571,10 @@ in
inherit (llvmPackages) openmp;
};

bzip2 = callPackage ../tools/compression/bzip2 { };
bzip2 = if stdenv.isDarwin then
callPackage ../tools/compression/bzip2/1.0.6.nix { }
else
callPackage ../tools/compression/bzip2 { };

cabextract = callPackage ../tools/archivers/cabextract { };

Expand Down