2024-05-02 00:46:19 +00:00
|
|
|
{ lib, stdenv, fetchurl
|
|
|
|
, enableStatic ? with stdenv.hostPlatform; isStatic || isCygwin
|
2024-05-13 21:24:10 +00:00
|
|
|
, enableShared ? true, autoreconfHook, testers }:
|
2024-05-02 00:46:19 +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.
|
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs:
|
|
|
|
let inherit (finalAttrs) version;
|
|
|
|
in {
|
|
|
|
pname = "bzip2";
|
|
|
|
version = "1.0.8";
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://sourceware.org/pub/bzip2/bzip2-${version}.tar.gz";
|
|
|
|
sha256 = "sha256-q1oDF27hBtPw+pDjgdpHjdrkBZGBU8yiSOaCzQxKImk=";
|
|
|
|
};
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
patchFlags = [ "-p0" ];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
patches = [
|
|
|
|
(fetchurl {
|
|
|
|
url =
|
|
|
|
"https://ftp.suse.com/pub/people/sbrabec/bzip2/for_downstream/bzip2-1.0.6.2-autoconfiscated.patch";
|
|
|
|
sha256 = "sha256-QMufl6ffJVVVVZespvkCbFpB6++R1lnq1687jEsUjr0=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
# Fix up hardcoded version from the above patch, e.g. seen in bzip2.pc or libbz2.so.1.0.N
|
|
|
|
postPatch = ''
|
|
|
|
patch <<-EOF
|
|
|
|
--- configure.ac
|
|
|
|
+++ configure.ac
|
|
|
|
@@ -3,3 +3,3 @@
|
|
|
|
-AC_INIT([bzip2], [1.0.6], [Julian Seward <jseward@bzip.org>])
|
|
|
|
+AC_INIT([bzip2], [${version}], [Julian Seward <jseward@bzip.org>])
|
|
|
|
BZIP2_LT_CURRENT=1
|
|
|
|
-BZIP2_LT_REVISION=6
|
|
|
|
+BZIP2_LT_REVISION=${lib.versions.patch version}
|
|
|
|
EOF
|
|
|
|
'';
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
strictDeps = true;
|
|
|
|
nativeBuildInputs = [ autoreconfHook ];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
outputs = [ "bin" "dev" "out" "man" ];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
configureFlags = lib.concatLists [
|
|
|
|
(lib.optional enableStatic "--enable-static")
|
|
|
|
(lib.optional (!enableShared) "--disable-shared")
|
|
|
|
];
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
dontDisableStatic = enableStatic;
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
enableParallelBuilding = true;
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
postInstall = ''
|
|
|
|
ln -s $out/lib/libbz2.so.1.0.* $out/lib/libbz2.so.1.0
|
|
|
|
'';
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
passthru.tests.pkg-config =
|
|
|
|
testers.testMetaPkgConfig finalAttrs.finalPackage;
|
2024-05-02 00:46:19 +00:00
|
|
|
|
2024-05-13 21:24:10 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "High-quality data compression program";
|
|
|
|
homepage = "https://www.sourceware.org/bzip2";
|
|
|
|
changelog =
|
|
|
|
"https://sourceware.org/git/?p=bzip2.git;a=blob;f=CHANGES;hb=HEAD";
|
|
|
|
license = licenses.bsdOriginal;
|
|
|
|
pkgConfigModules = [ "bzip2" ];
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ mic92 ];
|
|
|
|
};
|
|
|
|
})
|