Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / jbig2enc / default.nix
blob7c847918c9f98b5d7b4686af817f2a676586b49d
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , fetchpatch
5 , python3
6 , leptonica
7 , zlib
8 , libwebp
9 , giflib
10 , libjpeg
11 , libpng
12 , libtiff
13 , autoreconfHook
16 stdenv.mkDerivation rec {
17   pname = "jbig2enc";
18   version = "0.29";
20   src = fetchFromGitHub {
21     owner = "agl";
22     repo = "jbig2enc";
23     rev = version;
24     hash = "sha256-IAL4egXgaGmCilzcryjuvOoHhahyrfGWY68GBfXXgAM=";
25   };
27   nativeBuildInputs = [ autoreconfHook ];
29   propagatedBuildInputs = [
30     leptonica
31     zlib
32     libwebp
33     giflib
34     libjpeg
35     libpng
36     libtiff
37   ];
39   patches = [
40     (fetchpatch {
41       name = "fix-build-leptonica-1.83.patch";
42       url = "https://github.com/agl/jbig2enc/commit/ea050190466f5336c69c6a11baa1cb686677fcab.patch";
43       hash = "sha256-+kScjFgDEU9F7VOUNAhm2XBjGm49fzAH8hYhmTm8xv8=";
44     })
45   ];
47   # We don't want to install this Python 2 script
48   postInstall = ''
49     rm "$out/bin/pdf.py"
50   '';
52   # This is necessary, because the resulting library has
53   # /tmp/nix-build-jbig2enc/src/.libs before /nix/store/jbig2enc/lib
54   # in its rpath, which means that patchelf --shrink-rpath removes
55   # the /nix/store one.  By cleaning up before fixup, we ensure that
56   # the /tmp/nix-build-jbig2enc/src/.libs directory is gone.
57   preFixup = ''
58     make clean
59   '';
61   meta = {
62     description = "Encoder for the JBIG2 image compression format";
63     license = lib.licenses.asl20;
64     platforms = lib.platforms.all;
65     homepage = "https://github.com/agl/jbig2enc";
66     mainProgram = "jbig2";
67   };