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