at 23.11-beta 75 lines 2.2 kB view raw
1{ lib, stdenv, fetchurl 2, enableStatic ? with stdenv.hostPlatform; isStatic || isCygwin 3, enableShared ? true 4, autoreconfHook 5, testers 6}: 7 8# Note: this package is used for bootstrapping fetchurl, and thus 9# cannot use fetchpatch! All mutable patches (generated by GitHub or 10# cgit) that are needed here should be included directly in Nixpkgs as 11# files. 12 13stdenv.mkDerivation (finalAttrs: let 14 inherit (finalAttrs) version; 15in { 16 pname = "bzip2"; 17 version = "1.0.8"; 18 19 src = fetchurl { 20 url = "https://sourceware.org/pub/bzip2/bzip2-${version}.tar.gz"; 21 sha256 = "sha256-q1oDF27hBtPw+pDjgdpHjdrkBZGBU8yiSOaCzQxKImk="; 22 }; 23 24 patchFlags = ["-p0"]; 25 26 patches = [ 27 (fetchurl { 28 url = "https://ftp.suse.com/pub/people/sbrabec/bzip2/for_downstream/bzip2-1.0.6.2-autoconfiscated.patch"; 29 sha256 = "sha256-QMufl6ffJVVVVZespvkCbFpB6++R1lnq1687jEsUjr0="; 30 }) 31 ]; 32 # Fix up hardcoded version from the above patch, e.g. seen in bzip2.pc or libbz2.so.1.0.N 33 postPatch = '' 34 patch <<-EOF 35 --- configure.ac 36 +++ configure.ac 37 @@ -3,3 +3,3 @@ 38 -AC_INIT([bzip2], [1.0.6], [Julian Seward <jseward@bzip.org>]) 39 +AC_INIT([bzip2], [${version}], [Julian Seward <jseward@bzip.org>]) 40 BZIP2_LT_CURRENT=1 41 -BZIP2_LT_REVISION=6 42 +BZIP2_LT_REVISION=${lib.versions.patch version} 43 EOF 44 ''; 45 46 strictDeps = true; 47 nativeBuildInputs = [ autoreconfHook ]; 48 49 outputs = [ "bin" "dev" "out" "man" ]; 50 51 configureFlags = lib.concatLists [ 52 (lib.optional enableStatic "--enable-static") 53 (lib.optional (!enableShared) "--disable-shared") 54 ]; 55 56 dontDisableStatic = enableStatic; 57 58 enableParallelBuilding = true; 59 60 postInstall = '' 61 ln -s $out/lib/libbz2.so.1.0.* $out/lib/libbz2.so.1.0 62 ''; 63 64 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 65 66 meta = with lib; { 67 description = "High-quality data compression program"; 68 homepage = "https://www.sourceware.org/bzip2"; 69 changelog = "https://sourceware.org/git/?p=bzip2.git;a=blob;f=CHANGES;hb=HEAD"; 70 license = licenses.bsdOriginal; 71 pkgConfigModules = [ "bzip2" ]; 72 platforms = platforms.all; 73 maintainers = with maintainers; [ mic92 ]; 74 }; 75})