about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/compression/bzip2/default.nix
blob: 3b48195d11d695fda83c3d681d953175dc8dae53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{ lib, 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.8";

  src = fetchurl {
    url = "https://sourceware.org/pub/bzip2/bzip2-${version}.tar.gz";
    sha256 = "sha256-q1oDF27hBtPw+pDjgdpHjdrkBZGBU8yiSOaCzQxKImk=";
  };

  patchFlags = ["-p0"];

  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
  '';

  strictDeps = true;
  nativeBuildInputs = [ autoreconfHook ];

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

  configureFlags =
    lib.optionals linkStatic [ "--enable-static" "--disable-shared" ];

  enableParallelBuilding = true;

  postInstall = ''
    ln -s $out/lib/libbz2.so.1.0.* $out/lib/libbz2.so.1.0
  '';

  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;
    platforms = platforms.all;
    maintainers = with maintainers; [ mic92 ];
  };
}